ScriptCompare

From Amulets & Armor Wiki
Revision as of 12:22, 5 March 2014 by PeeWeeRotA (Talk | contribs) (Created page with "'''Compare( [Value1], [Value2])''' The compare command checks if two values are Equal. It then sets a flag used by the next If statement. The values can be varia...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Compare( [Value1], [Value2])

The compare command checks if two values are Equal. It then sets a flag used by the next If statement. The values can be variables or literal values.

Arguments

Value1 - First value to compare

Value2 - Second Value to Compare

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()