ScriptSet
From Amulets & Armor Wiki
Revision as of 12:44, 5 March 2014 by 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. ...")
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.
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()