Difference between revisions of "Label"

From GTAMods Wiki
Jump to navigation Jump to search
 
Line 16: Line 16:
  
 
Sanny Builder also has a feature to display a list of all labels used in source code when you type <code>@</code> into the editor.
 
Sanny Builder also has a feature to display a list of all labels used in source code when you type <code>@</code> into the editor.
 +
 +
As a label specifies a location within the script an arbitrary integer number can be used instead. Positive numbers and ''0'' serve as an offset from the beginning of the main script, whereas a negative number serves as a local offset from the beginning of a mission or an [[external script]] where it is used.
 +
 +
{{Pre|class=sb-code|1=
 +
0002: <span class="k">jump</span> <span class="m">100</span> <span class="c1">// can be used anywhere</span>
 +
0002: <span class="k">jump</span> <span class="m">-21</span> <span class="c1">// can be used only within a mission/external script</span>
 +
}}
  
 
== See also ==
 
== See also ==

Latest revision as of 16:13, 27 May 2019

Label is a part of almost any script. It is a sequence of characters that identifies a specific location within the script. In Sanny Builder, labels are denoted with a : (colon sign) as the first character followed by letters, digits, or _ (underscore sign). Labels are case-insensitive.

Example:

:Label

Labels are widely used in scripts in unconditional and conditional jumps. To go to a specific label, you must use its name with a @ (at sign) as the first character.

Example:

0002: jump @Label

Sanny Builder also has a feature to display a list of all labels used in source code when you type @ into the editor.

As a label specifies a location within the script an arbitrary integer number can be used instead. Positive numbers and 0 serve as an offset from the beginning of the main script, whereas a negative number serves as a local offset from the beginning of a mission or an external script where it is used.

0002: jump 100 // can be used anywhere
0002: jump -21 // can be used only within a mission/external script

See also