This post showcases soon™-to-be-documented JIP LN NVSE script runner. This feature is already included and enabled in JIP LN NVSE, and can be used right now.
Updated 2022-07-25: Removed unused and outdated information, documented some limitations.
JIP LN NVSE scans the directory Data\nvse\plugins\scripts and runs text scripts with certain prefixes on the following events:
- gr_*.txt on game start,
- gl_*.txt on game load,
- gs_*.txt on game save,
- gx_*.txt on game exit,
- xm_*.txt on exit to the main menu,
- gn_*.txt on new game (as of JIP LN 56.34),
- ln_*.txt on new game and game load (as of JIP LN 56.95).
As of xNVSE 6.21, text scripts support almost full range of NVSE expressions, including loops and lambdas. The most notable exception is the $ operator, which must be replaced with GetName or inline expressions – instead of $sString, write (sString). File size of a text script cannot exceed 16384 bytes.
What’s the catch? These files are executed in the console environment, hence Editor IDs are not resolved by default. There are a few ways to circumvent this.
- If it is a vanilla FalloutNV.esm form, you can refer to it by its FormID, wrapped in quotes:
"F"is Bottle Cap,
"A"is Bobby Pin,
"20420"is Combat Armor,
"433F"is Minigun, and so on.
- To retrieve forms from other plugins, use BuildRef, GetFormFromMod, or StringToRef.
- To continue using Editor IDs, add JohnnyGuitar NVSE to the list of dependencies of your mod. JG preloads all Editor IDs, allowing to use them in console and text scripts.
This is not specific to text scripts, but should be mentioned nevertheless: total length of a lambda function is limited to 512 characters, including indentation.