Difference between revisions of "Sv Construct"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Odessa
(Created page with "{{Function |origin = NVSE |summary = Returns a string variable constructed from the specified string and up to 20 formatting arguments. If no formattin...")
 
imported>Odessa
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Function
{{Function
  |origin = NVSE
  |origin = NVSE
  |summary = Returns a string variable constructed from the specified string and up to 20 [[String Formatting|formatting]] arguments. If no formatting is required, this function is not necessary, as the [[Let]] command can be used to assign string variables.
  |summary = Returns a string variable constructed from the specified string and up to 20 [[String Formatting|formatting]] arguments.  
 
If no formatting is required, this function is not necessary, as the [[Let]] command can be used to assign string variables. Note that <b>Let</b> supports concatanation and the [[ToString|ToString($)]] function which can usually achieve the same result as formatting.


  |name = Sv_Construct
  |name = Sv_Construct
Line 18: Line 20:
ref rActor
ref rActor


let my_string := "Simple text" ; * Sv_Construct is not necessary
; Used to construct a formatted string:


let my_string := Sv_Construct "iValue equals %g and rActor's name is %n", iValue, rActor
let my_string := Sv_Construct "iValue equals %g and rActor's name is %n", iValue, rActor
</pre>
Typically you can skip Sv_Construct and use concatanation with [[ToString|ToString($)]] instead of formatting, if you prefer:
<pre>
let my_string := "iValue equals " + $iValue + " and rActor's name is " + $rActor
</pre>
</pre>
==See Also==
==See Also==
*[[String Variable]]
*[[String Variable]]
*[[String Formatting]]
*[[Let]]
*[[Let]]
[[Category:Functions_(NVSE)]]
[[Category:Functions_(NVSE)]]
[[Category:String Variables]]
[[Category:String Variables]]

Latest revision as of 09:24, 28 July 2014

< [[::Category:Functions|Category:Functions]]

A function added by the New Vegas Script Extender.

Description

Returns a string variable constructed from the specified string and up to 20 formatting arguments.

If no formatting is required, this function is not necessary, as the Let command can be used to assign string variables. Note that Let supports concatanation and the ToString($) function which can usually achieve the same result as formatting.

Syntax

[help]
(string_var) Sv_Construct Literal:string Formatting

Example

string_var my_string
int iValue
ref rActor

; Used to construct a formatted string:

let my_string := Sv_Construct "iValue equals %g and rActor's name is %n", iValue, rActor

Typically you can skip Sv_Construct and use concatanation with ToString($) instead of formatting, if you prefer:

let my_string := "iValue equals " + $iValue + " and rActor's name is " + $rActor

See Also