ScriptGoto

From Amulets & Armor Wiki
Jump to: navigation, search

Goto( [ScriptNum] )

Stops executing the current script and starts executing the specified script.

Note: Since GOTO uses script numbers, instead of traditional Line numbers and labels, Goto cannot be used to conditionally skip blocks of code like traditional assembly usage. Although script numbers resemble labels, they all contain End commands that stop execution of the current script.

Goto's main use is to change to a new script without putting the new script into scope by loading it onto an execution stack, like seen in Gosub. Script commands placed after a Goto will not be run.

Arguments

ScriptNum - Script to execute

Example

10:     // Activate druid on lift
   Compare(DruidLift, ACTIVATED);
   If(Equal, 99);
   Block(Block1);
   SlideFloor(66, 0, -88, 140, -1);
   AreaSound(5001, -1099, 2817, 400, 255);
   Set(DruidLift, ACTIVATED);
   Unblock(Block1);
   End();

11:     // Druid lift down
   Compare(DruidLift, NOT_ACTIVATED);
   If(Equal, 10);
   Block(Block2);
   SlideFloor(66, 0, -280, 140, -1);
   AreaSound(5001, -1099, 2817, 400, 255);
   Set(DruidLift, NOT_ACTIVATED);
   Delay(200);
   SlideFloor(159, 0, -200, 100, -1);
   AreaSound(5003, -1099, 2817, 400, 255);
   Delay(600);
   SlideFloor(159, 0, -340, 100, -1);
   AreaSound(5003, -1099, 2817, 400, 255);
   Unblock(Block2);
   Goto(10);
   End();
99:     // all purpose ender
   End();



Back to Scripting Main Page