Difference between revisions of "GoTo"
Jump to navigation
Jump to search
Updated notes, standardized alias wording
imported>WereWolf |
imported>Haama (Updated notes, standardized alias wording) |
||
Line 4: | Line 4: | ||
GoTo ''[labelID]'' | GoTo ''[labelID]'' | ||
This command causes script processing to jump to a label defined within the same script. | An alias for [[RestoreIP]]. This command causes script processing to jump to a label defined within the same script. Use [[Label]] or [[SaveIP]] to define the instruction point to which to jump. Optional label IDs allow for multiple labels or nested loops within a script. | ||
'''Example:''' | '''Example:''' | ||
Line 68: | Line 68: | ||
==Notes== | ==Notes== | ||
* Be careful to make sure your loop has an exit condition, otherwise you run the risk of creating an infinite loop, which can freeze the game and make it impossible for the player to exit. | * Be careful to make sure your loop has an exit condition, otherwise you run the risk of creating an infinite loop, which can freeze the game and make it impossible for the player to exit. | ||
* For the most part, scripts will run one at a time and different scripts can use the same label IDs without any problems. However, result scripts and scripts with onActivate blocks will run instantly when called via script ([[SetStage]] and '''''ObjectRef.Activate player, 1''''', respectively), before the next line of code proceeds. For those two script types, make sure the IDs are unique. | |||
** If you use a label ID in the calling script, and then the same ID in the called script, the ID will be set to the location in the called script. If the calling script uses '''''Goto ID''''', when that ID is set to another script, it will act as a [[Return]]. | |||
==See Also== | ==See Also== |