String Variable
String variables are added by NVSE 4. A string is simply some combination of text characters and exists widely in the vanilla game. A string variable allows you to store a string in a similar way to any other variable, and a wide range of functions allow powerful capabilities for them.
String variables are very simple to use, provided you also use Let instead of set .. to .. and 'if eval' instead of simply if. To appreciate the full range of possibilites available, a tutorial is available.
String variables can have a maximum of 16,384 characters.
Simple Example
string_var my_string let my_string := "this is my string" let my_string += " and this is Sunny's name: " + $SunnyREF if eval my_string == "this is my string and this is Sunny's name: Sunny Smiles" ; this will evaluate true endif
The ToString (shorthand: '$') function converts anything to a string. Vanilla and some old NVSE functions also require this to use a string_var instead of the string formatting "%z" or a string literal:
Print my_string ; * new NVSE function MessageEx $my_string ; * An old NVSE function
If you want to use String Formatting rather than concatanation (+), you need to use Sv_Construct:
string_var my_string int MyInt let MyInt := 5 let my_string := Sv_Construct "the value of MyInt is %g", MyInt