Difference between revisions of "StrExpr"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Tibixe
imported>Tibixe
Line 14: Line 14:
'''String variable block:'''
'''String variable block:'''
Syntax: ''${stringID_variable}''
Syntax: ''${stringID_variable}''
Replaced with the string associated with ''stringID''
Replaced with the string associated with ''stringID''


'''Variable value block:'''
'''Variable value block:'''
Syntax: ''?{number_variable}''
Syntax: ''?{number_variable}''
Replaced with the value of the variable ( in decimal form ).
Replaced with the value of the variable ( in decimal form ).


'''Variable sequence block:'''
'''Variable sequence block:'''
Syntax: ''@{first_variable}''
Syntax: ''@{first_variable}''
Replaced with the string produced by interpreting the variables as characters, starting from ''first_variable'', until a zero value is found. See [[StrLoad]] and [[StrSave]]
Replaced with the string produced by interpreting the variables as characters, starting from ''first_variable'', until a zero value is found. See [[StrLoad]] and [[StrSave]]



Revision as of 12:00, 26 January 2008

Function:

 StrExpr stringToSet:stringID expression:string

Example

 StrExpr myString "${npcname} has ?{count} ${objectname}s"

Interprets an expression an writes the result to the string associated with the stringID given.

Expression syntax

A block is a part of an expression in the form of (sigil character)(opening brace)(variable name)(closing brace), such as ?{count}.

Three type of blocks can appear in expressions:

String variable block: Syntax: ${stringID_variable}

Replaced with the string associated with stringID

Variable value block: Syntax: ?{number_variable}

Replaced with the value of the variable ( in decimal form ).

Variable sequence block: Syntax: @{first_variable}

Replaced with the string produced by interpreting the variables as characters, starting from first_variable, until a zero value is found. See StrLoad and StrSave

Usage example

short playername
short itemname

begin ScriptEffectStart

set itemname to StrGetName
set playername to player.StrGetName
StrExpr itemname "${playername}'s ${itemname}"
StrSetName itemname

StrDel playername
StrDel itemnamename

end