Difference between revisions of "String Variable"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Odessa
(mistake, missed $)
imported>Odessa
(mistake, need sv_construct to use format specifiers)
Line 18: Line 18:
</pre>
</pre>


To use format specifiers, you need to use [[Sv_Construct]]:
<pre>
<pre>
string_var my_string
string_var my_string
Line 23: Line 24:


let MyInt := 5
let MyInt := 5
let my_string := "the value of MyInt is %g", MyInt
let my_string := Sv_Construct "the value of MyInt is %g", MyInt
</pre>
</pre>
==See Also==
==See Also==
Line 29: Line 30:
*[[Eval]]
*[[Eval]]
*[[ToString]]
*[[ToString]]
*[[Sv_Construct]]
[[Category:String Variables]]
[[Category:String Variables]]
[[Category:NVSE]]
[[Category:NVSE]]

Revision as of 05:09, 28 June 2014

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 and 'if eval' instead of simply 'if'. To appreciate the full range of possibilites available, a tutorial is available.

Simple Example

string_var my_string

let my_string := "this is my string"

MessageEx $my_string

; * note: the MessageEx function requires you to include '$' (short for 'ToString') before the variable name

if eval my_string == "this is another string"
   ; do something. Obviously this is false in this case.
endif

To use format specifiers, 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

See Also