Difference between revisions of "ScriptSet"
From Amulets & Armor Wiki
PeeWeeRotA (Talk | contribs) (Created page with "'''Set( [Variable], [Value])''' Sets the value of the specified variable to the value. The specified variable must be declared using a defvar line in the variables section. ...") |
PeeWeeRotA (Talk | contribs) |
||
Line 2: | Line 2: | ||
Sets the value of the specified variable to the value. The specified variable must be declared using a defvar line in the variables section. | Sets the value of the specified variable to the value. The specified variable must be declared using a defvar line in the variables section. | ||
+ | |||
+ | The value can be a literal value, another variable, or a constant declared using a defnumline. | ||
'''Note:''' | '''Note:''' |
Latest revision as of 12:45, 5 March 2014
Set( [Variable], [Value])
Sets the value of the specified variable to the value. The specified variable must be declared using a defvar line in the variables section.
The value can be a literal value, another variable, or a constant declared using a defnumline.
Note: Variables are not set at creation, so they must be set before being used. Script function 0 executes at the level beginning and is the best place to initialize variables.
Arguments
Variable - Variable to set
Value - Value to change variable to
Code Example
defnum NOT_COMPLETE 0 defnum COMPLETE 1 // Variables are defined with defvar and you have 1..255 of them defvar ExitSwitch 1 defvar Block1 2 Initialize: 0: // Script run when the level is loaded Set(ExitSwitch, NOT_COMPLETE); Unblock(Block1); End() 40: // raise exit floor with switch Compare(ExitSwitch, COMPLETE); If (Equal, 99); Block(Block1); ChangeSideTexture(1373,"SWIT1U"); AreaSound(6007,-2943,-12,300,255); SlideFloorNice(114, -400, -64, 100, -1); Set(ExitSwitch, COMPLETE); Unblock(Block1); End() 99: //Escape function End()