From Scriptwiki
Jump to: navigation, search

The /goto command allows you to jump from one point in a script to another point.

/goto <label>

Note: Using a goto incorrectly could lead to an infinite loop. You can break out of a currently running script by pressing Control+Break.

You can also use a variable as a goto name, eg.


If %jumppoint were set to 5, /goto 5 would jump to that point in the script.


/number {
if ($1 == 1) goto one
elseif ($1 == 2) goto two
else goto unknown
echo One
echo Two 
echo Unknown number!

In the above alias, if the first parameter were 1, it would jump to label one, otherwise if it were 2 it would jump to label two. If it is none of those, it will jump to the unknown label.

/randpoint {
var %jump1 = 1, %jump2 = 2
goto $r(1,2)
echo Picked jump 1!
echo Picked jump 2!

The above alias is an example of using a variable as a point name. It will pick either point 1 or 2.