Difference between revisions of "SCM language"

From GTAMods Wiki
Jump to navigation Jump to search
m (Wrong redirect.)
(Time to publish the reworked article in its current state for historical reasons.)
 
(29 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{This|This section deals with the native SCM syntax of GTA 3 series, nothing other than [[GTA 3|III]], [[GTA VC|VC]], [[GTA SA|SA]], [[GTA LCS|LCS]] and [[GTA VCS|VCS]].<br/>
+
{{Cleanup-rewrite}}
It may contain non-standard SCM definitions as R* hasn't published enough documentation about it yet.}}
+
{{This|This article deals with the native scripting language syntax of GTA 3 series, nothing other than [[GTA 3|III]], [[GTA VC|VC]], [[GTA SA|SA]], [[GTA LCS|LCS]] and [[GTA VCS|VCS]].<br/>
{{TocRight}}On the occasion of the ''GTAIII's Tenth Anniversary'', after a long period of darkness where we fell about the real ''SCM'' syntax, R* finally treated us by attaching part of its own original source code into the ''GTAIII Anniversary'' game, available for ''iOS'' and ''Android'' devices. As far back as 2001, a snip of some debugging scripts has been already provided with ''main.sc'' and ''debug.sc'' files. However, many secrets are unrevealed yet, thus some things cannot be documented fully and so they can be only guessed. The ''SCM'' format abbreviation is one of countless proofs of this inconvenience, which may stand for ''Script Multifile''. Other doubts come with source files, whose ''SC'' extension appears to be very close to ''Mission SCript''. Although we have enough information to suppose the currently unknown mysteries of the used language, we still have no safe clue about which was its original denomination. Furthermore, it is a matter of fact that R* developers have been left untouched the ''miss2'' executable name of the ''GTA 3 series'' compiler since the chapter 2. In this connection, we could imagine the new language is a variant or an evolution of the '''GTA2script'''. In the ancient documentation by ''DMA'' (at present ''Rockstar North''), ''GBH'' sound like the initials of the codename or the primordial name of ''GTA2'', as the former is expressly stricken and overwritten by the latter (''<del>GBH</del><ins>GTA2</ins>'' occurs twice, whereas ''<del>GBHscript</del><ins>GTA2script</ins>'' only once), while ''GBHscript'' and ''GTA2script'' are quite recurring. Therefore, we are almost sure to say the language name is most likely '''GTA3script'''. However, it is definitely based on [[Wikipedia:BASIC|BASIC]].
+
It may incorporate nonstandard specifications due to the fact R* hasn't published enough documentation about yet.}}
 +
{{TocRight}}On the occasion of the "Grand Theft Auto III 10th Anniversary", after a long period of darkness where we fell about the real scripting language syntax, R* finally treated us (or was it, as it seems, a [[Wikipedia:War Drum Studios|War Drum Studios]] sloppy oversight?) by attaching part of its own original source code into the Mobile release, available for iOS and Android devices. A year later, the so-called official compiler, somewhat customized for the sake of convenience, was shipped via the remastered edition of Vice City. As far back as 2001, a snip of some debugging scripts has been already provided with ''main.sc'' and ''debug.sc'' script files that were allegedly meaningful for a sort of script version checker uncut on debug builds. Nonetheless, many secrets are still unrevealed, thus some stuff cannot be fully documented at the moment, hopefully, and so they can be merely guessed. The .scm format abbreviation is one of countless proofs of such a downside which probably stands for '''Script Multifile''', while .scc might be in turn the short form of '''Compiled Script'''. No doubt comes with source files, whose .sc extension is the contraction of '''Mission Script'''. Although we have enough information to suppose the currently unknown mysteries of the used language, we still have no safe clue about what was its original denomination. Furthermore, it is a matter of fact that R* developers have been left intact the '''miss2''' executable filename of third generation compilers since the chapter 2. In this connection, we could imagine the newer language is a variant or an evolution of the '''GTA2script''' which label, initially referred to as '''GBHscript''', expressly popped up in the ancient documentation by [[Wikipedia:DMA Design|DMA Design Ltd.]] (at present [[Wikipedia:Rockstar North|Rockstar North]]). On those grounds, we are almost sure to say the name of the scripting language targeting each game with all peculiar but minimal enhancements or regressions is most likely '''GTA3script''' (as-is casing) for III, '''GTAVCscript''' for Vice City, '''GTASAscript''' for San Andreas, '''GTALCSscript''' for Liberty City Stories and lastly '''GTAVCSscript''' for Vice City Stories. However, it is definitely based on [[Wikipedia:BASIC|BASIC]].
  
 
<span style="font-size: 14pt">Preliminary remarks</span>
 
----
 
This article makes use of formatted codes to improve the reading comprehension. Note that:
 
 
* ''Square brackets'' mean everything inside may be omitted;
 
* ''Curly brackets'' denote the presence of useful codes but not necessarily needed;
 
* ''Vertical bars'' divide what can be chosen alternatively.<br/><br/>
 
 
=Fundamentals=
 
=Fundamentals=
  
 
==Comments==
 
==Comments==
 +
Codes are usually self-explanatory for the author but large sources can compromise everyone's management capability, that means some annotation can save much time on the long-term particularly when being stuck trying to understand old stuff which should never happen in the first place, not to mention team mates would certainly blame the original writer on each revision and slow down the completion of cooperative projects. Sometimes, it is also required to temporarily/permanently disable code lines for testing purposes. Fortunately, the language supports the following typologies of comments:
  
A ''comment'' is an additional text that may be helpful for the code writer or other users, in short for the reader. It is the only part of the source code which gets always ignored when compiling.
+
* ''Line'' comment, prefixed with // (two forward slashes), which extends till the end of the line. Everything is ignored inside: <code>// Some comment.</code>;
 
+
* ''Block'' comment, enclosed with a pair of /* (a slash plus an asterisk) and */ (the other way around), which embodies a circumscribed text area. Several blocks can be nested together: <code>/* Some /* comment */ . */</code>.
===Inline===
 
 
 
An ''inline comment'', denoted by '''//''' (two slashes), makes everything that follows some plain text:
 
 
 
[...] // Some inline comment
 
 
 
===Multiline===
 
 
 
A ''multiline comment'' embraces a particular area of the source code, starting by the opening tag '''/*''' (slash and asterisk) and ending with '''*/''' (asterisk and slash):
 
 
 
[...]
 
/*
 
  * Some multiline comment
 
  * ...
 
  */
 
[...]
 
Currently, more than one multiline comment is allowed per line:
 
 
 
[...] /* Some inline comment */ [...] /* Some inline comment */ [...]
 
 
 
==Highlighters==
 
 
 
''Highlighters'' behaviour sounds trivial, that's to say they simply highlight one or more [[#Arguments|arguments]] per [[#Commands|command]] within ''round brackets'', individually or together. In {{icon|3}}, they appear to be used only for '''SETUP_ZONE_PED_INFO''' (in a various order) and ''GXT keys'':
 
 
 
SETUP_ZONE_PED_INFO FISHFAC DAY (0) 0 0 0 (0 0 0 0) 0
 
PRINT_BIG (T4X4_1) 5000 2
 
 
 
;Limits
 
:Opening and closing round brakets are treated as blank spaces;
 
:An optional ''comma'' can be used aswell to distinguish each argument, processed as a space.
 
 
 
==Scopes==
 
 
 
''Scopes'' are delimited by ''curly brackets'' (or ''multiline brackets'') which act like a [[#Local|local]] [[#Variables|variable]] [[#Scope|scopes]]. Essentially, they enclose the code where local variables are used, including [[#Timers|timers]]. They can be opened and closed many times in a [[#Structure|script]]:
 
 
 
{
 
    [...]
 
}
 
 
 
;Limits
 
:Scopes cannot be nested;
 
:Opening and closing curly brakets are real commands.
 
 
 
==Labels==
 
 
 
A ''label'' is a ''sequence of characters'' which identifiy a location of the source code useful for ''jumps''. It can be accessed by any part of the source code. To define a label just append ''':''' (colon) to its name:
 
 
 
[...]
 
 
{lblname}:
 
[...]
 
 
 
At the compiling time, they are automatically converted into an [[#Offsets|offset]].
 
 
 
==Variables==
 
 
 
A ''variable'' is a ''storage location'' assigned to a ''symbolic name'' which contains a ''value'' of any ''type''.
 
 
 
===Value===
 
 
 
A ''value'' represents ''any data of any type'' it is.
 
 
 
===Scope===
 
----
 
The usage of a variable depends on the ''scope'', that is the context where a specific variable is declared. At this point, we can distinguish the ''global'' and ''local'' scope.
 
 
 
====Global====
 
 
 
The ''global scope'' grasps the ''whole source code''. Variables defined as ''globals'' are visible in ''any [[#Structure|script]]''. They are declared by appending the '''VAR''' prefix.
 
 
 
====Local====
 
----
 
The ''local scope'' wraps a ''localized part of the source code''. Variables defined as ''locals'' are visible only in the ''code enclosed by curly brackets''. You can put them everywhere and as many times as you want in the source code. They are declared by appending the '''LVAR''' prefix.
 
 
 
=====Timers=====
 
 
 
A ''timer'' is a ''special local variable'' whose value rises automatically. It starts incrementing since the beginning of the script where it has been placed and grows endlessly. There are ''2 usable timers'' which are already defined as '''TIMERA''' and '''TIMERB''', therefore they do not need to be declared.
 
 
 
===Data types===
 
----
 
Among the available data types, some are equivalent to those of the most known programming languages. Their length is up to 4, 8 and 16 bytes. Each type is appended as a suffix in the ''variable declaration''.
 
 
 
====LABEL====
 
 
 
The '''LABEL''' type handles ''variable-length strings''. It can refer to either a ''[[#Labels|label]] name'' or a ''file name''.
 
 
 
;Notes
 
:While inside a script file, R* compiler treats it unambiguously as a label;
 
:R* compiler allocates 32 bytes per label.
 
 
 
;Limit
 
:'''LABEL''' variables aren't available.
 
 
 
====INT====
 
 
 
The '''INT''' type handles ''32-bit signed integers''. It is also used to store [[#Value|values]] with less bytes, such as a [[Wikipedia:Primitive_data_type#Booleans|bool]], a [[Wikipedia:Character_(computing)#char|char]] and a [[Wikipedia:Integer_(computer_science)#Short_integer|short int]].
 
 
 
====FLOAT====
 
 
 
The '''FLOAT''' type handles ''32-bit floating-points''. As it normally does, decimal precision of a [[Wikipedia:Floating_point|float]] is usually stuck to 6-7 digits beyond which it may get lost.
 
 
 
====TEXT_LABEL====
 
 
 
The '''TEXT_LABEL''' type handles ''8-byte strings''. Generally, a [[Wikipedia:String_(computer_science)|string]] is an ''array of 1-byte characters''. It requires ''7 characters plus the [[Wikipedia:Null_character|null-terminator]]'' (a blank byte meaning the ''end of the string''). It is used to hold ''GXT keys'' (those of ''town zones'', ''interiors'', ''help textes'' or ''dialogue subtitles'') ''script names'' or any short string. Literal only '''TEXT_LABEL*''' strings are probably marked by ''single quotation marks'' to distinguish them from variable and constant identifiers:
 
 
 
PRINT_BIG 'GXT_KEY'
 
 
 
;Limit
 
:'''TEXT_LABEL''' variables are supported in {{icon|sa}} and {{icon|vcs}}.
 
 
 
====TEXT_LABEL16====
 
 
 
The '''TEXT_LABEL16''' type handles ''16-byte strings''. Like the previous, this type holds ''15 characters plus the null-terminator''. It is used to store ''model and texture names of player clothes'', ''animation names'' or any long string.
 
 
 
;Limit
 
:'''TEXT_LABEL16''' variables and values are supported only in {{icon|sa}}.
 
 
 
====TEXT_BUFFER====
 
 
 
The '''TEXT_BUFFER''' type handles ''32-byte strings'' or larger, depending on how many continuous parameters of the same type there are, each of which occupies 32 bytes. It can hold up to ''127 characters plus the null-terminator'', after which another '''TEXT_BUFFER''' argument may begin. Strings of such type must be put within ''double quotation marks'':
 
 
 
SAVE_STRING_TO_DEBUG_FILE "32B-128B TEXT"
 
 
 
;Limits
 
:'''TEXT_BUFFER''' values are supported since {{icon|vc}};
 
:'''TEXT_BUFFER''' variables aren't available.
 
 
 
====TEXT_VARLEN====
 
 
 
The '''TEXT_VARLEN''' type handles ''N-byte strings''. It holds ''N characters plus the null-terminator''. Strings of this type mustn't exceed 255 characters (including the null-byte).
 
 
 
;Limits
 
:'''TEXT_VARLEN''' values are supported since {{icon|sa}};
 
:'''TEXT_VARLEN''' variables aren't available.
 
 
 
====T (pseudo)====
 
 
 
The '''T''' type handles a group of few datatypes acceptable per argument. It is used only for commands featuring optional arguments, those whose type is unpredictable before the compilation. It can be a pseudo type of '''INT''', '''FLOAT''' and '''TEXT_LABEL'''.
 
 
 
;Notes
 
:'''INT''' and '''FLOAT''' can be used interchangeably in {{icon|3}}, {{icon|vc}}, {{icon|sa}}, {{icon|lcs}} and {{icon|vcs}};
 
:{{icon|vcs}} also admits '''TEXT_LABEL''' arguments.
 
 
 
====CONST (pseudo)====
 
 
 
The '''CONST''' type handles ''32-bit signed integers''. It is used only to assign and compare [[#Constants|constants]] to '''INT''' variables regarding ''model [[#Identifiers|identifiers]]'', ''task statuses'', ''ped or audio events'' and such. It is a pseudo type of '''INT'''.
 
 
 
;Limit
 
:The [[#Arithmetic|assignment]] and [[#Comparison|comparison]] of '''CONST''' values are supported since {{icon|vc}}.
 
 
 
===Declaration===
 
----
 
''Defining a variable'' means ''assigning a token string to a memory cell'' at the compiling time. Variables must be declared in the following manner:
 
 
 
VAR_* {varname0}[,] [... {varnameN}]
 
LVAR_* {varname0}[,] [... {varnameN}]
 
 
 
As mentioned in the sections above, local variables have to be put within curly brackets:
 
 
 
{
 
    VAR_* {varname0}[,] [... {varnameN}]
 
    LVAR_* {varname0}[,] [... {varnameN}]
 
 
    [...]
 
}
 
 
 
''Inline variable declaration'' is allowed, you just have to separate them by ''spaces'' or ''tabulations''. Adding a preceding ''comma'' before these characters is optional.
 
 
 
;Limits
 
:Whereas the ''variable buffer'' is limited, you can declare a certain amount of globals and locals. [[#INT|INT]] and [[#FLOAT|FLOAT]] types take 1 variable, while [[#TEXT_LABEL|TEXT_LABEL]] and [[#TEXT_LABEL16|TEXT_LABEL16]] types occupy respectively 2 and 4 variables to store their data (have a look [[#Variables_2|here]] for further details);
 
:Global and local variable names must not collide;
 
:{{icon|vcs}} isn't affected by what said above.
 
 
 
====Arrays====
 
  
A ''array'' is a ''collection of variables'' having the same type which can be accessed by an ''index'', a 1-based integer lesser than or equal to the size specified, enclosed by ''square brackets'':
+
==Delimiters==
 +
Conventionally, lines can be splitted into various regions in order to enhance the code legibility through bracket-delimited and/or comma-separated elements. As being pure whitespaces, the opening parenthesis delimiter doesn't necessarily need to match the closing counterpart and viceversa. The only tangible use of separators carried out in public sources is related to inline declaration of multiple variables, text keys of print-commands and <code>SETUP_ZONE_PED_INFO</code> but codes can be organized to one's liking. Here are some demonstrations:
  
  {
+
  VAR_INT joeys_buggy, swank_taxi
    VAR_* {varname0}{[arrsize0]}[,] [... {varnameN}{[arrsizeN]}]
+
  PRINT_NOW (ASUKA) 2000 1
    LVAR_* {varname0}{[arrsize0]}[,] [... {varnameN}{[arrsizeN]}]
+
  SETUP_ZONE_PED_INFO CHINA DAY (30) 350 600 0 (0 0 0 0) 0
   
 
    [...]
 
  }
 
  
;Limits
+
==Integers and Floating-points==
:The usage of arrays is allowed since {{icon|vc}};
+
Numeric values are used extensively throughout the whole script following no particular notation besides the decimal one. The specializing number representation tells whether a literal is an integer or a floating-point value: an appending <code>f</code> or <code>F</code> floatifies a number, whose suffix becomes superfluous if a radix point, discerning decimals from integral digits, is supplied. Float parts are alternatively omissible hence a 0 digit is implied if one and only one of them is missing. Literal parsing starts from the minus sign, radix point or number digit and stops at the first non number character after a series of digits, leading and/or trailing an eventual radix point, or float suffix. To sum things up, these values are valid numbers: <code>1</code>, <code>-0</code>, <code>1f</code>, <code>-0f</code>, <code>1.0</code>, <code>1.0f</code>, <code>1.</code>, <code>1.f</code>, <code>.0</code>, <code>.0f</code> and also <code>1-2</code> (ill-formed on basic or compound assignments), <code>1..2</code>, <code>1f2</code>, producing <code>1</code> (<code>1f-2</code> is ill-formed a priori). In the first Trilogy chapter, the fixed-point format was chosen meaning precision was guaranteed to not get lost if the decimal part wasn't lesser than just one-tenth.
:Variable indices are quite buggy in {{icon|vc}} and therefore unrecommended, but they are fully supported since {{icon|sa}};
 
:Multidimensional arrays are not supported.
 
  
====Handles====
+
==Labels, Text labels and Strings==
 +
Thanks to the beneficial code fragmentation, the source is subject to script file inclusions, favouring modularity, and sparse goto branches, involving embedded code blocks diversification. Both kinds of partitioning are accomplished respectively through the specification of:
  
A ''handle'' is an univocal identifier assigned to a game entity. It is given by the following statement:
+
* ''Filenames'', that is special labels which somehow resemble legit pathnames, starting with any valid pathname character but not containing whitespaces. They are relative to the root path deriving from the .sc extension removal of the main script full path where files are searched in by default: <code>X:\folder\main</code>. Subfolders are scanned as well:
 +
** Till the first tree level if inside one of the subdirectories: <code>X:\parent\main\child</code>;
 +
** Till the second tree level if inside one of the parent directories: <code>X:\parent</code> or <code>X:\parent\main</code>;
 +
** Indefinitely (unlimited recursion till the maximum path length allowed).
 +
:The .sc extension at the end of filenames is mandatory else an argument mismatch is warned, by contrast the main script can have any extension to which ''m'' (multifile) or ''c'' (compiled) is appended in the target pathname. Due to a [[Cd image]] system limitation, all sorts of filename must be shorter than 20 characters and conventionally they must be free of extra dots for streamed scripts;
 +
* ''Labels'', that is unique identifiers suffixed by a colon which identify a precise location of the source code representing the target position of goto-like, script starter, subroutine or function caller commands: <code>my_label:</code> (on a new line). Weirdly enough, they may begin with any character alike filenames or be empty despite being susceptible to the same restrictions of string identifiers whenever passed as arguments but, regardless, must not exceed 39 characters (colon included, yet blanked out) and whereas these are not commands, anything else can follow next to and be inlined so long as a splitting character is inserted.
 +
:Labels store a reference depicting either an absolute address falling within the main script space (including main extensions and generic subscripts) or a relative and negative address pointing to a place of the mission script space or that of a particular streamed script. Albeit addresses are zero-based anyway, it is discouraged to use a <code>WHILE</code> construct at or branch by hand to the almost very top of a mission/streamed script file or even communicate between different script spaces with gotos.
  
<source lang=cpp>short nHandle = (iEntityIndexInPool << 8) | ucEntityFlag;</source>
+
That said, labels are basically user-supplied identifiers whose existence is verified. The text label or text [[Wikipedia:String (computer science)|string]] counterpart is not fully compliant to this standard (script names are exempt, for instance) since string identifiers are massively employed as main/mission text keys or whatever referring to an internal resource, which the game handles according to a well-defined associative scheme. As a general rule, these are primarily supposed to be at most 7 characters long and must begin with a letter and never end with a colon or either begin with an underscore or an alphanumeric character in the last Trilogy and Stories chapter where text label variables are supported, provided that here their literals are not valid integer or floating-point numbers taking the precedence over string identifiers on parsing:
  
;Note
+
LOAD_SPECIAL_CHARACTER 1 eight
:R* compiler won't let you assign different entity types to the same variable or using a variable which hasn't been assigned to any '''CREATE_*''' or '''ADD_*''' entity [[#Commands|commands]].
+
CUSTOM_PLATE_FOR_NEXT_CAR CAR_TAMPA _FELTCH_
 +
SCRIPT_NAME 99red
  
==Operators==
+
In the last Trilogy chapter and nowhere else, longer text labels were introduced, some sort of [[Wikipedia:String (computer_science)#Length-prefixed|Pascal strings]] having a variable length of maximum 40 characters for literals or a fixed length of 16 bytes for variables, twice as big as the shorter text label ones. Speaking of which, it is prohibited to get or handle a longer text label using a variable of shorter length but this one is rather passable to those text label parameters also permitting long-lengthed literals. Notoriously, identifiers length is anything but expensive for readability reasons, in addition they do not even offer the ability to insert whitespaces or other inadmissible characters owing to the by-design absence of delimiting tokens. At this matter, debug texts are sent as 127-character string literals enclosed by double quotes:
  
In general, an ''operator'' is a token string that represents a math calculation or an operation of any other kind, in order to make the code understanding clearer at a glance.
+
SAVE_STRING_TO_DEBUG_FILE "current_wanted_list = "
  
===Arithmetic===
+
These quoted strings are, in essence, made up of four text labels aligned to 32 bytes (at the highest power of two possible per parameter) individually accessible as a result of a compiler bug, cause the first character of each literal-only argument is trimmed out as a quotemark &ndash; during the line reconstruction phase, the opening and closing quotemarks along with <code>&nbsp;</code> <code>/</code> <code>,</code> <code>(</code> <code>)</code ><code>\t</code> are swapped to <code>A</code> <code>\0</code> <code>\xD1</code>-<code>\xD6</code> and back again on code generation (the <code>NUL</code>-terminator at the end of string literals makes them rightmost arguments, ignoring the rest).<br/>
 +
Unlike string literals, empty text labels are impracticable though <code>$</code> alone compiles a <code>NUL</code>-string identifier in the last Stories chapter<sup>[no source]</sup> &ndash; as reported by some indiscreet speculations, the rearrangement of crucial commands signals a syntax enhancement the language has undergone which sees delimited strings superseding text labels, lowly probable because string constants are still disallowed for multi-type parameters. In San Andreas, text labels are implicitly comparable against <code>NUL</code>-string identifiers but no syntactical facility accommodates an explicit use.<br/>
 +
It's worth noting text labels and string literals are not interchangeable because of their syntactic differences even if they present semantic similarities, moreover text labels do not ever interfere with command names and string constants. A final quirk to note concerning labels as a whole is they are automatically converted to upper case: this obvious evidence proves identifiers and whatnot are all case insensitive with the exemption that string literals are left as-is for remastered game builds.
  
''Arithmetic operators'' compute some of the most common algebric calculations between either a [[#Variables|variable]] and a [[#Value|value]] or two variables. As well as in some programming language happens, [[#CONST (pseudo)|CONST]], [[#TEXT_LABEL|TEXT_LABEL]] and [[#TEXT_LABEL16|TEXT_LABEL16]] types are free from these operators, except for the ''basic assignment''  (see also [[#Operators composition|Operators composition]]):
+
==Data types==
 +
Forasmuch as the language obeys the [[Wikipedia:Strong and weak typing|strong typing]] paradigm, the syntactic elements that denote a value during execution do have fixed data types, most of which are appended as a suffix at variable declaration. Their conspicuous assortment is listed below:
  
{|class=wikitable
+
{|class=wikitable style="text-align: center"
!width=70px|Operator
 
!width=200px colspan=2|Name
 
!width=200px|Syntax
 
!width=500px|Description
 
 
|-
 
|-
!=
+
!style="text-align: left"|Name
|align=center colspan=2|Assignment
+
!Format
|align=center|<code>expr0 '''=''' expr1</code>
+
!Size
|Store ''expr1'' to ''expr0''
+
!Range
 +
!width=36px|Is<br/>main
 +
!width=36px|Is<br/>basic
 +
!Derivative data types
 +
!width=70px|Immediate<br/>support
 +
!width=70px|Variable<br/>support
 
|-
 
|-
!+
+
|colspan=9|'''NONE'''
|align=center colspan=2|Addition
 
|align=center|<code>expr0 '''+''' expr1</code>
 
|Add ''expr1'' to ''expr0''
 
 
|-
 
|-
!-
+
|rowspan=2 align=left|'''LABEL'''||String identifier<br/><span style="font-size: 0.75em">(translated to address)</span>||rowspan=3|1, 2 or 4||1 to 38||rowspan=2|
|align=center colspan=2|Subtraction
+
|rowspan=2|
|align=center|<code>expr0 '''-''' expr1</code>
+
|rowspan=2|
|Subtract ''expr1'' from ''expr0''
+
|rowspan=2|Since {{icon|3}}||rowspan=2|
 
|-
 
|-
!*
+
|Filename<br/><span style="font-size: 0.75em">(translated to address or index)</span>||1 to 19
|align=center colspan=2|Multiplication
 
|align=center|<code>expr0 '''*''' expr1</code>
 
|Multiply ''expr0'' by ''expr1''
 
 
|-
 
|-
!/
+
|align=left|'''INT'''||Signed integer||{{hint|-2<sup>n-1</sup> to 2<sup>n-1</sup>-1|-128 to 127&#10;-32,768 to 32,767&#10;-2,147,483,648 to 2,147,483,647}}<br/><span style="font-size: 0.75em">(where n is 8, 16 or 32)</span>||&#x2713;||&#x2713;||'''VAR_INT''', '''VAR_INT_OPT''',<br/>'''LVAR_INT''', '''LVAR_INT_OPT''',<br/><span style="font-size: 0.75em">(Vice City Stories apart)</span><br/>'''INPUT_INT''', '''OUTPUT_INT'''||rowspan=3 colspan=2|Since {{icon|3}}
|align=center colspan=2|Division
 
|align=center|<code>expr0 '''/''' expr1</code>
 
|Divide ''expr0'' by ''expr1''
 
 
|-
 
|-
!+@
+
|rowspan=2 align=left|'''FLOAT'''||[[Wikipedia:Q (number format)|Q11.4 fixed-point]]<br/><span style="font-size: 0.75em">(III only)</span>||2||{{hint|-2<sup>11</sup> to 2<sup>11</sup>-2<sup>-4</sup>|-2,048 to 2,047.9375}}||rowspan=2|&#x2713;||rowspan=2|&#x2713;||rowspan=2|'''VAR_FLOAT''', '''VAR_FLOAT_OPT''',<br/>'''LVAR_FLOAT''', '''LVAR_FLOAT_OPT''',<br/><span style="font-size: 0.75em">(Vice City Stories apart)</span><br/>'''INPUT_FLOAT''', '''OUTPUT_FLOAT'''
|align=center colspan=2|Timed addition
 
|align=center|<code>expr0 '''+@''' expr1</code>
 
|Multiply ''expr2'' by delta time and add the result to ''expr1''
 
 
|-
 
|-
!-@
+
|[[Wikipedia:Floating point|IEEE-754 floating-point]]<br/><span style="font-size: 0.75em">(packed in Stories)</span>||1-4||{{hint|&plusmn;2<sup>-126</sup> to &plusmn;2<sup>127</sup>(2-2<sup>-23</sup>)|&plusmn;1.1754942e-38 to &plusmn;3.4028235e+38}}
|align=center colspan=2|Timed subtraction
 
|align=center|<code>expr0 '''-@''' expr1</code>
 
|Multiply ''expr2'' by delta time and subtract the result from ''expr1''
 
 
|-
 
|-
!rowspan=2|++
+
|align=left|'''TEXT_LABEL'''||String identifier<br/><span style="font-size: 0.75em">(NUL-terminated)</span>||8||1 to 7||
|align=center rowspan=2|Increment
+
|&#x2713;||'''VAR_TEXT_LABEL''', '''VAR_TEXT_LABEL_OPT''',<br/>'''LVAR_TEXT_LABEL''', '''LVAR_TEXT_LABEL_OPT''',<br/><span style="font-size: 0.75em">(Vice City Stories apart)</span><br/>'''INPUT_TEXT_LABEL''', '''OUTPUT_TEXT_LABEL'''<br/><span style="font-size: 0.75em">(Vice City Stories only)</span>||Since {{icon|3}}||{{icon|sa}} and {{icon|vcs}}
|align=center|Pre{{ref|preinc|[*]}}
 
|align=center|<code>'''++''' expr0</code>
 
|rowspan=2|Increment ''expr0'' by 1 and store the result to ''expr0''
 
 
|-
 
|-
|align=center|Post
+
|rowspan=2 align=left|'''TEXT_LABEL16'''||rowspan=2|String identifier<br/><span style="font-size: 0.75em">(if non variable-only, accepts<br/>'''TEXT_LABEL''' variables)</span>||9-41<br/><span style="font-size: 0.75em">(Pascal string)</span>||8 to n<br/><span style="font-size: 0.75em">(where n is <= 40)</span>||rowspan=2|
|align=center|<code>expr0 '''++'''</code>
+
|rowspan=2|&#x2713;||rowspan=2|'''VAR_TEXT_LABEL16''', '''VAR_TEXT_LABEL16_OPT''',<br/>'''LVAR_TEXT_LABEL16''', '''LVAR_TEXT_LABEL16_OPT'''||rowspan=2 colspan=2|{{icon|sa}} only
 
|-
 
|-
!rowspan=2|--
+
|16||1 to 15
|align=center rowspan=2|Decrement
 
|align=center|Pre{{ref|preinc|[*]}}
 
|align=center|<code>'''--''' expr0</code>
 
|rowspan=2|Decrement ''expr0'' by 1 and store the result to ''expr0''
 
 
|-
 
|-
|align=center|Post
+
|rowspan=2|'''TEXT_LABEL32'''<span style="font-size: 0.75em">||String identifier<br/><span style="font-size: 0.75em">(NUL-terminated)</span>||32||1 to 39<br/><span style="font-size: 0.75em">(bugged)</span>||rowspan=2|
|align=center|<code>expr0 '''--'''</code>
+
|rowspan=2|
|}
+
|rowspan=2|
 
+
|rowspan=2|{{icon|sa}} only||rowspan=2|
;Note
 
:{{note|preinc}} Pre and post increments have no difference unlike what you would expect.
 
 
 
Yet, you can put the ''assignment'' and ''algebric'' operators together inline as follows:
 
 
 
{|class=wikitable
 
!width=70px|Operators
 
!width=200px|Name
 
!width=200px|Syntax
 
!width=500px|Description
 
 
|-
 
|-
!= +
+
|String literal<br/><span style="font-size: 0.75em">(NUL-terminated)</span>||32&times;4||1 to 127
|align=center|Addition and assignment
 
|align=center|<code>expr0 '''=''' expr1{{ref|expr01|[*]}} '''+''' expr2</code>
 
|Add ''expr2'' to ''expr1'' and store the result to ''expr0''
 
 
|-
 
|-
!= -
+
|rowspan=2 align=left|'''INPUT'''<br/><span style="font-size: 0.75em">(optional)</span>||colspan=3|Includes '''INT''' and '''FLOAT'''||rowspan=2|
|align=center|Subtraction and assignment
+
|rowspan=2|
|align=center|<code>expr0 '''=''' expr1{{ref|expr01|[*]}} '''-''' expr2</code>
+
|rowspan=2|
|Subtract ''expr2'' from ''expr1'' and store the result to ''expr0''
+
|rowspan=2 colspan=2|
 
|-
 
|-
!= *
+
|colspan=3|Includes '''TEXT_LABEL'''<br/><span style="font-size: 0.75em">(Vice City Stories only)</span>
|align=center|Multiplication and assignment
 
|align=center|<code>expr0 '''=''' expr1{{ref|expr01|[*]}} '''*''' expr2</code>
 
|Multiply ''expr1'' by ''expr2'' and store the result to ''expr0''
 
 
|-
 
|-
!= /
+
|align=left|'''STRING'''<br/><span style="font-size: 0.75em">(internal only)</span>||Label,<br/>Variable name,<br/>String constant{{ref|strconst|[*]}},<br/>Text labels,<br/>Quoted string||
|align=center|Division and assignment
+
|
|align=center|<code>expr0 '''=''' expr1{{ref|expr01|[*]}} '''/''' expr2</code>
+
|&#x2713;||
|Divide ''expr1'' by ''expr2'' and store the result to ''expr0''
+
|
|-
+
|colspan=2|
!= +@
 
|align=center|Timed addition and assignment
 
|align=center|<code>expr0 '''=''' expr1{{ref|expr01|[*]}} '''+@''' expr2</code>
 
|Multiply ''expr2'' by delta time, add the result to ''expr1'' and store everything to ''expr0''
 
|-
 
!= -@
 
|align=center|Timed subtraction and assignment
 
|align=center|<code>expr0 '''=''' expr1{{ref|expr01|[*]}} '''-@''' expr2</code>
 
|Multiply ''expr2'' by delta time, subtract the result from ''expr1'' and store everything to ''expr0''
 
|}
 
 
 
;Note
 
:{{note|expr01}} ''expr1'' can represent ''expr0'' too.
 
 
 
;Limit
 
:Multiple algebric operators per line are not allowed.
 
 
 
===Compound assignment===
 
 
 
''Compound assignment operators'' store [[#Value|values]] or [[#Variables|variable]] content to other variables having a particular type afterwards the computation of an arithmetic operation, to squeeze the code and clear it up from granted repetitions:
 
 
 
{|class=wikitable
 
!width=70px|Operator
 
!width=200px|Name
 
!width=200px|Syntax
 
!width=500px|Description
 
|-
 
!+=
 
|align=center|Addition assignment
 
|align=center|<code>expr0 '''+=''' expr1</code>
 
|Add ''expr1'' to ''expr0'' and store the result to ''expr0''
 
|-
 
!-=
 
|align=center|Subtraction assignment
 
|align=center|<code>expr0 '''-=''' expr1</code>
 
|Subtract ''expr1'' from ''expr0'' and store the result to ''expr0''
 
|-
 
!*=
 
|align=center|Multiplication assignment
 
|align=center|<code>expr0 '''*=''' expr1</code>
 
|Multiply ''expr0'' by ''expr1'' and store the result to ''expr0''
 
|-
 
!/=
 
|align=center|Division assignment
 
|align=center|<code>expr0 '''/=''' expr1</code>
 
|Divide ''expr0'' by ''expr1'' and store the result to ''expr0''
 
|-
 
!+=@
 
|align=center|Timed addition assignment
 
|align=center|<code>expr0 '''+=@''' expr1</code>
 
|Multiply ''expr1'' by delta time, add the result to ''expr0'' and store everything to ''expr0''
 
 
|-
 
|-
!-=@
+
|colspan=9|'''UNKNOWN'''
|align=center|Timed subtraction assignment
 
|align=center|<code>expr0 '''-=@''' expr1</code>
 
|Multiply ''expr1'' by delta time, subtract the result from ''expr0'' and store everything to ''expr0''
 
 
|}
 
|}
  
===Uncompounded assignment===
+
{{note|strconst}} String constants are only compatible with '''INPUT_INT''' data type but default constants favour '''INT''' regardless.
 
 
''Uncompounded assignment operators'' are those on their own, or rather they are neither derivable nor decomposable similarly as those [[#Compound assignment|compounds]]:
 
  
{|class=wikitable
+
==Immediates and Variables==
!width=70px|Operator
+
Data can take the appearance of a few expressions varying from numeric, text label and string literals each of which occupies a certain area of storage with unfixed size. Immediates can also be preserved for later use and therefore reserve space over the private script memory corresponding to a variable. The strongly-typed language property imposes to explicitly declare variables anywhere in the current scope, namely the context inside which they are visible for usage. Sensibly, declarations should figure beforehand but likewise it is allowed for accessing backward declarations. Variables accessible from any location are marked as globals (starting from offset 8 or more, occupying lots of space in the script multifile, up to 64 kibibytes) and their declaration is achieved by prepending the <code>VAR</code> wording followed by one of the basic data types (multiple declarations of the same type can be inlined), both separated by an in-between underscore:
!width=200px|Name
 
!width=200px|Syntax
 
!width=500px|Description
 
|-
 
!=#
 
|align=center|Cast assignment
 
|align=center|<code>expr0 '''=#''' expr1</code>
 
|Cast ''expr1'' to any other type and store the result to ''expr0''
 
|}
 
  
;Limit
+
VAR_INT player scplayer
:Supported conversions are [[#FLOAT|FLOAT]] to [[#INT|INT]] and '''INT''' to '''FLOAT'''.
+
VAR_FLOAT x_float, y_float, z_float
 +
VAR_TEXT_LABEL interior_name
 +
VAR_TEXT_LABEL16 shop_item
  
===Logical===
+
Globals are capable of being selectively marked as saveable using the <code>SAVE_VAR</code> prefix, in order to restore their value on savegame loading and free generic variables. In Trilogy chapters, if enabled properly in a hacky manner, these are solely common variable declarations with no additional purpose, a plan not gone through. On the other hand, globals declared within the mission context are not visible outside in Stories chapters since they overlap the same space, making a discernment among true and al-most globals. However, there's no exact rule for variable naming apart they must begin with a specific character and never end with a colon just like string identifiers, expanding till a maximum of 39 characters. It's preferable definitions shall not contain operator tokens to prevent any parsing ambiguity plus, most importantly, they must not conflict with string constants and local timers. Nevertheless, text labels and variable names semantics may collide: in this case, the formers have priority over the latters unless a preceding dollar sign is added:
  
''Logical operators'' influence the way conditions are evalueted and enable to test more of them at a time. More than anything, they are built-in statements:
+
PRINT_BIG TEXTKEY 5000 2  // Compiles a text label literal.
 +
PRINT_BIG $textkey 5000 2 // Compiles a text label variable.
  
{|class=wikitable
+
Despite variables are freed and zero-initialized at runtime on new/load game or script allocation in broad terms, statistical information are still gathered whenever they are read before being written, besides if they are never read or never written (passing a variable as reference has no effect onto the content). Furthermore, if a variable is set to hold an entity handle (alias unique index) returned by a specific create-command it cannot be assigned to any other entity-command of different kind or none, including the forseeable assignment operations. This restriction propagates on script and function callings as well: starting/streaming the same script or calling the same function multiple times with variables of dissimilar entity types is forbidden if triggers are encountered prior the script or function lexical scope is fetched, in which case entities are explicitly initialized in the form of unreachable code:
!width=70px|Operator
 
!width=200px|Name
 
!width=200px|Syntax
 
!width=500px|Description
 
|-
 
!NOT
 
|align=center|Logical negation
 
|align=center|<code>IF '''NOT''' condition0</code>
 
|Test if ''condition0'' is false
 
|-
 
!AND
 
|align=center|Logical conjunction
 
|align=center|<code>IF condition0<br/>'''AND''' condition8</code>
 
|Test if both ''condition0'' and ''conditionN'' are true
 
|-
 
!OR
 
|align=center|Logical disjunction
 
|align=center|<code>IF condition0<br/>'''OR''' condition8</code>
 
|Test if either ''condition0'' or ''conditionN'' is true
 
|}
 
  
===Comparison===
 
 
''Comparison operators'' test the truth or falsity of the relation between either a [[#Variables|variable]] and a [[#Value|value]], a value and a variable or two variables:
 
 
{|class=wikitable
 
!width=70px|Operator
 
!width=200px|Name
 
!width=200px|Syntax
 
!width=500px|Description
 
|-
 
!=
 
|align=center|Equal to
 
|align=center|<code>IF expr0 '''=''' expr1</code>
 
|Test if ''expr0'' and ''expr1'' are equal
 
|-
 
!>
 
|align=center|Greater than
 
|align=center|<code>IF expr0 '''>''' expr1</code>
 
|Test if ''expr0'' is greater than ''expr1''
 
|-
 
!<
 
|align=center|Lesser than
 
|align=center|<code>IF expr0 '''<''' expr1</code>
 
|Test if ''expr0'' is lesser than ''expr1''
 
|-
 
!>=
 
|align=center|Greater than or equal to
 
|align=center|<code>IF expr0 '''>=''' expr1</code>
 
|Test if ''expr0'' is greater than or equal to ''expr1''
 
|-
 
!<=
 
|align=center|Lesser than or equal to
 
|align=center|<code>IF expr0 '''<=''' expr1</code>
 
|Test if ''expr0'' is lesser than or equal to ''expr1''
 
|}
 
 
==Commands==
 
 
A ''command'' is a ''symbolic name'' associated to an [[#Opcodes|opcode]] which executes a ''portion of code'' that specifies the operation to be performed by passing ''zero or more [[#Arguments|arguments]]''. It does not return [[#Value|values]] that can be assigned to a [[#Variables|variable]], even though the boolean flag is kept whenever it is used as a ''condition''. It follows the common programming syntax adopted for ''procedure or function calls'':
 
 
{commandname} [{anyvalue0|varname0} ... {anyvalueN|varnameN}]
 
 
===Alternatives===
 
 
''Alternative commands'' are those which are basically ''overloaded'' on the bases of different [[#Arguments|argument]] types:
 
 
* {{icon|3}} {{icon|vc}} {{icon|sa}} {{icon|lcs}} {{icon|vcs}}:
 
** '''SET (=)'''
 
** '''CSET (=#)'''
 
** '''ADD_THING_TO_THING (+=)'''
 
** '''SUB_THING_FROM_THING (-=)'''
 
** '''MULT_THING_BY_THING (*=)'''
 
** '''DIV_THING_BY_THING (/=)'''
 
** '''IS_THING_EQUAL_TO_THING (=)'''
 
** '''IS_THING_NOT_EQUAL_TO_THING (NOT =)'''
 
** '''IS_THING_GREATER_THAN_THING (>)'''
 
** '''IS_THING_GREATER_OR_EQUAL_TO_THING (>=)'''
 
** '''ADD_THING_TO_THING_TIMED (+=@)'''
 
** '''SUB_THING_FROM_THING_TIMED (-=@)'''
 
** '''ABS'''
 
* {{icon|sa}}:
 
** '''IS_EMPTY'''
 
** '''IS_BIT_SET'''
 
** '''SET_BIT'''
 
** '''CLEAR_BIT'''
 
** '''STRING_CAT'''
 
 
{{incomplete}}
 
 
===Internals===
 
 
''Internal commands'' are those which have special characteristics and are handled internally:
 
 
* {{icon|3}} {{icon|vc}} {{icon|sa}} {{icon|lcs}} {{icon|vcs}}:
 
** '''GOTO'''
 
** '''GOTO_IF_FALSE'''
 
** '''MISSION_END'''
 
** '''START_NEW_SCRIPT'''
 
** '''VAR_INT'''
 
** '''VAR_FLOAT'''
 
** '''LVAR_INT'''
 
** '''LVAR_FLOAT'''
 
** '''{'''
 
** '''}'''
 
** '''REPEAT'''
 
** '''ENDREPEAT'''
 
** '''IF'''
 
** '''IFNOT'''
 
** '''ELSE'''
 
** '''ENDIF'''
 
** '''WHILE'''
 
** '''WHILENOT'''
 
** '''ENDWHILE'''
 
** '''ANDOR'''
 
** '''LAUNCH_MISSION'''
 
** '''PLAYER_MADE_PROGRESS'''
 
** '''SET_PROGRESS_TOTAL'''{{ref|thgtot|[*]}}
 
** '''REGISTER_MISSION_GIVEN'''
 
** '''REGISTER_MISSION_PASSED'''
 
** '''SCRIPT_NAME'''
 
** '''LOAD_AND_LAUNCH_MISSION'''
 
** '''LOAD_AND_LAUNCH_MISSION_INTERNAL'''
 
** '''SET_TOTAL_NUMBER_OF_MISSIONS'''{{ref|thgtot|[*]}}
 
** '''VAR_TEXT_LABEL'''
 
** '''LVAR_TEXT_LABEL'''
 
* {{icon|vc}} {{icon|sa}} {{icon|lcs}} {{icon|vcs}}:
 
** '''REGISTER_ODDJOB_MISSION_PASSED'''
 
* {{icon|3}} {{icon|lcs}} {{icon|vcs}}:
 
** '''GOTO_IF_TRUE'''
 
** '''GOSUB_FILE'''
 
* {{icon|3}} {{icon|vc}}:
 
** '''CREATE_COLLECTABLE1'''
 
** '''SET_COLLECTABLE1_TOTAL'''{{ref|thgtot|[*]}}
 
* {{icon|vc}} {{icon|sa}}:
 
** '''LOAD_AND_LAUNCH_MISSION_EXCLUSIVE'''
 
* {{icon|lcs}} {{icon|vcs}}:
 
** '''CALL'''
 
** '''CALLNOT'''
 
* {{icon|sa}}:
 
** '''VAR_TEXT_LABEL16'''
 
** '''LVAR_TEXT_LABEL16'''
 
** '''SWITCH'''
 
** '''ENDSWITCH'''
 
** '''CASE'''
 
** '''DEFAULT'''
 
** '''BREAK'''
 
** '''SWITCH_START'''
 
** '''SWITCH_CONTINUED'''
 
* {{icon|vcs}}:
 
** '''SET_COLLECTABLE2_TOTAL'''
 
 
;Notes
 
:{{note|thgtot}} The [[#Arguments|argument]] of these commands must be set respectively according to:
 
:* The sum of '''PLAYER_MADE_PROGRESS''' values;
 
:* The amount of '''REGISTER_MISSION_PASSED''' (those that don't have an immediate value are excluded) and '''REGISTER_ODDJOB_MISSION_PASSED''';
 
:* The amount of '''CREATE_COLLECTABLE1'''.
 
:If the argument of the listed commands differs from what expected, a 0-value must be passed.
 
 
{{incomplete}}
 
 
===WAIT===
 
 
'''WAIT''' stops the execution of a [[#Structure|script]] according to some milliseconds after which it will resume again. Indeed, it is absolutely necessary into ''infinite loops'' or those that should break after more than one frame, such as the [[#WHILE|WHILE]] statement. In this case, a [[#INT|INT]] equal to 0 is passed.
 
 
===GOTO===
 
 
'''GOTO''' jumps to the [[#Labels|label]] of any location of the source code. It is also used internally to build other [[#Statements|statements]] or singularly but then it mustn't point off the current context:
 
 
// File: any.sc
 
 
jump0:
 
GOTO jumpN
 
 
// File: any.sc
 
 
jumpN:
 
GOTO jump0
 
 
===ANDOR===
 
 
'''ANDOR''' sets out the way the comparison among more conditions have to occur (see also [[#Compare flag|Compare flag]]).
 
 
===GOTO_IF_TRUE===
 
 
'''GOTO_IF_TRUE''' operates in conjunction with [[#ANDOR|ANDOR]] and jumps to a [[#Labels|label]] if the returned boolean flag is true.
 
 
===GOTO_IF_FALSE===
 
 
Unlike [[#GOTO_IF_TRUE|GOTO_IF_TRUE]], '''GOTO_IF_FALSE''' jumps to the desired [[#Labels|label]] only if the comparison returns false.
 
 
===SCRIPT_NAME===
 
 
'''SCRIPT_NAME''' simply associates an unique name to the current working [[#Structure|script]].
 
 
;Note
 
:R* compiler doesn't enable you to associate a name previously used for another script.
 
 
===SAVE_STRING_TO_DEBUG_FILE===
 
 
'''SAVE_STRING_TO_DEBUG_FILE''' accepts an [[#Arguments|argument]] which can admit up to ''127 characters plus the null-terminator''. In the compiling process, the argument is skipped but its string is copied to a predefined ''128-bytes buffer'', compiled afterwards. Since {{icon|vc}}, these are the seemingly predetermined bytes of a random empty string block which are actually the result of uninitialized data:
 
 
00 00 41 00 09 2E 00 00 00 00 00 00 '''00''' 00 00 00
 
09 2E 00 00 00 00 00 00 1C FB 12 00 D8 A8 41 00
 
00 00 41 00 09 2E 00 00 00 00 00 00 '''01''' 00 00 00
 
09 2E 00 00 00 00 00 00 1C FB 12 00 D8 A8 41 00
 
00 00 41 00 09 2E 00 00 00 00 00 00 '''02''' 00 00 00
 
09 2E 00 00 00 00 00 00 1C FB 12 00 D8 A8 41 00
 
00 00 41 00 09 2E 00 00 00 00 00 00 '''03''' 00 00 00
 
09 2E 00 00 00 00 00 00 1C FB 12 00 D8 A8 41 00
 
 
The split of such bytes into 4 blocks of 32-bytes each is quite noticeable.
 
 
==Constants==
 
 
A ''constant'' is a ''symbolic name'' associated to a specific [[#Value|value]]. When compiling, their caption is converted to the assigned value. Since {{icon|vc}}, names and identifiers of objects within [[OBJS]] and [[TOBJ]] blocks are loaded from every ''IDE'' file defined into [[gta.dat|gta_vc.dat]], then those of vehicles and pedestrians within [[PEDS]] and [[CARS]] blocks are retrieved from [[default.ide]]. In {{icon|sa}}, they are listed into ''TXT'' files, whose name follows the [[Wikipedia:CamelCase|Pascal Case]] (eg. ''AudioEvents.txt''). These files respect the syntax below:
 
 
{constname0} {constvalue0}
 
 
{constnameN} {constvalueN}
 
 
''Constant names and values'' are divided by as many ''spaces'' or ''tabulations'' as you want. ''Constant lines'' are distinguished by two '''\n''' (new line) characters. The ''model names'' which aren't assigned to a constant are still valid (see also [[#Identifiers|Identifiers]]). Keep in mind [[#Arguments|arguments]] of some [[#Commands|commands]] having the [[#CONST (pseudo)|CONST]] type accept only ''constant values'' of a single ''namespace''.
 
 
;Notes
 
:Constants don't collide even though they belong to different namespaces;
 
:In {{icon|3}} and {{icon|vc}}, they are hardcoded as everything inside R* compiler;
 
:In {{icon|sa}}, the subdivision of constant namespaces in files might be just a listing of hardcoded constants useful for developers. The same would apply to {{icon|lcs}} and {{icon|vcs}}.
 
 
==Formatting==
 
 
Everything is ''case-insensitive'', that means the uppercase and lowercase letters have no dissimilarities when taken. Usually, the source code is conform to the same formatting according to:
 
 
* [[#Labels|Labels]] and [[#Variables|variables]] are entirely in lowercase;
 
* [[#Declaration|Declarations]], [[#Commands|commands]] and [[#Statements|statements]] are in uppercase;
 
* [[#Constants|Constants]] are mostly in uppercase but the lowercase variant can be seen aswell.<br/><br/>
 
=Compiling=
 
 
==Structure==
 
 
The source code is split up into several ''SC'' files which comprehend ''main file'', ''foreign gosubs'', ''subscripts'', ''mission scripts'', and ''streamed scripts''. These files can be included more times because they are actually processed once.
 
 
===Main file===
 
----
 
The ''main file'' is the most significant part of the whole source. It can include many script files and/or embedded ''gosubs'', ''scripts'' or ''functions''. Originally, it is characterized by the absence of the [[#Local|local]] [[#Scope|scope]]. It must be put outside the directory, having the same name as the main script file, where all other foreign scripts must be:
 
 
<directory>
 
| main
 
|  | gosub
 
|  |  |- gosub1.sc
 
|  |  \- gosubN.sc
 
|  | subscript
 
|  |  |- subscript1.sc
 
|  |  \- subscriptN.sc
 
|  | mission_guy
 
|  |  |- mission_guy1.sc
 
|  |  \- mission_guyN.sc
 
|  |- gosub.sc
 
|  |- subscript.sc
 
|  \- mission.sc
 
\- main.sc
 
 
;Note
 
:R* compiler will scan subfolders too.
 
 
===Foreign gosubs===
 
----
 
''Foreign gosubs'' (also called ''subroutines'') are ''main extension files''. They are called using the '''GOSUB_FILE''' [[#Commands|command]] which jumps to a specific [[#Labels|label]] and executes some code that returns back to the place where it has been called with '''RETURN'''. You are able to specify the gosub label to start jumping at aswell:
 
 
// File: main.sc
 
 
GOSUB_FILE gosub0 gosub.sc
 
 
// File: gosub.sc
 
 
gosub0:
 
 
  {
 
  {
     [...]
+
     LVAR_INT fellow_char robbery_car money_bag sanity
}
 
RETURN
 
 
 
;Limit
 
:Foreign gosubs were introduced since {{icon|3}}. They were unused in {{icon|vc}} and got removed in {{icon|sa}}, but then they were reimplemented in {{icon|lcs}} and {{icon|vcs}}.
 
 
 
====Gosubs====
 
 
 
As mentioned, ''gosubs'' are also embedded in any script file. They follow almost the same rules, except they are called by '''GOSUB''' and can actually inehrit the [[#Local|local]] [[#Scope|scope]] of the parent script:
 
 
 
// File: any.sc
 
 
GOSUB gosub0
 
 
 
// File: any.sc
 
 
   
 
   
gosub0:
+
    sanity = 0
{
+
    IF sanity = -1
     [...]
+
        CREATE_CHAR PEDTYPE_CIVMALE male01 0f 0f 0f fellow_char
 +
        CREATE_CAR admiral 0f 0f 0f robbery_car
 +
        CREATE_OBJECT woodenbox 0f 0f 0f money_bag
 +
     ENDIF
 
  }
 
  }
RETURN
 
 
;Note
 
:R* compiler doesn't take care if the code within a scope jumps to a gosub inside which another scope is declared. It is strongly recommended to pay attention at this issue or you will fall down into an irreparable local [[#Variables|variable]] mismatch.
 
  
===Subscripts===
+
==Lexical scope==
----
+
Once a script is launched, a local storage space consisting of a context-dependent set of variables (16+2 in III/Vice City, 32+2 in San Andreas and 40+2 on Mobile, 96+8+2 in Stories) ready for use is also reserved. As opposed to global variables, locals have visibility only inside a particular region of the source code and are preceded by the <code>LVAR</code> wording at declaration within a nonnestable block embraced by <code>{</code> and <code>}</code>:
''Subscripts'' are code blocks which take part of a ''queue of other scripts'' and are allocated over the memory by '''LAUNCH_MISSION'''. They are denoted by the presence of '''MISSION_START''' at the very top of the mission file. As long as they aren't ended with '''MISSION_END''', their execution never expires till the end of the game process. Each one works independently, even though they are able to share [[#Global|global]] [[#Variables|variables]]:
 
  
// File: main.sc
 
 
LAUNCH_MISSION subscript.sc
 
 
// File: subscript.sc
 
 
MISSION_START
 
 
[VAR_* {varname0}[,] [... {varnameN}]]
 
 
SCRIPT_NAME main
 
 
subscript_loop:
 
 
  {
 
  {
     [LVAR_* {varname0}[,] [... {varnameN}]]
+
     LVAR_INT pickup message_num
 
    [...]
 
 
  }
 
  }
//GOTO subscript_loop
 
MISSION_END
 
  
;Notes
+
Local names do not override global definitions, they must not collide together otherwise a warn is issued. Beyond user-defined locals, predefined <code>TIMERA</code> and <code>TIMERB</code> variables are provided: these timers measures the playing time milliseconds passed since the script beginning but they can be reset just fine. In the last Trilogy chapter, mission locals are mainly static variables starting from index 34 or 42 on Mobile whose space (having a size of 4 kibibytes) is shared among each mission thus being reasonably more abundant in this scenario but, as a side effect, local timers are unavailable. Transferring the control over and above the lexical scope boundaries or to another multiscript leaves the active context and hides local definitions, thereby switching across lexical scopes is bad practice and can lead to unpredictable results if contexts are not strictly equivalent in the variable declarations.
:'''MISSION_START''' is a special and fake directive that isn't assigned to any [[#Commands|command]]. R* compiler will notify an error if it isn't placed at the first line of a subscript or a [[#Mission scripts|mission script]];
 
:'''MISSION_END''' is an alias of '''TERMINATE_THIS_SCRIPT'''.
 
  
====Scripts====
+
==Arrays==
 +
Since the last Trilogy chapter, instead of declaring multiple scalar variables of same type, a one-dimensional indexed array can be defined. Each element is accessed through either a zero-based<sup>[no source]</sup> positive number or a variable index (local-only in Stories) in a subscript expression on assignment or argument passing. On declaration, a pair of square brackets enclose the array size which mustn't be bigger than 255 units:
  
As for [[#Gosubs|gosubs]], ''scripts'' can be embedded everywhere in a script file. They are started by '''START_NEW_SCRIPT''' which has an undefined amount of [[#Arguments|arguments]], whose type must match with those of each [[#Local|local]] variable of the starting script in order to be passed, else the compilation will interrupt. Unlike subscripts, they get terminated by '''TERMINATE_THIS_SCRIPT''' or '''TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME''' (elsewhere in another script):
+
VAR_INT prop_assets[32]
 +
CREATE_FORSALE_PROPERTY_PICKUP -1969.27 282.47 34.6 50000 PROP_3 prop_assets[0]
  
// File: any.sc
+
In sooth, one-based arrays were already supported in the second Trilogy chapter but in a manner which is defective and incomplete: they missed the intrinsic data type, giving no reference point on how to interpret the compiled operands, producing corrupted intermediate code because of fall-through reading. There is no precedent to safely assert that arrays became zero-based later on the language evolution but what is certain is this sort of indexing lines up immediate with variable indices. Oddly, as a result of the uni-dimensionality constraint implementation, a complementary yet nonfactual identifier can follow the closing bracket immediately afterwards with no redundancy notice (i.e. <code>prop_assets[0]anything</code>). Moreover, scalar variables have an implicit array size of one element which is needlessly accessible and plus the index part of the first element of an array is in turn omissible, everything notwithstanding the misleading declaration. Granted that brackets do not encompass any separator character or identifiers wider than 39 characters, array indices reject string constants but admit local timers.
 
START_NEW_SCRIPT script [{anyvalue0|varname0} ... {anyvalueN|varnameN}]
 
  
// File: any.sc
+
==String constants==
+
Very often, numeric literals express arbitrary values which are far from being self-documenting without descriptive labels belonging to a list of predefined names. These strings or enumerators are guaranteed to store an immutable constant and must forcibly pertain to the required enumeration if passed as arguments unless, if and only if no enumeration is set, the enumeration-free default constants <code>TRUE</code>/<code>FALSE</code>, <code>ON</code>/<code>OFF</code>, <code>DAY</code>/<code>NIGHT</code> or <code>KILLFRENZY</code> enumerators are supplied:
script:
 
{
 
    SCRIPT_NAME script
 
 
script_loop:
 
 
    [LVAR_* {varname0}[,] [... {varnameN}]]
 
 
    [...]
 
 
    //GOTO script_loop
 
    TERMINATE_THIS_SCRIPT
 
}
 
  
;Notes
+
CHANGE_BLIP_DISPLAY blip1_jm1 BLIP_ONLY
:Scripts must have a local [[#Scope|scope]];
+
flag_car_blip_displayed_jm1 = TRUE
:Script commands must be inserted within or after the local scope;
 
:Since {{icon|vc}}, the ''opening curly bracket'' must be put before the script [[#Labels|label]] when more arguments are passed.
 
  
====Functions====
+
Assignments and comparisons do not suffer such a restriction and, what's more, in case of too long lines (wider than 255 characters) immediates can safely replace string constants to shorten the exceeding length and fall within the limits. Of course, string constants are bound to the same parsing rules as string identifiers but, as being mainly hardcoded, they are just as limitless in length.<br/>
 +
During the development stage, the game's map experiences lots of continuous changes that make the management of objects, as a result of having a fixed indexing, pretty awkward without taking into account their bulk amount. In this respect, parameters expecting level objects are able to define the used objects (no more longer than 23 characters) under the hood, bringing them together in a sorted array whose criteria depends on the order of their appearance, something other than the default models which are hardcoded (for peds, cars, weapons, wheels, cutscene objects and the like). A blank, unavailable object is always reserved, shifting ahead each next negated position becoming one-based. Negative indices assure models fit in the used objects array, according to which the runtime matches the right index through a lookup table:
  
{{incomplete}}
+
REQUEST_MODEL bridgefuka // First use ever. It compiles -1 from now on.
 +
REQUEST_MODEL bridgefukb // First use again. This time it compiles -2.
 +
LOAD_ALL_MODELS_NOW
 +
CREATE_OBJECT_NO_OFFSET bridgefuka 715.746 -937.908 40.194 damagea
 +
CREATE_OBJECT_NO_OFFSET bridgefukb 787.835 -939.24 38.971 damageb
  
===Mission scripts===
+
The lack of error-checking requires a meticulous handwriting to avoid script deadlocks at runtime, the reason why default models of which undefined names follow the format <code>NOT_USED%d</code> (where <code>%d</code> is a model index from 0 to 299) and level objects are loaded straight from [[Item Definition|IDE]] files for Vice City's remastered build. Nonetheless, iterating among several objects can be very expensive for a poorly optimized, rough compiler even on fast machines, not to mention enumerators are likely to collide without specializing prefixes (i.e. <code>SNIPER</code> camera mode and weapon name, formerly <code>WEAPON_SNIPER</code>), enough to revert back thereafter.<br/>
----
+
Assignments and comparisons have no clue about used objects and are therefore not designed to accommodate or implicitly define one on their own, because they are supposed to be strict with the identifier existence as being more prone to work out with variables. This concept somehow extends to those parameters not featuring used objects as a general rule. If an unusual application needs to take place, making use of non-inlined <code>CONSTANT_INT</code> declarations would hint the compiler to treat unequivocally the specified string constants as used objects, truly defining a new one on the first practical usage wherever it occurs and not yielding an undefined variable error:
''Mission scripts'' are those [[#Subscripts|subscripts]] which are responsible for the presence of a storyline in the game. When they are launched with '''LOAD_AND_LAUNCH_MISSION''', the mission is loaded in the mission block, allocated over the memory and the script pointer is moved to the corresponding mission [[#Offsets|offset]]. Do not forget to begin a mission script with '''MISSION_START''' and end it with '''MISSION_END''':
 
  
  // File: main.sc
+
  CONSTANT_INT cj_pizza_1
 +
CONSTANT_INT cj_pizza_2
 +
VAR_INT food_model1 food_model2
 
   
 
   
  LOAD_AND_LAUNCH_MISSION mission.sc
+
  REQUEST_MODEL pizzahigh  // -1
 +
food_model1 = cj_pizza_1 // -2
 +
food_model2 = cj_pizza_2 // -3
 +
REQUEST_MODEL food_model1
 +
REQUEST_MODEL food_model2
  
// File: mission.sc
+
Any string constant passed in place of an object model compiles a used object indiscriminately assuming no <code>CONSTANT_INT</code> declaration, also preventing redefinitions towards default constants, enumerators and variable names, does exist. Messing around with frequent compiler tool recompilations can be tedious solely to establish broad, same-indexed or math-related string constants but fortunately, in the last Trilogy chapter, the language offers the opportunity to settle user-supplied default constants for numeric literals using <code>CONST</code>-prefixed declarations (maximum 39 characters long) which, alike for variables and <code>CONSTANT_INT</code>s, are backwards accessible:
 
MISSION_START
 
 
GOSUB mission_start
 
 
IF HAS_DEATHARREST_BEEN_EXECUTED
 
    GOSUB mission_failed
 
ENDIF
 
 
GOSUB mission_cleanup
 
 
MISSION_END
 
 
[VAR_* {varname0}[,] [... {varnameN}]]
 
 
mission_start:
 
 
REGISTER_MISSION_GIVEN
 
SCRIPT_NAME mission
 
 
// Variables initialization
 
 
{
 
    [LVAR_* {varname0}[,] [... {varnameN}]]
 
 
    [...]
 
}
 
GOTO mission_passed
 
 
mission_failed:
 
[...]
 
RETURN
 
 
mission_passed:
 
REGISTER_MISSION_PASSED mission
 
//PLAYER_MADE_PROGRESS 1
 
[...]
 
RETURN
 
 
mission_cleanup:
 
// Mark everything as no longer needed
 
[...]
 
RETURN
 
  
Few missions doesn't need to be executed twice or more times because they may just initialize some [[#Global|global]] [[#Variables|variables]] defined in the [[#Main file|main]] script or launch the intro mission. For this reason, here comes the use of '''LOAD_AND_LAUNCH_MISSION_EXCLUSIVE''':
+
CONST_INT gf_date_active 1
 
+
  CONST_FLOAT math_pi 3.1415927
  // File: main.sc
 
 
   
 
   
  LOAD_AND_LAUNCH_MISSION_EXCLUSIVE initial.sc
+
  SET_BIT gf_date_flags gf_date_active
  LOAD_AND_LAUNCH_MISSION_EXCLUSIVE intro.sc
+
rad_angle = deg_angle * math_pi
 +
  rad_angle /= 180.0
  
;Note
+
Given that default models are also default constants in Stories chapters<sup>[no source]</sup>, default constants and used objects count as pseudoconstants: contrary to what non-default enumerators entail, generic alternatives are favoured on assignment or comparison command matching. It should be pointed out that, due to a critical compiler bug, the high-order word of the value held by any enumerator is unexpectedly discarded on assignment or comparison and that, if set, the 16th bit yields a nonexistent variable error (i.e. <code>THREAT_GANG9</code> flag) prior Stories chapters, after which a default constant is compiled instead (buggy behaviour) and recognized only if the low-order word represents a value not equal to -1<sup>[no source]</sup>:
:Exclusive missions are never launched in the source code. It's likely, it was an idea not came to the end successfully or rather they were useful for debugging purposes.
 
  
;Limits
+
{|style="table-layout: fixed; margin-bottom: -8px" width=100% cellspacing=0 cellpadding=0
:'''LOAD_AND_LAUNCH_MISSION_EXCLUSIVE''' is available only in {{icon|vc}} and {{icon|sa}};
+
|width=50%|'''Mission script'''
:R* compiler won't let you using more than 2 '''LOAD_AND_LAUNCH_MISSION_EXCLUSIVE'''.
+
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
SET_CHAR_THREAT_SEARCH npc_char THREAT_GANG_GOLFER
 +
SET_CHAR_THREAT_SEARCH npc_char THREAT_GANG9
 +
SET_CHAR_THREAT_SEARCH npc_char THREAT_EMERGENCY
 +
threat_flag = THREAT_GANG_GOLFER
 +
threat_flag = THREAT_GANG9 // Ill-formed in Trilogy.
 +
threat_flag = THREAT_EMERGENCY
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
SET_CHAR_THREAT_SEARCH npc_char 16384
 +
SET_CHAR_THREAT_SEARCH npc_char 32768
 +
SET_CHAR_THREAT_SEARCH npc_char 65536
 +
SET_VAR_INT_TO_CONSTANT threat_flag 16384
 +
SET_VAR_INT threat_flag 32768
 +
SET_VAR_INT_TO_CONSTANT threat_flag 0
 +
</pre>
 +
|}
  
===Streamed scripts===
+
This drawback unwittingly affects real code in Liberty City Stories in one circumstance. On a final note, string constants are incompatible with optional arguments and thus taking advantage of a temporary variable would overcome this syntactic limitation.
----
 
{{incomplete}}
 
  
==Statements==
+
==Operators==
 +
As soon as a numeric or text label variable is declared, it can be subjected to algebric operations and/or logical comparisons by virtue of several operators. Their support is sadly very primitive, in fact the ability to establish complex expressions with parentheses and such is not featured albeit one and only binary operation is enabled to follow the basic assignment. In this regard, the variable being assigned to the lvalue cannot be the same as the outer rvalue for non-commutative operations: <code>VAR1 = THING - VAR1</code>, <code>VAR1 = THING / VAR1</code>, <code>VAR1 = THING +@ VAR1</code> and <code>VAR1 = THING -@ VAR1</code> are all ill-formed (where <code>THING</code> &ne; <code>VAR1</code>). This issue arises because the explicit usage of a temporary variable is needed which would be harmful for the compiler to waste by itself under the hood, thus here expressions are necessarily made up of distinct two-operand instructions, that is the lvalue content is initialized prior encoding any supplementary rvalue arithmetic:
  
As usual, the evolution of something implies its development over the years. Alongside, the ''statements'' implementation has been distributed equally into every chapter. Their definitions are similar to those used in ''pseudocodes'' resulting in a ''raw source code''. However, you are still able to build your own control flows:
+
{|style="table-layout: fixed; margin-bottom: -8px" width=100% cellspacing=0 cellpadding=0
 +
|width=50%|'''Mission script'''
 +
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
VAR1 = 1 - VAR1 // Invalid, cause VAR1 = 1; VAR1 -= VAR1 doesn't make sense.
 +
                // It would perform 1 - 1 = 0. Workaround needed.
 +
VAR1 = 1 / VAR1 // Invalid, cause VAR1 = 1; VAR1 /= VAR1 does no effect.
 +
                // It would perform 1 / 1 = 1. Workaround needed.
 +
VAR1 = 1 - VAR2 // Valid, cause VAR1 = 1; VAR1 -= VAR2 doesn't null itself like above.
 +
                // It performs x = 1 - y.
 +
VAR1 = 1 + VAR1 // Valid, addition (as well as multiplication) is commutative so VAR1 += 1.
 +
                // It performs x = x + 1.
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
NEGATE VAR1 // Unknown command (speculative). It would do x = -x.
 +
ADD_THING_TO_THING VAR1 1
 +
ONEOVER VAR1 // Unknown command (speculative). It would do x = 1 / x.
 +
MULT_THING_BY_THING VAR1 1
 +
SET VAR1 1
 +
SUB_THING_FROM_THING VAR1 VAR2
 +
ADD_THING_TO_THING VAR1 1
  
ANDOR {value}
+
</pre>
    [NOT] {condition0}
+
|}
    [[NOT] {condition8}]
 
GOTO_IF_FALSE ELSE
 
    {consequence}
 
    [GOTO ENDIF]
 
ELSE:
 
    [{alternative}
 
ENDIF:]
 
  
;Note
+
The subtraction of positive or negative rvalues necessitates a splitting character in order to discern the infix operator unambiguously, which would be treated as part of the literal or a variable decrement otherwise (i.e. <code>VAR1 = VAR1 -1</code> or <code>VAR1 = VAR1 --1</code>). Typically, string constants are not suitable for math calculations because of the lack of matchable alternative commands but even so they are semantically contemplated as long as a non-default enumerator is provided as the inner rvalue of a ternary operation or a default constant or enumerator is passed to any rvalue (i.e. <code>VAR1 = PAD1 + 1</code>, <code>VAR1 = DAY + 1</code> or <code>VAR1 = 1 + KILLFRENZY_INITIALLY</code>). Another clear limitation is prefix and postfix operators do not apply onto arguments, hence there's no concrete differentiation. However, the language introduces the timed addition/subtraction to looply update a variable in a frame-rate independent way, the cast assignment to do a mutual conversion between integers and floats but it doesn't give support for the modulo operation as its predecessor. The inequality comparison was planned but quickly gone obsolete<sup>[no source]</sup> &ndash; availing of the negated form of the equality operator would have sounded more intuitive but one should be aware the not-flag is not bundled with the command index when matching alternative commands. Due to a negligence of the programmers in charge, liable for forgetting some assets of the scripting environment, the local-global in/equality comparison between integer or float variables is not feasible except in the last chapter of Trilogy and Stories series. Surprisingly enough, the basic assignment may prepend <code>ABS</code> which in so doing would be capable of receiving numeric literals because of the pre-empted rvalue assigning (i.e. <code>VAR = ABS THING</code>). In principle, <code>SET</code> is not compiled only if both lvalue and rvalue (whether inner or outer) of a ternary operation or <code>ABS</code> assignment collide (identity).
:It's likely, user-made control flows weren't intended to be usable because R* compiler cannot recognize an [[#Comparison|equal to]] rather than an [[#Arithmetic|assignment]] operator.
 
  
===IF===
+
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="Arithmetic_operators">Arithmetic operators</span>
  
'''IF''' is one of the most widespread ''conditional statements'' which executes some codes by evaluating a boolean flag, the returning value of one or more conditions. According to the returning value, either the ''consequence'' or the ''alternative'' will be performed. The condition result can be inverted by appending the '''NOT''' [[#Logical|logical operator]] before. More conditions require the use of the remaining logical operators, they are '''AND''', when verifying if all ''checks'' are true, and '''OR''', while testing if one of all checks is true. The syntax below summarize the whole explanation:
+
{|class=wikitable
 
 
IF [NOT] {condition0}
 
[AND|OR [NOT] {condition8}]
 
    {consequence}
 
[ELSE
 
    {alternative}]
 
ENDIF
 
 
 
;Limit
 
:More than ''8 conditions'' per statement are't allowed.
 
 
 
===IFNOT===
 
 
 
'''IFNOT''' is a variation of the '''IF''' statement as already stated. As opposed to its closest relative, the conditions evaluetion is reversed, that is the ''consequence'' is perfomed when the boolean flag is false, else the ''alternative'' is executed:
 
 
 
IFNOT [NOT] {condition0}
 
[AND|OR [NOT] {condition8}]
 
    {consequence}
 
[ELSE
 
    {alternative}]
 
ENDIF
 
 
 
;Limit
 
:It is supported in {{icon|3}}, {{icon|lcs}} and {{icon|vcs}}.
 
 
 
===WHILE===
 
 
 
Alike the '''IF''' ''construct'', '''WHILE''' is a conditional statement. The only difference consists in how it performs the ''consequence'', that is it ''loops'' every line of code built into if the boolean flag is true:
 
 
 
WHILE [NOT] {condition0}
 
[AND|OR [NOT] {condition8}]
 
    {consequence}
 
ENDWHILE
 
 
 
===WHILENOT===
 
 
 
'''WHILENOT''' acts seemingly like the '''WHILE''' statement, as all condition truths are inverted and therefore the ''consequence'' is performed over and over again until the boolean flag becomes true:
 
 
 
WHILENOT [NOT] {condition0}
 
[AND|OR [NOT] {condition8}]
 
    {consequence}
 
ENDWHILE
 
 
 
;Limit
 
:It is supported in {{icon|3}}, {{icon|lcs}} and {{icon|vcs}}.
 
 
 
===REPEAT===
 
 
 
Similar to the '''WHILE''' construct, '''REPEAT''' ''iterates'' the ''consequence'' repeatedly depending on a 0-value incremental [[#Variables|variable]] which rises till the times specified:
 
 
 
REPEAT {times} {varname}
 
    {consequence}
 
ENDREPEAT
 
 
 
;Limits
 
:It is supported since {{icon|vc}};
 
:The times must be positive;
 
:The code will be read at least once in any case.
 
 
 
===SWITCH===
 
 
 
Basically, '''SWITCH''' is a ''group of concatenated '''IF''' statements''. When a condition is false the next '''CASE''' gets performed, otherwise the ''consequence'' is executed till '''BREAK''' occurs and so the code jumps to the end of the construct. If none of the cases is true, a '''DEFAULT''' clause may be carried out:
 
 
 
SWITCH {varname}
 
    CASE {value0}
 
        {consequence}
 
        BREAK
 
    [CASE {valueN}
 
        {consequence}
 
        BREAK]
 
    [DEFAULT
 
        {alternative}
 
        BREAK]
 
ENDSWITCH
 
 
 
;Limits
 
:It is supported since {{icon|sa}};
 
:'''CASE''' allows the use of [[#INT|INT]] and [[#CONST (pseudo)|CONST]] values only;
 
:In {{icon|sa}}, values must be sorted (R* compiler should do it implicitely);
 
:Every '''CASE''' including '''DEFAULT''' must end with a '''BREAK'''.<br/><br/>
 
=Decompiling=
 
 
 
==Structure==
 
 
 
 
 
 
==Identifiers==
 
 
 
''Undefined [[#Constants|constants]]'' of model identifiers, whose name refers to a [[DFF]] which is presumably archived into any of the [[IMG]]<nowiki>s</nowiki>, loaded by the game, are overwritten by a decrementing value in the order they get compiled. These ''model names'' are then put into the second segment of the ''SCM header''. Those of [[#Mission scripts|mission scripts]] and [[#Streamed scripts|streamed scripts]] respect the same rule except the fact they are turned into a 0-based growing identifier, while exclusive mission scripts are launched by a negative identifier.
 
 
 
==Offsets==
 
 
 
An ''offset'' is a ''32-bit signed integer'' which points to a location of the source code. Those within the [[#Main file|main file]], [[#Foreign gosubs|foreign gosubs]] and [[#Subscripts|subscripts]] are ''absolute offsets'' that start from the beginning of the main script, while the ones inside [[#Mission scripts|mission scripts]] and [[#Streamed scripts|streamed scripts]] are ''relative offsets'' starting from their beginning. The offset is related to [[#Global|global]] [[#Variables|variables]] aswell, whose interval goes from ''8'' and ends to ''0xFFFC'', each one is aligned to the nearest 4 bytes.
 
 
 
==Variables==
 
 
 
The following table shows the [[#Variables|variables]] range of the [[#Local|local]] [[#Scope|scope]] for each game version:
 
 
 
{|class=wikitable style=text-align:center
 
!Context
 
!width=50px|{{icon|3}}
 
!width=50px|{{icon|vc}}
 
!width=50px|{{icon|sa}}
 
!width=50px|{{icon|lcs}}
 
!width=50px|{{icon|vcs}}
 
|-
 
|align=left|[[#Foreign gosubs|Foreign gosub]]/[[#Gosubs|Gosub]]||0-15||0-15||n/a||0-95||0-95
 
|-
 
|align=left|[[#Subscripts|Subscript]]/[[#Scripts|Script]]||0-15||0-15||0-31||0-95||0-95
 
|-
 
|align=left|[[#Mission scripts|Mission script]]||0-15||0-15||0-1023||0-95||0-95
 
|-
 
|align=left|[[#Streamed scripts|Streamed script]]||n/a||n/a||0-31||n/a||n/a
 
|-
 
|align=left|[[#Functions|Function]]||n/a||n/a||n/a||0-95||0-95
 
 
|-
 
|-
!colspan=6|
+
!colspan=2 width=192px style="text-align: left"|Name
 +
!width=148px|Syntax
 +
!width=112px|INT
 +
!width=112px|FLOAT
 +
!width=112px|TEXT_LABEL/16
 
|-
 
|-
|align=left|[[#Timers|Timer]]||16-17||16-17||32-33||t0-t1||t0-t1
+
|colspan=2|Basic assignment||align=center|<pre style="margin: 0">VAR = THING</pre>||align=center|&#x2713;||align=center|&#x2713;||align=center|&#x2713;
|}
 
 
 
==Operators composition==
 
 
 
As far as you wouldn't know, SCM's [[#Operators|operators]] always take two operands to compute an operation. Their composition is listed below:
 
 
 
{|class=wikitable
 
!width=70px|Operator/s
 
!width=200px colspan=2|Name
 
!width=200px|Syntax
 
!width=180px|Composition
 
 
|-
 
|-
!rowspan=2|++
+
|colspan=2|Addition||align=center|<pre style="margin: 0">THING + THING</pre>||align=center|&#x2713;||align=center|&#x2713;||
|align=center rowspan=2|Increment
 
|align=center|Pre
 
|align=center|<code>'''++''' expr0</code>
 
|align=center rowspan=2|<code>expr0 '''+=''' 1</code>
 
 
|-
 
|-
|align=center|Post
+
|colspan=2|Subtraction||align=center|<pre style="margin: 0">THING - THING</pre>||align=center|&#x2713;||align=center|&#x2713;||
|align=center|<code>expr0 '''++'''</code>
 
 
|-
 
|-
!rowspan=2|--
+
|colspan=2|Multiplication||align=center|<pre style="margin: 0">THING * THING</pre>||align=center|&#x2713;||align=center|&#x2713;||
|align=center rowspan=2|Decrement
 
|align=center|Pre
 
|align=center|<code>'''--''' expr0</code>
 
|align=center rowspan=2|<code>expr0 '''-=''' 1</code>
 
 
|-
 
|-
|align=center|Post
+
|colspan=2|Division||align=center|<pre style="margin: 0">THING / THING</pre>||align=center|&#x2713;||align=center|&#x2713;||
|align=center|<code>expr0 '''--'''</code>
 
 
|-
 
|-
!= +
+
|colspan=2|Timed addition||align=center|<pre style="margin: 0">THING +@ THING</pre>||||align=center|&#x2713;||
|align=center colspan=2|Addition and assignment
 
|align=center|<code>expr0 '''=''' expr1 '''+''' expr2</code>
 
|align=center|<code>expr0 '''=''' expr1<br/>expr0 '''+=''' expr2</code>
 
 
|-
 
|-
!= -
+
|colspan=2|Timed subtraction||align=center|<pre style="margin: 0">THING -@ THING</pre>||||align=center|&#x2713;||
|align=center colspan=2|Subtraction and assignment
 
|align=center|<code>expr0 '''=''' expr1 '''-''' expr2</code>
 
|align=center|<code>expr0 '''=''' expr1<br/>expr0 '''-=''' expr2</code>
 
 
|-
 
|-
!= *
+
|rowspan=2|Increment||Prefix||align=center|<pre style="margin: 0">++ VAR</pre>||rowspan=2 align=center|&#x2713;||rowspan=2|
|align=center colspan=2|Multiplication and assignment
+
|rowspan=2|
|align=center|<code>expr0 '''=''' expr1 '''*''' expr2</code>
 
|align=center|<code>expr0 '''=''' expr1<br/>expr0 '''*=''' expr2</code>
 
 
|-
 
|-
!= /
+
|Postfix||align=center|<pre style="margin: 0">VAR ++</pre>
|align=center colspan=2|Division and assignment
 
|align=center|<code>expr0 '''=''' expr1 '''/''' expr2</code>
 
|align=center|<code>expr0 '''=''' expr1<br/>expr0 '''/=''' expr2</code>
 
 
|-
 
|-
!= +@
+
|rowspan=2|Decrement||Prefix||align=center|<pre style="margin: 0">-- VAR</pre>||rowspan=2 align=center|&#x2713;||rowspan=2|
|align=center colspan=2|Timed addition and assignment
+
|rowspan=2|
|align=center|<code>expr0 '''=''' expr1 '''+@''' expr2</code>
 
|align=center|<code>expr0 '''=''' expr1<br/>expr0 '''+=@''' expr2</code>
 
 
|-
 
|-
!= -@
+
|Postfix||align=center|<pre style="margin: 0">VAR --</pre>
|align=center colspan=2|Timed subtraction and assignment
 
|align=center|<code>expr0 '''=''' expr1 '''-@''' expr2</code>
 
|align=center|<code>expr0 '''=''' expr1<br/>expr0 '''-=@''' expr2</code>
 
 
|}
 
|}
  
==Opcodes==
+
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="Compound_assignment_operators">Compound assignment operators</span>
  
An ''opcode'' is a ''set of instructions to be performed'' the game executes by passing an undefined or absent amount of ''arguments''. It is assigned to a ''16-bit unsigned integer'' special ID. The maximum number of available opcodes is ''0x7FFF'', since the last bit (''0x8000'') is set whenever they are used as ''negative conditions'' (those with the '''NOT''' [[#Logical|logical operator]], just to make things clear).
+
{|class=wikitable
 
 
===Arguments===
 
 
 
An ''argument'' is some data given as input to a command. Normally, commands have a defined amount of arguments and those not, such as '''START_NEW_SCRIPT''', can pass as many arguments as the available [[#Local|local]] [[#Variables|variables]] are, except [[#Timers|timers]]. This limitation is game specific: ''16'' for {{icon|3}} and {{icon|vc}}, ''32'' for {{icon|sa}}, ''96'' for {{icon|lcs}} and {{icon|vcs}}.
 
 
 
===Specials===
 
 
 
Here is the list of all special [[#Commands|commands]] and their relative specifications:
 
 
 
'''Legend:'''
 
* '''Declaration:'''
 
** @, [[#Declaration|DECL]]
 
* '''Scope:'''
 
** (none), [[#Value|VAL]]
 
** V, [[#Global|VAR]]
 
** L, [[#Local|LVAR]]
 
** H, [[#Scope|HOLD]] (VAR, LVAR)
 
** *, ANY (VAL, VAR, LVAR)
 
* '''Datatype:'''
 
** O, [[#LABEL|LABEL]]
 
** I, [[#INT|INT]]
 
** F, [[#FLOAT|FLOAT]]
 
** S, (TEXT):
 
*** 8, [[#TEXT_LABEL|TEXT_LABEL]]
 
*** 16, [[#TEXT_LABEL16|TEXT_LABEL16]]
 
*** 32, [[#TEXT_BUFFER|TEXT_BUFFER]]
 
*** N, [[#TEXT_VARLEN|TEXT_VARLEN]]
 
** T, [[#T (pseudo)|T (pseudo)]]
 
** C, [[#CONST (pseudo)|CONST (pseudo)]]
 
'''List:'''
 
{|class="mw-collapsible mw-collapsed wikitable" style=text-align:center
 
!rowspan=3 colspan=2|Command
 
!rowspan=3|ID
 
!rowspan=3|Arg.<br/>#
 
!colspan=8|Arguments
 
 
|-
 
|-
!width=45px rowspan=2|1
+
!width=192px style="text-align: left"|Name
!width=45px rowspan=2|2
+
!width=148px|Syntax
!width=45px rowspan=2|3
+
!Meaning
!width=45px rowspan=2|4
+
!width=112px|INT
!width=45px rowspan=2|...
+
!width=112px|FLOAT
!width=45px rowspan=2|18
 
!width=45px rowspan=2|...
 
!width=45px|n+l
 
 
|-
 
|-
!n+i+o
+
|Addition assignment||align=center|<pre style="margin: 0">VAR += THING</pre>||align=center|<pre style="margin: 0">VAR1 = VAR1 + THING</pre>||align=center|&#x2713;||align=center|&#x2713;
 
|-
 
|-
|colspan=12|{{icon|3}} {{icon|vc}} {{icon|sa}} {{icon|lcs}} {{icon|vcs}}
+
|Subtraction assignment||align=center|<pre style="margin: 0">VAR -= THING</pre>||align=center|<pre style="margin: 0">VAR1 = VAR1 - THING</pre>||align=center|&#x2713;||align=center|&#x2713;
 
|-
 
|-
!colspan=2|MISSION_START{{ref|misdef|[*]}}
+
|Multiplication assignment||align=center|<pre style="margin: 0">VAR *= THING</pre>||align=center|<pre style="margin: 0">VAR1 = VAR1 * THING</pre>||align=center|&#x2713;||align=center|&#x2713;
|
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|GOTO{{ref|statem|[*]}}
+
|Division assignment||align=center|<pre style="margin: 0">VAR /= THING</pre>||align=center|<pre style="margin: 0">VAR1 = VAR1 / THING</pre>||align=center|&#x2713;||align=center|&#x2713;
|0002
 
!1
 
|O||colspan=7|
 
 
|-
 
|-
|colspan=12|{{icon|3}} {{icon|vc}} {{icon|sa}} {{icon|lcs}}
+
|Timed addition assignment||align=center|<pre style="margin: 0">VAR +=@ THING</pre>||align=center|<pre style="margin: 0">VAR1 = VAR1 +@ THING</pre>||align=center|&nbsp;||align=center|&#x2713;
 
|-
 
|-
!rowspan=12|=<br/>SET!!SET_VAR_INT
+
|Timed subtraction assignment||align=center|<pre style="margin: 0">VAR -=@ THING</pre>||align=center|<pre style="margin: 0">VAR1 = VAR1 -@ THING</pre>||||align=center|&#x2713;
|0004
 
!rowspan=12|2
 
|VI||I||colspan=6|
 
 
|-
 
|-
!SET_VAR_FLOAT
+
|Cast assignment||align=center|<pre style="margin: 0">VAR =# THING</pre>||align=center|AS IS||align=center|&#x2713;||align=center|&#x2713;
|0005||VF||F||colspan=6|
+
|}
 +
 
 +
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="Comparison_operators.2Frelational_operators">Comparison operators/relational operators</span>
 +
 
 +
{|class=wikitable
 
|-
 
|-
!SET_LVAR_INT
+
!width=192px style="text-align: left"|Name
|0006||LI||I||colspan=6|
+
!width=148px|Syntax
 +
!width=112px|INT
 +
!width=112px|FLOAT
 +
!width=112px|TEXT_LABEL/16
 
|-
 
|-
!SET_LVAR_FLOAT
+
|Equal to||align=center|<pre style="margin: 0">VAR = THING</pre>||align=center|&#x2713;||align=center|&#x2713;||align=center|&#x2713;
|0007||LF||F||colspan=6|
 
 
|-
 
|-
!SET_VAR_INT_TO_VAR_INT
+
|Not equal to<sup>[no source]</sup>||align=center|<pre style="margin: 0">VAR <> THING</pre>||align=center|&#x2713;||align=center|&#x2713;||
|0084||VI||VI||colspan=6|
 
 
|-
 
|-
!SET_LVAR_INT_TO_LVAR_INT
+
|Greater than||align=center|<pre style="margin: 0">THING > THING</pre>||align=center|&#x2713;||align=center|&#x2713;||
|0085||LI||LI||colspan=6|
 
 
|-
 
|-
!SET_VAR_FLOAT_TO_VAR_FLOAT
+
|Less than||align=center|<pre style="margin: 0">THING < THING</pre>||align=center|&#x2713;||align=center|&#x2713;||
|0086||VF||VF||colspan=6|
 
 
|-
 
|-
!SET_LVAR_FLOAT_TO_LVAR_FLOAT
+
|Greater than or equal to||align=center|<pre style="margin: 0">THING >= THING</pre>||align=center|&#x2713;||align=center|&#x2713;||
|0087||LF||LF||colspan=6|
 
 
|-
 
|-
!SET_VAR_FLOAT_TO_LVAR_FLOAT
+
|Less than or equal to||align=center|<pre style="margin: 0">THING <= THING</pre>||align=center|&#x2713;||align=center|&#x2713;||
|0088||VF||LF||colspan=6|
+
|}
 +
 
 +
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="Logical_operators">Logical operators</span>
 +
 
 +
{|class=wikitable
 
|-
 
|-
!SET_LVAR_FLOAT_TO_VAR_FLOAT
+
!width=192px style="text-align: left"|Name
|0089||LF||VF||colspan=6|
+
!width=148px|Syntax
 
|-
 
|-
!SET_VAR_INT_TO_LVAR_INT
+
|Logical negation||align=center|<pre style="margin: 0">NOT</pre>
|008A||VI||LI||colspan=6|
 
 
|-
 
|-
!SET_LVAR_INT_TO_VAR_INT
+
|Logical conjunction||align=center|<pre style="margin: 0">AND</pre>
|008B||LI||VI||colspan=6|
 
 
|-
 
|-
!rowspan=12|+=<br/>+<br/>ADD_THING_TO_THING!!ADD_VAL_TO_INT_VAR
+
|Logical disjunction||align=center|<pre style="margin: 0">OR</pre>
|0008
+
|}
!rowspan=12|2
+
 
|VI||I||colspan=6|
+
==Commands==
 +
The [[Wikipedia:Imperative programming|imperative programming]] paradigm provides for a conglomerate of commands the script is filled up of and structured in, which are seen as orders to instruct the execution of the relative built-in portion of game code at runtime. Their invocation is faithful to [[Wikipedia:Functional programming|procedure]] calls: they may feature zero or more parameters (up to 16+ in III\Vice City, 32+ in San Andreas and Stories) of any type or indefinite, depending on whether or not qualified as optional, and receive as much as arguments either by-value or by-reference affecting the read/written access accordingly (do note a pure reference does not initialize anything). Alike procedures, no assignable result is returned but a boolean state is caught anyway on conditional evaluation. One major peculiarity is command names are usually identified by a verb in its imperative form:
 +
 
 +
GIVE_WEAPON_TO_CHAR mafia_1X WEAPONTYPE_UZI 999
 +
 
 +
Command names are leftmost identifiers not ending with a colon (not a label) and not preceded or followed by an operator token (not a variable). On code generation, their definition is turned into a 15-bit index reflecting the position the name is matched at in a list of command descriptors and packed with the not-flag stored in the most significant bit, accompained by a known or indeterminate number of typified, somewhat typified or thorougly nontypified operands completing several [[Wikipedia:Opcode|instructions]] which are arranged in order to bring forth the intermediate script [[Wikipedia:Bytecode|bytecode]]. At every command corresponds an output except for variable, string constant and lexical scope declarators or for the classic <code>NOP</code> ([[Wikipedia:NOP|no operation]]). Operand immediates mainly use the shortest representation for size optimization, yet label references always yield 32-bit addresses.<br/>
 +
Game progress rely on many countable stuff to determine the percentage acquired at any given time which are extremely time spending and easily error-prone to quantize manually. Counter-commands come to aid, sort of adaptive counters featuring a possibly zero-valued argument updated automatically during the compilation process that keeps track of the times a few commands are used or of the total sum of some argument value of certain commands, discarding nonimmediates:
 +
 
 +
{|class=wikitable style="text-align: left"
 
|-
 
|-
!ADD_VAL_TO_FLOAT_VAR
+
!Initializer
|0009||VF||F||colspan=6|
+
!Dependency
 +
!width=50px|Is<br/>addend
 
|-
 
|-
!ADD_VAL_TO_INT_LVAR
+
|<code>SET_COLLECTABLE1_TOTAL</code>||<code>CREATE_COLLECTABLE1</code>||
|000A||LI||I||colspan=6|
 
 
|-
 
|-
!ADD_VAL_TO_FLOAT_LVAR
+
|<code>SET_PROGRESS_TOTAL</code>||<code>PLAYER_MADE_PROGRESS</code>||align=center|&#x2713;
|000B||LF||F||colspan=6|
 
 
|-
 
|-
!ADD_INT_VAR_TO_INT_VAR
+
|rowspan=2|<code>SET_TOTAL_NUMBER_OF_MISSIONS</code>||<code>REGISTER_MISSION_PASSED</code>||
|0058||VI||VI||colspan=6|
 
 
|-
 
|-
!ADD_FLOAT_VAR_TO_FLOAT_VAR
+
|<code>REGISTER_ODDJOB_MISSION_PASSED</code>||
|0059||VF||VF||colspan=6|
 
 
|-
 
|-
!ADD_INT_LVAR_TO_INT_LVAR
+
|<code>SET_MISSION_RESPECT_TOTAL</code>||<code>AWARD_PLAYER_MISSION_RESPECT</code>||align=center|&#x2713;
|005A||LI||LI||colspan=6|
+
|}
 +
 
 +
Condition-based statements and counter-commands along with the file includers outside of the main script or main extensions, where labels are expected instead of filenames, are mostly parameterized regardless of their own descriptor (the type-check is still done though), while another category consisting of multicommands is able to look for the matching prototype into a list of akin commands on the basis of the data type of the passed arguments and choose, accordingly, the equivalent alternative in a direct and effortless way. Although the alternative commands are also accessible by and can share the same definition, the selection process is not entirely conform to [[Wikipedia:Function overloading|function overloading]] because these still retain their exclusive name as being plainly resolved through weak aliases. A complete listing is shown below:
 +
 
 +
{|width=100% cellspacing=0 cellpadding=0
 
|-
 
|-
!ADD_FLOAT_LVAR_TO_FLOAT_LVAR
+
|width=50%|<span style="display: block; margin: 0; font-size: 1.17em; font-weight: bold; color: black">Trilogy and first Stories chapters</span>||width=50%|<span style="display: block; margin: 0; font-size: 1.17em; font-weight: bold; color: black">Second Stories chapter</span>
|005B||LF||LF||colspan=6|
 
 
|-
 
|-
!ADD_INT_VAR_TO_INT_LVAR
+
|valign=top|<div style="overflow: auto; float: left" width=auto>
|005C||LI||VI||colspan=6|
+
{|class=wikitable style="margin-bottom: 0" width=100%
 
|-
 
|-
!ADD_FLOAT_VAR_TO_FLOAT_LVAR
+
!colspan=2 width=420px style="text-align: left"|Command
|005D||LF||VF||colspan=6|
+
!rowspan=2 width=64px|Game<br/>support
 
|-
 
|-
!ADD_INT_LVAR_TO_INT_VAR
+
!width=16px|
|005E||VI||LI||colspan=6|
+
!style="text-align: left"|Alternative
 +
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!ADD_FLOAT_LVAR_TO_FLOAT_VAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>SET</code> (<code>=</code>)
|005F||VF||LF||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!rowspan=12|-=<br/>-<br/>SUB_THING_FROM_THING!!SUB_VAL_FROM_INT_VAR
+
|rowspan=18 width=16px|
|000C
+
|<code>SET_VAR_INT</code>||rowspan=12|
!rowspan=12|2
 
|VI||I||colspan=6|
 
 
|-
 
|-
!SUB_VAL_FROM_FLOAT_VAR
+
|<code>SET_VAR_FLOAT</code>
|000D||VF||F||colspan=6|
 
 
|-
 
|-
!SUB_VAL_FROM_INT_LVAR
+
|<code>SET_LVAR_INT</code>
|000E||LI||I||colspan=6|
 
 
|-
 
|-
!SUB_VAL_FROM_FLOAT_LVAR
+
|<code>SET_LVAR_FLOAT</code>
|000F||LF||F||colspan=6|
 
 
|-
 
|-
!SUB_INT_VAR_FROM_INT_VAR
+
|<code>SET_VAR_INT_TO_VAR_INT</code>
|0060||VI||VI||colspan=6|
 
 
|-
 
|-
!SUB_FLOAT_VAR_FROM_FLOAT_VAR
+
|<code>SET_LVAR_INT_TO_LVAR_INT</code>
|0061||VF||VF||colspan=6|
 
 
|-
 
|-
!SUB_INT_LVAR_FROM_INT_LVAR
+
|<code>SET_VAR_FLOAT_TO_VAR_FLOAT</code>
|0062||LI||LI||colspan=6|
 
 
|-
 
|-
!SUB_FLOAT_LVAR_FROM_FLOAT_LVAR
+
|<code>SET_LVAR_FLOAT_TO_LVAR_FLOAT</code>
|0063||LF||LF||colspan=6|
 
 
|-
 
|-
!SUB_INT_VAR_FROM_INT_LVAR
+
|<code>SET_VAR_FLOAT_TO_LVAR_FLOAT</code>
|0064||LI||VI||colspan=6|
 
 
|-
 
|-
!SUB_FLOAT_VAR_FROM_FLOAT_LVAR
+
|<code>SET_LVAR_FLOAT_TO_VAR_FLOAT</code>
|0065||LF||VF||colspan=6|
 
 
|-
 
|-
!SUB_INT_LVAR_FROM_INT_VAR
+
|<code>SET_VAR_INT_TO_LVAR_INT</code>
|0066||VI||LI||colspan=6|
 
 
|-
 
|-
!SUB_FLOAT_LVAR_FROM_FLOAT_VAR
+
|<code>SET_LVAR_INT_TO_VAR_INT</code>
|0067||VF||LF||colspan=6|
 
 
|-
 
|-
!rowspan=12|*=<br/>*<br/>MULT_THING_BY_THING!!MULT_INT_VAR_BY_VAL
+
|<code>SET_VAR_INT_TO_CONSTANT</code>||rowspan=2 align=center|Since {{icon|vc}}
|0010
 
!rowspan=12|2
 
|VI||I||colspan=6|
 
 
|-
 
|-
!MULT_FLOAT_VAR_BY_VAL
+
|<code>SET_LVAR_INT_TO_CONSTANT</code>
|0011||VF||F||colspan=6|
 
 
|-
 
|-
!MULT_INT_LVAR_BY_VAL
+
|<code>SET_VAR_TEXT_LABEL</code>||rowspan=4 align=center|{{icon|sa}} only
|0012||LI||I||colspan=6|
 
 
|-
 
|-
!MULT_FLOAT_LVAR_BY_VAL
+
|<code>SET_LVAR_TEXT_LABEL</code>
|0013||LF||F||colspan=6|
 
 
|-
 
|-
!MULT_INT_VAR_BY_INT_VAR
+
|<code>SET_VAR_TEXT_LABEL16</code>
|0068||VI||VI||colspan=6|
 
 
|-
 
|-
!MULT_FLOAT_VAR_BY_FLOAT_VAR
+
|<code>SET_LVAR_TEXT_LABEL16</code>
|0069||VF||VF||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!MULT_INT_LVAR_BY_INT_LVAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>CSET</code> (<code>=#</code>)
|006A||LI||LI||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!MULT_FLOAT_LVAR_BY_FLOAT_LVAR
+
|rowspan=8 width=16px|
|006B||LF||LF||colspan=6|
+
|<code>CSET_VAR_INT_TO_VAR_FLOAT</code>||rowspan=8|
 
|-
 
|-
!MULT_INT_VAR_BY_INT_LVAR
+
|<code>CSET_VAR_FLOAT_TO_VAR_INT</code>
|006C||VI||LI||colspan=6|
 
 
|-
 
|-
!MULT_FLOAT_VAR_BY_FLOAT_LVAR
+
|<code>CSET_LVAR_INT_TO_VAR_FLOAT</code>
|006D||VF||LF||colspan=6|
 
 
|-
 
|-
!MULT_INT_LVAR_BY_INT_VAR
+
|<code>CSET_LVAR_FLOAT_TO_VAR_INT</code>
|006E||LI||VI||colspan=6|
 
 
|-
 
|-
!MULT_FLOAT_LVAR_BY_FLOAT_VAR
+
|<code>CSET_VAR_INT_TO_LVAR_FLOAT</code>
|006F||LF||VF||colspan=6|
 
 
|-
 
|-
!rowspan=12|/=<br/>/<br/>DIV_THING_BY_THING!!DIV_INT_BY_VAL
+
|<code>CSET_VAR_FLOAT_TO_LVAR_INT</code>
|0014
 
!rowspan=12|2
 
|VI||I||colspan=6|
 
 
|-
 
|-
!DIV_FLOAT_VAR_BY_VAL
+
|<code>CSET_LVAR_INT_TO_LVAR_FLOAT</code>
|0015||VF||F||colspan=6|
 
 
|-
 
|-
!DIV_INT_LVAR_BY_VAL
+
|<code>CSET_LVAR_FLOAT_TO_LVAR_INT</code>
|0016||LI||I||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!DIV_FLOAT_LVAR_BY_VAL
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>ADD_THING_TO_THING</code> (<code>+=</code>)
|0017||LF||F||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!DIV_INT_VAR_BY_INT_VAR
+
|rowspan=12 width=16px|
|0070||VI||VI||colspan=6|
+
|<code>ADD_VAL_TO_INT_VAR</code>||rowspan=12|
 
|-
 
|-
!DIV_FLOAT_VAR_BY_FLOAT_VAR
+
|<code>ADD_VAL_TO_FLOAT_VAR</code>
|0071||VF||VF||colspan=6|
 
 
|-
 
|-
!DIV_INT_LVAR_BY_INT_LVAR
+
|<code>ADD_VAL_TO_INT_LVAR</code>
|0072||LI||LI||colspan=6|
 
 
|-
 
|-
!DIV_FLOAT_LVAR_BY_FLOAT_LVAR
+
|<code>ADD_VAL_TO_FLOAT_LVAR</code>
|0073||LF||LF||colspan=6|
 
 
|-
 
|-
!DIV_INT_VAR_BY_INT_LVAR
+
|<code>ADD_INT_VAR_TO_INT_VAR</code>
|0074||VI||LI||colspan=6|
 
 
|-
 
|-
!DIV_FLOAT_VAR_BY_FLOAT_LVAR
+
|<code>ADD_FLOAT_VAR_TO_FLOAT_VAR</code>
|0075||VF||LF||colspan=6|
 
 
|-
 
|-
!DIV_INT_LVAR_BY_INT_VAR
+
|<code>ADD_INT_LVAR_TO_INT_LVAR</code>
|0076||LI||VI||colspan=6|
 
 
|-
 
|-
!DIV_FLOAT_LVAR_BY_FLOAT_VAR
+
|<code>ADD_FLOAT_LVAR_TO_FLOAT_LVAR</code>
|0077||LF||VF||colspan=6|
 
 
|-
 
|-
!rowspan=16|><br/>IS_THING_GREATER_THAN_THING!!IS_INT_VAR_GREATER_THAN_NUMBER
+
|<code>ADD_INT_VAR_TO_INT_LVAR</code>
|0018
 
!rowspan=16|2
 
|VI||I||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_GREATER_THAN_NUMBER
+
|<code>ADD_FLOAT_VAR_TO_FLOAT_LVAR</code>
|0019||LI||I||colspan=6|
 
 
|-
 
|-
!IS_NUMBER_GREATER_THAN_INT_VAR
+
|<code>ADD_INT_LVAR_TO_INT_VAR</code>
|001A||I||VI||colspan=6|
 
 
|-
 
|-
!IS_NUMBER_GREATER_THAN_INT_LVAR
+
|<code>ADD_FLOAT_LVAR_TO_FLOAT_VAR</code>
|001B||I||LI||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!IS_INT_VAR_GREATER_THAN_INT_VAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>SUB_THING_FROM_THING</code> (<code>-=</code>)
|001C||VI||VI||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!IS_INT_LVAR_GREATER_THAN_INT_LVAR
+
|rowspan=12 width=16px|
|001D||LI||LI||colspan=6|
+
|<code>SUB_VAL_FROM_INT_VAR</code>||rowspan=12|
 
|-
 
|-
!IS_INT_VAR_GREATER_THAN_INT_LVAR
+
|<code>SUB_VAL_FROM_FLOAT_VAR</code>
|001E||VI||LI||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_GREATER_THAN_INT_VAR
+
|<code>SUB_VAL_FROM_INT_LVAR</code>
|001F||LI||VI||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_GREATER_THAN_NUMBER
+
|<code>SUB_VAL_FROM_FLOAT_LVAR</code>
|0020||VF||F||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_GREATER_THAN_NUMBER
+
|<code>SUB_INT_VAR_FROM_INT_VAR</code>
|0021||LF||F||colspan=6|
 
 
|-
 
|-
!IS_NUMBER_GREATER_THAN_FLOAT_VAR
+
|<code>SUB_FLOAT_VAR_FROM_FLOAT_VAR</code>
|0022||F||VF||colspan=6|
 
 
|-
 
|-
!IS_NUMBER_GREATER_THAN_FLOAT_LVAR
+
|<code>SUB_INT_LVAR_FROM_INT_LVAR</code>
|0023||F||LF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR
+
|<code>SUB_FLOAT_LVAR_FROM_FLOAT_LVAR</code>
|0024||VF||VF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_GREATER_THAN_FLOAT_LVAR
+
|<code>SUB_INT_VAR_FROM_INT_LVAR</code>
|0025||LF||LF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_GREATER_THAN_FLOAT_LVAR
+
|<code>SUB_FLOAT_VAR_FROM_FLOAT_LVAR</code>
|0026||VF||LF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_GREATER_THAN_FLOAT_VAR
+
|<code>SUB_INT_LVAR_FROM_INT_VAR</code>
|0027||LF||VF||colspan=6|
 
 
|-
 
|-
!rowspan=16|>=<br/>IS_THING_GREATER_OR_EQUAL_TO_THING!!IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER
+
|<code>SUB_FLOAT_LVAR_FROM_FLOAT_VAR</code>
|0028
+
|}
!rowspan=16|2
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|VI||I||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>MULT_THING_BY_THING</code> (<code>*=</code>)
|0029||LI||I||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR
+
|rowspan=12 width=16px|
|002A||I||VI||colspan=6|
+
|<code>MULT_INT_VAR_BY_VAL</code>||rowspan=12|
 
|-
 
|-
!IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR
+
|<code>MULT_FLOAT_VAR_BY_VAL</code>
|002B||I||LI||colspan=6|
 
 
|-
 
|-
!IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR
+
|<code>MULT_INT_LVAR_BY_VAL</code>
|002C||VI||VI||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_LVAR
+
|<code>MULT_FLOAT_LVAR_BY_VAL</code>
|002D||LI||LI||colspan=6|
 
 
|-
 
|-
!IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_LVAR
+
|<code>MULT_INT_VAR_BY_INT_VAR</code>
|002E||VI||LI||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_VAR
+
|<code>MULT_FLOAT_VAR_BY_FLOAT_VAR</code>
|002F||LI||VI||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_NUMBER
+
|<code>MULT_INT_LVAR_BY_INT_LVAR</code>
|0030||VF||F||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_NUMBER
+
|<code>MULT_FLOAT_LVAR_BY_FLOAT_LVAR</code>
|0031||LF||F||colspan=6|
 
 
|-
 
|-
!IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR
+
|<code>MULT_INT_VAR_BY_INT_LVAR</code>
|0032||F||VF||colspan=6|
 
 
|-
 
|-
!IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_LVAR
+
|<code>MULT_FLOAT_VAR_BY_FLOAT_LVAR</code>
|0033||F||LF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR
+
|<code>MULT_INT_LVAR_BY_INT_VAR</code>
|0034||VF||VF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR
+
|<code>MULT_FLOAT_LVAR_BY_FLOAT_VAR</code>
|0035||LF||LF||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>DIV_THING_BY_THING</code> (<code>/=</code>)
|0036||VF||LF||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_VAR
+
|rowspan=12 width=16px|
|0037||LF||VF||colspan=6|
+
|<code>DIV_INT_VAR_BY_VAL</code>||rowspan=12|
 
|-
 
|-
!rowspan=10|=<br/>IS_THING_EQUAL_TO_THING!!IS_INT_VAR_EQUAL_TO_NUMBER
+
|<code>DIV_FLOAT_VAR_BY_VAL</code>
|0038
 
!rowspan=10|2
 
|VI||I||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_EQUAL_TO_NUMBER
+
|<code>DIV_INT_LVAR_BY_VAL</code>
|0039||LI||I||colspan=6|
 
 
|-
 
|-
!IS_INT_VAR_EQUAL_TO_INT_VAR
+
|<code>DIV_FLOAT_LVAR_BY_VAL</code>
|003A||VI||VI||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_EQUAL_TO_INT_LVAR
+
|<code>DIV_INT_VAR_BY_INT_VAR</code>
|003B||LI||LI||colspan=6|
 
 
|-
 
|-
!IS_INT_VAR_EQUAL_TO_INT_LVAR
+
|<code>DIV_FLOAT_VAR_BY_FLOAT_VAR</code>
|003C||VI||LI||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_EQUAL_TO_NUMBER
+
|<code>DIV_INT_LVAR_BY_INT_LVAR</code>
|0042||VF||F||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_EQUAL_TO_NUMBER
+
|<code>DIV_FLOAT_LVAR_BY_FLOAT_LVAR</code>
|0043||LF||F||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR
+
|<code>DIV_INT_VAR_BY_INT_LVAR</code>
|0044||VF||VF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_EQUAL_TO_FLOAT_LVAR
+
|<code>DIV_FLOAT_VAR_BY_FLOAT_LVAR</code>
|0045||LF||LF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_EQUAL_TO_FLOAT_LVAR
+
|<code>DIV_INT_LVAR_BY_INT_VAR</code>
|0046||VF||LF||colspan=6|
 
 
|-
 
|-
!rowspan=10|NOT =<br/>IS_THING_NOT_EQUAL_TO_THING!!IS_INT_VAR_NOT_EQUAL_TO_NUMBER
+
|<code>DIV_FLOAT_LVAR_BY_FLOAT_VAR</code>
|003D
+
|}
!rowspan=10|2
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|VI||I||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_NOT_EQUAL_TO_NUMBER
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>IS_THING_EQUAL_TO_THING</code> (<code>=</code>)
|003E||LI||I||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!IS_INT_VAR_NOT_EQUAL_TO_INT_VAR
+
|rowspan=18 width=16px|
|003F||VI||VI||colspan=6|
+
|<code>IS_INT_VAR_EQUAL_TO_NUMBER</code>||rowspan=5|
 
|-
 
|-
!IS_INT_LVAR_NOT_EQUAL_TO_INT_LVAR
+
|<code>IS_INT_LVAR_EQUAL_TO_NUMBER</code>
|0040||LI||LI||colspan=6|
 
 
|-
 
|-
!IS_INT_VAR_NOT_EQUAL_TO_INT_LVAR
+
|<code>IS_INT_VAR_EQUAL_TO_INT_VAR</code>
|0041||VI||LI||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_NOT_EQUAL_TO_NUMBER
+
|<code>IS_INT_LVAR_EQUAL_TO_INT_LVAR</code>
|0047||VF||F||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_NOT_EQUAL_TO_NUMBER
+
|<code>IS_INT_VAR_EQUAL_TO_INT_LVAR</code>
|0048||LF||F||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_VAR
+
|<code>IS_INT_LVAR_EQUAL_TO_INT_VAR</code>||align=center|{{icon|sa}} only
|0049||VF||VF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR
+
|<code>IS_FLOAT_VAR_EQUAL_TO_NUMBER</code>||rowspan=5|
|004A||LF||LF||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR
+
|<code>IS_FLOAT_LVAR_EQUAL_TO_NUMBER</code>
|004B||VF||LF||colspan=6|
 
 
|-
 
|-
!colspan=2|GOTO_IF_FALSE{{ref|statem|[*]}}
+
|<code>IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR</code>
|004D
 
!1
 
|O||colspan=7|
 
 
|-
 
|-
!colspan=2|TERMINATE_THIS_SCRIPT
+
|<code>IS_FLOAT_LVAR_EQUAL_TO_FLOAT_LVAR</code>
|rowspan=2|004E
 
!rowspan=2|0
 
|rowspan=2 colspan=8|
 
 
|-
 
|-
!colspan=2|MISSION_END
+
|<code>IS_FLOAT_VAR_EQUAL_TO_FLOAT_LVAR</code>
 
|-
 
|-
!colspan=2|START_NEW_SCRIPT{{ref|undarg|[*]}}
+
|<code>IS_FLOAT_LVAR_EQUAL_TO_FLOAT_VAR</code>||align=center|{{icon|sa}} only
|004F
 
!1+l
 
|O||colspan=7|*T
 
 
|-
 
|-
!colspan=2|GOSUB
+
|<code>IS_INT_VAR_EQUAL_TO_CONSTANT</code>||rowspan=2 align=center|Since {{icon|vc}}
|0050
 
!1
 
|O||colspan=7|
 
 
|-
 
|-
!colspan=2|RETURN
+
|<code>IS_INT_LVAR_EQUAL_TO_CONSTANT</code>
|0051
 
!0
 
|colspan=8|
 
 
|-
 
|-
!rowspan=6|+=@<br/>+@<br/>ADD_THING_TO_THING_TIMED!!ADD_TIMED_VAL_TO_FLOAT_VAR
+
|<code>IS_VAR_TEXT_LABEL_EQUAL_TO_TEXT_LABEL</code>||rowspan=4 align=center|{{icon|sa}} only
|0078
 
!rowspan=6|2
 
|VF||F||colspan=6|
 
 
|-
 
|-
!ADD_TIMED_VAL_TO_FLOAT_LVAR
+
|<code>IS_LVAR_TEXT_LABEL_EQUAL_TO_TEXT_LABEL</code>
|0079||LF||F||colspan=6|
 
 
|-
 
|-
!ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR
+
|<code>IS_VAR_TEXT_LABEL16_EQUAL_TO_TEXT_LABEL</code>
|007A||VF||VF||colspan=6|
 
 
|-
 
|-
!ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR
+
|<code>IS_LVAR_TEXT_LABEL16_EQUAL_TO_TEXT_LABEL</code>
|007B||LF||LF||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>IS_THING_NOT_EQUAL_TO_THING</code> (<code><></code>)
|007C||LF||VF||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR
+
|rowspan=12 width=16px|
|007D||VF||LF||colspan=6|
+
|<code>IS_INT_VAR_NOT_EQUAL_TO_NUMBER</code>||rowspan=5|
 
|-
 
|-
!rowspan=6|-=@<br/>-@<br/>SUB_THING_FROM_THING_TIMED!!SUB_TIMED_VAL_FROM_FLOAT_VAR
+
|<code>IS_INT_LVAR_NOT_EQUAL_TO_NUMBER</code>
|007E
 
!rowspan=6|2
 
|VF||F||colspan=6|
 
 
|-
 
|-
!SUB_TIMED_VAL_FROM_FLOAT_LVAR
+
|<code>IS_INT_VAR_NOT_EQUAL_TO_INT_VAR</code>
|007F||LF||F||colspan=6|
 
 
|-
 
|-
!SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR
+
|<code>IS_INT_LVAR_NOT_EQUAL_TO_INT_LVAR</code>
|0080||VF||VF||colspan=6|
 
 
|-
 
|-
!SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_LVAR
+
|<code>IS_INT_VAR_NOT_EQUAL_TO_INT_LVAR</code>
|0081||LF||LF||colspan=6|
 
 
|-
 
|-
!SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR
+
|<code>IS_INT_LVAR_NOT_EQUAL_TO_INT_VAR</code>||align=center|{{icon|sa}} only
|0082||LF||VF||colspan=6|
 
 
|-
 
|-
!SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR
+
|<code>IS_FLOAT_VAR_NOT_EQUAL_TO_NUMBER</code>||rowspan=5|
|0083||VF||LF||colspan=6|
 
 
|-
 
|-
!rowspan=8|=#<br/>CSET<br/>!!CSET_VAR_INT_TO_VAR_FLOAT
+
|<code>IS_FLOAT_LVAR_NOT_EQUAL_TO_NUMBER</code>
|008C
 
!rowspan=8|2
 
|VI||VF||colspan=6|
 
 
|-
 
|-
!CSET_VAR_FLOAT_TO_VAR_INT
+
|<code>IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_VAR</code>
|008D||VF||VI||colspan=6|
 
 
|-
 
|-
!CSET_LVAR_INT_TO_VAR_FLOAT
+
|<code>IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR</code>
|008E||LI||VF||colspan=6|
 
 
|-
 
|-
!CSET_LVAR_FLOAT_TO_VAR_INT
+
|<code>IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR</code>
|008F||LF||VI||colspan=6|
 
 
|-
 
|-
!CSET_VAR_INT_TO_LVAR_FLOAT
+
|<code>IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_VAR</code>||align=center|{{icon|sa}} only
|0090||VI||LF||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!CSET_VAR_FLOAT_TO_LVAR_INT
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>IS_THING_GREATER_THAN_THING</code> (<code>></code>, <code><=</code>)
|0091||VF||LI||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!CSET_LVAR_INT_TO_LVAR_FLOAT
+
|rowspan=20 width=16px|
|0092||LI||LF||colspan=6|
+
|<code>IS_INT_VAR_GREATER_THAN_NUMBER</code>||rowspan=16|
 
|-
 
|-
!CSET_LVAR_FLOAT_TO_LVAR_INT
+
|<code>IS_INT_LVAR_GREATER_THAN_NUMBER</code>
|0093||LF||LI||colspan=6|
 
 
|-
 
|-
!rowspan=4|ABS!!ABS_VAR_INT
+
|<code>IS_NUMBER_GREATER_THAN_INT_VAR</code>
|0094
 
!rowspan=4|1
 
|VI||colspan=7|
 
 
|-
 
|-
!ABS_LVAR_INT
+
|<code>IS_NUMBER_GREATER_THAN_INT_LVAR</code>
|0095||LI||colspan=7|
 
 
|-
 
|-
!ABS_VAR_FLOAT
+
|<code>IS_INT_VAR_GREATER_THAN_INT_VAR</code>
|0096||VF||colspan=7|
 
 
|-
 
|-
!ABS_LVAR_FLOAT
+
|<code>IS_INT_LVAR_GREATER_THAN_INT_LVAR</code>
|0097||LF||colspan=7|
 
 
|-
 
|-
!colspan=2|VAR_INT{{ref|defvar|[*]}}
+
|<code>IS_INT_VAR_GREATER_THAN_INT_LVAR</code>
|00C7
 
!n
 
|colspan=8|@VI
 
 
|-
 
|-
!colspan=2|VAR_FLOAT{{ref|defvar|[*]}}
+
|<code>IS_INT_LVAR_GREATER_THAN_INT_VAR</code>
|00C8
 
!n
 
|colspan=8|@VF
 
 
|-
 
|-
!colspan=2|LVAR_INT{{ref|defvar|[*]}}
+
|<code>IS_FLOAT_VAR_GREATER_THAN_NUMBER</code>
|00C9
 
!n
 
|colspan=8|@LI
 
 
|-
 
|-
!colspan=2|LVAR_FLOAT{{ref|defvar|[*]}}
+
|<code>IS_FLOAT_LVAR_GREATER_THAN_NUMBER</code>
|00CA
 
!n
 
|colspan=8|@LF
 
 
|-
 
|-
!colspan=2|{{{ref|embdsc|[*]}}
+
|<code>IS_NUMBER_GREATER_THAN_FLOAT_VAR</code>
|00CB
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|}{{ref|embdsc|[*]}}
+
|<code>IS_NUMBER_GREATER_THAN_FLOAT_LVAR</code>
|00CC
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|IF{{ref|statem|[*]}}
+
|<code>IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR</code>
|00CF
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|ELSE{{ref|statem|[*]}}
+
|<code>IS_FLOAT_LVAR_GREATER_THAN_FLOAT_LVAR</code>
|00D1
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|ENDIF{{ref|statem|[*]}}
+
|<code>IS_FLOAT_VAR_GREATER_THAN_FLOAT_LVAR</code>
|00D2
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|WHILE{{ref|statem|[*]}}
+
|<code>IS_FLOAT_LVAR_GREATER_THAN_FLOAT_VAR</code>
|00D3
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|ENDWHILE{{ref|statem|[*]}}
+
|<code>IS_INT_VAR_GREATER_THAN_CONSTANT</code>||rowspan=4 align=center|Since {{icon|vc}}
|00D5
 
!0
 
|colspan=8|
 
 
|-
 
|-
|colspan=12|{{icon|3}} {{icon|vc}} {{icon|sa}}
+
|<code>IS_INT_LVAR_GREATER_THAN_CONSTANT</code>
 
|-
 
|-
!colspan=2|ANDOR{{ref|statem|[*]}}
+
|<code>IS_CONSTANT_GREATER_THAN_INT_VAR</code>
|00D6
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|LAUNCH_MISSION
+
|<code>IS_CONSTANT_GREATER_THAN_INT_LVAR</code>
|00D7
+
|}
!1
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|O||colspan=7|
 
 
|-
 
|-
!colspan=2|PLAYER_MADE_PROGRESS
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>IS_THING_GREATER_OR_EQUAL_TO_THING</code> (<code>>=</code>, <code><</code>)
|030C
+
|width=64px align=center|Since {{icon|3}}
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|SET_PROGRESS_TOTAL
+
|rowspan=20 width=16px|
|030D
+
|<code>IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER</code>||rowspan=16|
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|REGISTER_MISSION_GIVEN
+
|<code>IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER</code>
|0317
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|REGISTER_MISSION_PASSED
+
|<code>IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR</code>
|0318
 
!1
 
|S8||colspan=7|
 
 
|-
 
|-
!colspan=2|SCRIPT_NAME
+
|<code>IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR</code>
|03A4
 
!1
 
|S8||colspan=7|
 
 
|-
 
|-
!colspan=2|LOAD_AND_LAUNCH_MISSION
+
|<code>IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR</code>
|0416
 
!1
 
|O||colspan=7|
 
 
|-
 
|-
!colspan=2|LOAD_AND_LAUNCH_MISSION_INTERNAL
+
|<code>IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_LVAR</code>
|0417
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|SET_TOTAL_NUMBER_OF_MISSIONS
+
|<code>IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_LVAR</code>
|042C
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|REGISTER_ODDJOB_MISSION_PASSED
+
|<code>IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_VAR</code>
|0595
 
!0
 
|colspan=8|
 
 
|-
 
|-
|colspan=12|{{icon|vc}} {{icon|sa}} {{icon|lcs}}
+
|<code>IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_NUMBER</code>
 
|-
 
|-
!colspan=2|REPEAT{{ref|statem|[*]}}
+
|<code>IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_NUMBER</code>
|00CD
 
!2
 
|I||HI||colspan=6|
 
 
|-
 
|-
!colspan=2|ENDREPEAT{{ref|statem|[*]}}
+
|<code>IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR</code>
|00CE
 
!0
 
|colspan=8|
 
 
|-
 
|-
|colspan=12|{{icon|3}} {{icon|vc}}
+
|<code>IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_LVAR</code>
 
|-
 
|-
!colspan=2|CREATE_COLLECTABLE1
+
|<code>IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR</code>
|02EC
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|SET_COLLECTABLE1_TOTAL
+
|<code>IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR</code>
|02ED
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
|colspan=12|{{icon|3}} {{icon|lcs}}
+
|<code>IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR</code>
 
|-
 
|-
!colspan=2|GOTO_IF_TRUE{{ref|statem|[*]}}
+
|<code>IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_VAR</code>
|004C
 
!1
 
|O||colspan=7|
 
 
|-
 
|-
|colspan=12|{{icon|vc}} {{icon|sa}}
+
|<code>IS_INT_VAR_GREATER_OR_EQUAL_TO_CONSTANT</code>||rowspan=4 align=center|Since {{icon|vc}}
 
|-
 
|-
!rowspan=2|=<br/>IS_THING_EQUAL_TO_THING!!IS_INT_VAR_EQUAL_TO_CONSTANT
+
|<code>IS_INT_LVAR_GREATER_OR_EQUAL_TO_CONSTANT</code>
|04A3
 
!rowspan=2|2
 
|VI||C||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_EQUAL_TO_CONSTANT
+
|<code>IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_VAR</code>
|04A4||LI||C||colspan=6|
 
 
|-
 
|-
!rowspan=2|=<br/>SET!!SET_VAR_INT_TO_CONSTANT
+
|<code>IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_LVAR</code>
|04AE
+
|}
!rowspan=2|2
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|VI||C||colspan=6|
 
 
|-
 
|-
!SET_LVAR_INT_TO_CONSTANT
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>ADD_THING_TO_THING_TIMED</code> (<code>+=@</code>)
|04AF||LI||C||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!rowspan=4|><br/>IS_THING_GREATER_THAN_THING!!IS_INT_VAR_GREATER_THAN_CONSTANT
+
|rowspan=6 width=16px|
|04B0
+
|<code>ADD_TIMED_VAL_TO_FLOAT_VAR</code>||rowspan=6|
!rowspan=4|2
 
|VI||C||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_GREATER_THAN_CONSTANT
+
|<code>ADD_TIMED_VAL_TO_FLOAT_LVAR</code>
|04B1||LI||C||colspan=6|
 
 
|-
 
|-
!IS_CONSTANT_GREATER_THAN_INT_VAR
+
|<code>ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR</code>
|04B2||C||VI||colspan=6|
 
 
|-
 
|-
!IS_CONSTANT_GREATER_THAN_INT_LVAR
+
|<code>ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR</code>
|04B3||C||LI||colspan=6|
 
 
|-
 
|-
!rowspan=4|>=<br/>IS_THING_GREATER_OR_EQUAL_TO_THING!!IS_INT_VAR_GREATER_OR_EQUAL_TO_CONSTANT
+
|<code>ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR</code>
|04B4
 
!rowspan=4|2
 
|VI||C||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_GREATER_OR_EQUAL_TO_CONSTANT
+
|<code>ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR</code>
|04B5||LI||C||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_VAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>SUB_THING_FROM_THING_TIMED</code> (<code>-=@</code>)
|04B6||C||VI||colspan=6|
+
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_LVAR
+
|rowspan=6 width=16px|
|04B7||C||LI||colspan=6|
+
|<code>SUB_TIMED_VAL_FROM_FLOAT_VAR</code>||rowspan=6|
 
|-
 
|-
!colspan=2|LOAD_AND_LAUNCH_MISSION_EXCLUSIVE
+
|<code>SUB_TIMED_VAL_FROM_FLOAT_LVAR</code>
|0515
 
!1
 
|O||colspan=7|
 
 
|-
 
|-
|colspan=12|{{icon|3}}
+
|<code>SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR</code>
 
|-
 
|-
!colspan=2|IFNOT{{ref|statem|[*]}}
+
|<code>SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_LVAR</code>
|00D0
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|WHILENOT{{ref|statem|[*]}}
+
|<code>SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR</code>
|00D4
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|GOSUB_FILE
+
|<code>SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR</code>
|02CD
+
|}
!2
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|O||O||colspan=6|
 
 
|-
 
|-
|colspan=12|{{icon|sa}}
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>ABS</code>
 +
|width=64px align=center|Since {{icon|3}}
 
|-
 
|-
!rowspan=2|=<br/>SET!!SET_VAR_TEXT_LABEL
+
|rowspan=4 width=16px|
|05A9
+
|<code>ABS_VAR_INT</code>||rowspan=4|
!rowspan=2|2
 
|VS8||*S8||colspan=6|
 
 
|-
 
|-
!SET_LVAR_TEXT_LABEL
+
|<code>ABS_LVAR_INT</code>
|05AA||LS8||*S8||colspan=6|
 
 
|-
 
|-
!colspan=2|VAR_TEXT_LABEL{{ref|defvar|[*]}}
+
|<code>ABS_VAR_FLOAT</code>
|05AB
 
!n
 
|colspan=8|@VS8
 
 
|-
 
|-
!colspan=2|LVAR_TEXT_LABEL{{ref|defvar|[*]}}
+
|<code>ABS_LVAR_FLOAT</code>
|05AC
+
|}
!n
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|colspan=8|@LS8
 
 
|-
 
|-
!rowspan=2|=<br/>IS_THING_EQUAL_TO_THING!!IS_VAR_TEXT_LABEL_EQUAL_TO_TEXT_LABEL
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>IS_EMPTY</code>
|05AD
+
|width=64px align=center|{{icon|sa}} only
!rowspan=2|2
 
|VS8||*S8||colspan=6|
 
 
|-
 
|-
!IS_LVAR_TEXT_LABEL_EQUAL_TO_TEXT_LABEL
+
|rowspan=4 width=16px|
|05AE||LS8||*S8||colspan=6|
+
|<code>IS_VAR_TEXT_LABEL_EMPTY</code>||rowspan=4|
 
|-
 
|-
!rowspan=2|=<br/>SET!!SET_VAR_TEXT_LABEL16
+
|<code>IS_LVAR_TEXT_LABEL_EMPTY</code>
|06D1
 
!rowspan=2|2
 
|VS16||*S16||colspan=6|
 
 
|-
 
|-
!SET_LVAR_TEXT_LABEL16
+
|<code>IS_VAR_TEXT_LABEL16_EMPTY</code>
|06D2||LS16||*S16||colspan=6|
 
 
|-
 
|-
!colspan=2|VAR_TEXT_LABEL16{{ref|defvar|[*]}}
+
|<code>IS_LVAR_TEXT_LABEL16_EMPTY</code>
|06D3
+
|}
!n
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|colspan=8|@VS16
 
 
|-
 
|-
!colspan=2|LVAR_TEXT_LABEL16{{ref|defvar|[*]}}
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>IS_BIT_SET</code>
|06D4
+
|width=64px align=center|{{icon|sa}} only
!n
 
|colspan=8|@LS16
 
 
|-
 
|-
!rowspan=2|=<br/>IS_THING_EQUAL_TO_THING!!IS_INT_LVAR_EQUAL_TO_INT_VAR
+
|rowspan=6 width=16px|
|07D6
+
|<code>IS_GLOBAL_VAR_BIT_SET_CONST</code>||rowspan=6|
!rowspan=2|2
 
|LI||VI||colspan=6|
 
 
|-
 
|-
!IS_FLOAT_LVAR_EQUAL_TO_FLOAT_VAR
+
|<code>IS_GLOBAL_VAR_BIT_SET_VAR</code>
|07D7||LF||VF||colspan=6|
 
 
|-
 
|-
!rowspan=4|IS_EMPTY{{ref|likely|[*]}}!!IS_VAR_TEXT_LABEL_EMPTY
+
|<code>IS_GLOBAL_VAR_BIT_SET_LVAR</code>
|0844
 
!rowspan=4|1
 
|VS8||colspan=7|
 
 
|-
 
|-
!IS_LVAR_TEXT_LABEL_EMPTY
+
|<code>IS_LOCAL_VAR_BIT_SET_CONST</code>
|0845||LS8||colspan=7|
 
 
|-
 
|-
!IS_VAR_TEXT_LABEL16_EMPTY
+
|<code>IS_LOCAL_VAR_BIT_SET_VAR</code>
|0846||VS16||colspan=7|
 
 
|-
 
|-
!IS_LVAR_TEXT_LABEL16_EMPTY
+
|<code>IS_LOCAL_VAR_BIT_SET_LVAR</code>
|0847||LS16||colspan=7|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!colspan=2|SWITCH{{ref|statem|[*]}}
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>SET_BIT</code>
|0848
+
|width=64px align=center|{{icon|sa}} only
!1
 
|HI||colspan=7|
 
 
|-
 
|-
!colspan=2|ENDSWITCH{{ref|statem|[*]}}
+
|rowspan=6 width=16px|
|0849
+
|<code>SET_GLOBAL_VAR_BIT_CONST</code>||rowspan=6|
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|CASE{{ref|statem|[*]}}
+
|<code>SET_GLOBAL_VAR_BIT_VAR</code>
|084A
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|DEFAULT{{ref|statem|[*]}}
+
|<code>SET_GLOBAL_VAR_BIT_LVAR</code>
|084B
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|BREAK{{ref|statem|[*]}}
+
|<code>SET_LOCAL_VAR_BIT_CONST</code>
|084C
 
!0
 
|colspan=8|
 
 
|-
 
|-
!rowspan=4 colspan=2|SWITCH_START{{ref|statem|[*]}}
+
|<code>SET_LOCAL_VAR_BIT_VAR</code>
|rowspan=4|0871
 
!rowspan=4|18
 
|rowspan=2|VI
 
|rowspan=2|I
 
|rowspan=2|I
 
|rowspan=2|O
 
|colspan=2|I||colspan=2|
 
 
|-
 
|-
|colspan=2|O||colspan=2|
+
|<code>SET_LOCAL_VAR_BIT_LVAR</code>
 +
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
|rowspan=2|LI
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>CLEAR_BIT</code>
|rowspan=2|I
+
|width=64px align=center|{{icon|sa}} only
|rowspan=2|I
 
|rowspan=2|O
 
|colspan=2|I||colspan=2|
 
 
|-
 
|-
|colspan=2|O||colspan=2|
+
|rowspan=6 width=16px|
 +
|<code>CLEAR_GLOBAL_VAR_BIT_CONST</code>||rowspan=6|
 
|-
 
|-
!rowspan=2 colspan=2|SWITCH_CONTINUED{{ref|statem|[*]}}
+
|<code>CLEAR_GLOBAL_VAR_BIT_VAR</code>
|rowspan=2|0872
 
!rowspan=2|18
 
|colspan=6|I
 
|colspan=2|
 
 
|-
 
|-
|colspan=6|O
+
|<code>CLEAR_GLOBAL_VAR_BIT_LVAR</code>
|colspan=2|
 
 
|-
 
|-
!rowspan=6|IS_BIT_SET{{ref|likely|[*]}}!!IS_GLOBAL_VAR_BIT_SET_CONST
+
|<code>CLEAR_LOCAL_VAR_BIT_CONST</code>
|08B4
 
!rowspan=6|2
 
|VI||C||colspan=6|
 
 
|-
 
|-
!IS_GLOBAL_VAR_BIT_SET_VAR
+
|<code>CLEAR_LOCAL_VAR_BIT_VAR</code>
|08B5||VI||VI||colspan=6|
 
 
|-
 
|-
!IS_GLOBAL_VAR_BIT_SET_LVAR
+
|<code>CLEAR_LOCAL_VAR_BIT_LVAR</code>
|08B6||VI||LI||colspan=6|
+
|}
 +
</div>
 +
|valign=top|<div style="overflow: auto; float: left" width=auto>
 +
{|class=wikitable style="margin-bottom: 0" width=100%
 
|-
 
|-
!IS_LOCAL_VAR_BIT_SET_CONST
+
!colspan=2 width=420px style="text-align: left"|Command
|08B7||LI||C||colspan=6|
 
 
|-
 
|-
!IS_LOCAL_VAR_BIT_SET_VAR
+
!width=16px|
|08B8||LI||VI||colspan=6|
+
!style="text-align: left"|Alternative
 +
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!IS_LOCAL_VAR_BIT_SET_LVAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>SET</code> (<code>=</code>)
|08B9||LI||LI||colspan=6|
 
 
|-
 
|-
!rowspan=6|SET_BIT{{ref|likely|[*]}}!!SET_GLOBAL_VAR_BIT_CONST
+
|rowspan=7 width=16px|
|08BA
+
|<code>SET_VAR_INT</code>
!rowspan=6|2
 
|VI||C||colspan=6|
 
 
|-
 
|-
!SET_GLOBAL_VAR_BIT_VAR
+
|<code>SET_VAR_FLOAT</code>
|08BB||VI||VI||colspan=6|
 
 
|-
 
|-
!SET_GLOBAL_VAR_BIT_LVAR
+
|<code>SET_VAR_TEXT_LABEL</code>
|08BC||VI||LI||colspan=6|
 
 
|-
 
|-
!SET_LOCAL_VAR_BIT_CONST
+
|<code>SET_VAR_INT_TO_VAR_INT</code>
|08BD||LI||C||colspan=6|
 
 
|-
 
|-
!SET_LOCAL_VAR_BIT_VAR
+
|<code>SET_VAR_FLOAT_TO_VAR_FLOAT</code>
|08BE||LI||VI||colspan=6|
 
 
|-
 
|-
!SET_LOCAL_VAR_BIT_LVAR
+
|<code>SET_VAR_TEXT_LABEL_TO_VAR_TEXT_LABEL</code>
|08BF||LI||LI||colspan=6|
 
 
|-
 
|-
!rowspan=6|CLEAR_BIT{{ref|likely|[*]}}!!CLEAR_GLOBAL_VAR_BIT_CONST
+
|<code>SET_VAR_INT_TO_CONSTANT</code>
|08C0
+
|}
!rowspan=6|2
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|VI||C||colspan=6|
 
 
|-
 
|-
!CLEAR_GLOBAL_VAR_BIT_VAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>CSET</code> (<code>=#</code>)
|08C1||VI||VI||colspan=6|
 
 
|-
 
|-
!CLEAR_GLOBAL_VAR_BIT_LVAR
+
|rowspan=2 width=16px|
|08C2||VI||LI||colspan=6|
+
|<code>CSET_VAR_INT_TO_VAR_FLOAT</code>
 
|-
 
|-
!CLEAR_LOCAL_VAR_BIT_CONST
+
|<code>CSET_VAR_FLOAT_TO_VAR_INT</code>
|08C3||LI||C||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!CLEAR_LOCAL_VAR_BIT_VAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>ADD_THING_TO_THING</code> (<code>+=</code>)
|08C4||LI||VI||colspan=6|
 
 
|-
 
|-
!CLEAR_LOCAL_VAR_BIT_LVAR
+
|rowspan=4 width=16px|
|08C5||LI||LI||colspan=6|
+
|<code>ADD_VAL_TO_INT_VAR</code>
 
|-
 
|-
!rowspan=2|=<br/>IS_THING_EQUAL_TO_THING!!IS_VAR_TEXT_LABEL16_EQUAL_TO_TEXT_LABEL
+
|<code>ADD_VAL_TO_FLOAT_VAR</code>
|08F9
 
!rowspan=2|2
 
|VS16||*S16||colspan=6|
 
 
|-
 
|-
!IS_LVAR_TEXT_LABEL16_EQUAL_TO_TEXT_LABEL
+
|<code>ADD_INT_VAR_TO_INT_VAR</code>
|08FA||LS16||*S16||colspan=6|
 
 
|-
 
|-
!rowspan=2|STRING_CAT{{ref|likely|[*]}}!!STRING_CAT16
+
|<code>ADD_FLOAT_VAR_TO_FLOAT_VAR</code>
|098B
+
|}
!rowspan=2|3
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|VS16||VS16||VS16||colspan=5|
 
 
|-
 
|-
!STRING_CAT8
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>SUB_THING_FROM_THING</code> (<code>-=</code>)
|098C||VS8||VS8||VS8||colspan=5|
 
 
|-
 
|-
|colspan=12|{{icon|lcs}}
+
|rowspan=4 width=16px|
 +
|<code>SUB_VAL_FROM_INT_VAR</code>
 
|-
 
|-
!colspan=2|RETURN_TRUE
+
|<code>SUB_VAL_FROM_FLOAT_VAR</code>
|00C5
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|RETURN_FALSE
+
|<code>SUB_INT_VAR_FROM_INT_VAR</code>
|00C6
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|SWITCH{{ref|statem|[*]}}{{ref|posngs|[*]}}
+
|<code>SUB_FLOAT_VAR_FROM_FLOAT_VAR</code>
|00D6
+
|}
!1
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|HI||colspan=7|
 
 
|-
 
|-
!colspan=2|ENDSWITCH{{ref|statem|[*]}}{{ref|posngs|[*]}}
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>MULT_THING_BY_THING</code> (<code>*=</code>)
|00D7
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|CASE{{ref|statem|[*]}}{{ref|posngs|[*]}}
+
|rowspan=4 width=16px|
|00D8
+
|<code>MULT_INT_VAR_BY_VAL</code>
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|DEFAULT{{ref|statem|[*]}}{{ref|posngs|[*]}}
+
|<code>MULT_FLOAT_VAR_BY_VAL</code>
|00D9
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|BREAK{{ref|statem|[*]}}{{ref|posngs|[*]}}
+
|<code>MULT_INT_VAR_BY_INT_VAR</code>
|00DA
 
!0
 
|colspan=8|
 
 
|-
 
|-
!colspan=2|ANDOR{{ref|statem|[*]}}
+
|<code>MULT_FLOAT_VAR_BY_FLOAT_VAR</code>
|00DB
+
|}
!1
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|LAUNCH_MISSION
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>DIV_THING_BY_THING</code> (<code>/=</code>)
|00DC
 
!1
 
|O||colspan=7|
 
 
|-
 
|-
!colspan=2|GOSUB_FILE
+
|rowspan=4 width=16px|
|02D2
+
|<code>DIV_INT_VAR_BY_VAL</code>
!2
 
|O||O||colspan=6|
 
 
|-
 
|-
!colspan=2|PLAYER_MADE_PROGRESS
+
|<code>DIV_FLOAT_VAR_BY_VAL</code>
|0311
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|SET_PROGRESS_TOTAL
+
|<code>DIV_INT_VAR_BY_INT_VAR</code>
|0312
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|REGISTER_MISSION_GIVEN
+
|<code>DIV_FLOAT_VAR_BY_FLOAT_VAR</code>
|031C
+
|}
!0
+
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
|colspan=8|
 
 
|-
 
|-
!colspan=2|REGISTER_MISSION_PASSED
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>IS_THING_EQUAL_TO_THING</code> (<code>=</code>)
|031D
 
!1
 
|S8||colspan=7|
 
 
|-
 
|-
!colspan=2|SCRIPT_NAME
+
|rowspan=7 width=16px|
|03A9
+
|<code>IS_INT_VAR_EQUAL_TO_NUMBER</code>
!1
 
|S8||colspan=7|
 
 
|-
 
|-
!colspan=2|LOAD_AND_LAUNCH_MISSION
+
|<code>IS_INT_VAR_EQUAL_TO_INT_VAR</code>
|041B
 
!1
 
|O||colspan=7|
 
 
|-
 
|-
!colspan=2|LOAD_AND_LAUNCH_MISSION_INTERNAL
+
|<code>IS_FLOAT_VAR_EQUAL_TO_NUMBER</code>
|041C
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|SET_TOTAL_NUMBER_OF_MISSIONS
+
|<code>IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR</code>
|0431
 
!1
 
|I||colspan=7|
 
 
|-
 
|-
!colspan=2|REGISTER_ODDJOB_MISSION_PASSED
+
|<code>IS_TEXT_LABEL_VAR_EQUAL_TO_TEXT_LABEL</code>
|059A
 
!0
 
|colspan=8|
 
 
|-
 
|-
!rowspan=2|=<br/>IS_THING_EQUAL_TO_THING!!IS_INT_VAR_EQUAL_TO_CONSTANT
+
|<code>IS_TEXT_LABEL_VAR_EQUAL_TO_TEXT_LABEL_VAR</code>
|04A8
 
!rowspan=2|2
 
|VI||C||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_EQUAL_TO_CONSTANT
+
|<code>IS_INT_VAR_EQUAL_TO_CONSTANT</code>
|04A9||LI||C||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!rowspan=2|=<br/>SET!!SET_VAR_INT_TO_CONSTANT
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>IS_THING_GREATER_THAN_THING</code> (<code>></code>, <code><=</code>)
|04B3
 
!rowspan=2|2
 
|VI||C||colspan=6|
 
 
|-
 
|-
!SET_LVAR_INT_TO_CONSTANT
+
|rowspan=8 width=16px|
|04B4||LI||C||colspan=6|
+
|<code>IS_INT_VAR_GREATER_THAN_NUMBER</code>
 
|-
 
|-
!rowspan=4|><br/>IS_THING_GREATER_THAN_THING!!IS_INT_VAR_GREATER_THAN_CONSTANT
+
|<code>IS_NUMBER_GREATER_THAN_INT_VAR</code>
|04B5
 
!rowspan=4|2
 
|VI||C||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_GREATER_THAN_CONSTANT
+
|<code>IS_INT_VAR_GREATER_THAN_INT_VAR</code>
|04B6||LI||C||colspan=6|
 
 
|-
 
|-
!IS_CONSTANT_GREATER_THAN_INT_VAR
+
|<code>IS_FLOAT_VAR_GREATER_THAN_NUMBER</code>
|04B7||C||VI||colspan=6|
 
 
|-
 
|-
!IS_CONSTANT_GREATER_THAN_INT_LVAR
+
|<code>IS_NUMBER_GREATER_THAN_FLOAT_VAR</code>
|04B8||C||LI||colspan=6|
 
 
|-
 
|-
!rowspan=4|>=<br/>IS_THING_GREATER_OR_EQUAL_TO_THING!!IS_INT_VAR_GREATER_OR_EQUAL_TO_CONSTANT
+
|<code>IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR</code>
|04B9
 
!rowspan=4|2
 
|VI||C||colspan=6|
 
 
|-
 
|-
!IS_INT_LVAR_GREATER_OR_EQUAL_TO_CONSTANT
+
|<code>IS_INT_VAR_GREATER_THAN_CONSTANT</code>
|04BA||LI||C||colspan=6|
 
 
|-
 
|-
!IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_VAR
+
|<code>IS_CONSTANT_GREATER_THAN_INT_VAR</code>
|04BB||C||VI||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_LVAR
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>IS_THING_GREATER_OR_EQUAL_TO_THING</code> (<code>>=</code>, <code><</code>)
|04BC||C||LI||colspan=6|
 
 
|-
 
|-
!rowspan=2 colspan=2|CALL{{ref|undarg|[*]}}{{ref|argvar|[*]}}{{ref|likely|[*]}}
+
|rowspan=8 width=16px|
|rowspan=2|05AE
+
|<code>IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER</code>
!rowspan=2|1+i+o
 
|rowspan=2|O
 
|colspan=7|*T
 
 
|-
 
|-
|colspan=7|HT
+
|<code>IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR</code>
 
|-
 
|-
!rowspan=2 colspan=2|CALLNOT{{ref|undarg|[*]}}{{ref|argvar|[*]}}{{ref|likely|[*]}}
+
|<code>IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR</code>
|rowspan=2|05AF
 
!rowspan=2|1+i+o
 
|rowspan=2|O
 
|colspan=7|*T
 
 
|-
 
|-
|colspan=7|HT
+
|<code>IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_NUMBER</code>
 
|-
 
|-
|colspan=12|{{icon|vcs}}
+
|<code>IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR</code>
 
|-
 
|-
!rowspan=7|=<br/>SET!!SET_INT{{ref|likely|[*]}}
+
|<code>IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR</code>
|0004
 
!rowspan=7|2
 
|HI||I||colspan=6|
 
 
|-
 
|-
!SET_FLOAT{{ref|likely|[*]}}
+
|<code>IS_INT_VAR_GREATER_OR_EQUAL_TO_CONSTANT</code>
|0005||HF||F||colspan=6|
 
 
|-
 
|-
!SET_TEXT_LABEL{{ref|likely|[*]}}
+
|<code>IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_VAR</code>
|0006||HS8||S8||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!SET_INT_TO_INT{{ref|likely|[*]}}
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>ADD_THING_TO_THING_TIMED</code> (<code>+=@</code>)
|0035||HI||HI||colspan=6|
 
 
|-
 
|-
!SET_FLOAT_TO_FLOAT{{ref|likely|[*]}}
+
|rowspan=2 width=16px|
|0036||HF||HF||colspan=6|
+
|<code>ADD_TIMED_VAL_TO_FLOAT_VAR</code>
 
|-
 
|-
!SET_TEXT_LABEL_TO_TEXT_LABEL{{ref|likely|[*]}}
+
|<code>ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR</code>
|0037||HS8||HS8||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!SET_INT_TO_CONSTANT{{ref|likely|[*]}}
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>SUB_THING_FROM_THING_TIMED</code> (<code>-=@</code>)
|02E2|HI||C||colspan=6|
 
 
|-
 
|-
!rowspan=4|+=<br/>+<br/>ADD_THING_TO_THING!!ADD_VAL_TO_INT{{ref|likely|[*]}}
+
|rowspan=2 width=16px|
|0007
+
|<code>SUB_TIMED_VAL_FROM_FLOAT_VAR</code>
!rowspan=4|2
 
|HI||I||colspan=6|
 
 
|-
 
|-
!ADD_VAL_TO_FLOAT{{ref|likely|[*]}}
+
|<code>SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR</code>
|0008||HF||F||colspan=6|
+
|}
 +
{|class="wikitable mw-collapsible mw-collapsed" style="margin: -1px auto 0" width=100%
 
|-
 
|-
!ADD_INT_TO_INT{{ref|likely|[*]}}
+
!colspan=2 style="background-color: inherit; text-align: left; font-weight: normal"|<code>ABS</code>
|0029||HI||HI||colspan=6|
 
 
|-
 
|-
!ADD_FLOAT_TO_FLOAT{{ref|likely|[*]}}
+
|rowspan=2 width=16px|
|002A||HF||HF||colspan=6|
+
|<code>ABS_VAR_INT</code>
 
|-
 
|-
!rowspan=4|-=<br/>-<br/>SUB_THING_FROM_THING!!SUB_VAL_FROM_INT{{ref|likely|[*]}}
+
|<code>ABS_VAR_FLOAT</code>
|0009
+
|}
!rowspan=4|2
+
</div>
|HI||I||colspan=6|
 
|-
 
!SUB_VAL_FROM_FLOAT{{ref|likely|[*]}}
 
|000A||HF||F||colspan=6|
 
|-
 
!SUB_INT_FROM_INT{{ref|likely|[*]}}
 
|002B||HI||HI||colspan=6|
 
|-
 
!SUB_FLOAT_FROM_FLOAT{{ref|likely|[*]}}
 
|002C||HF||HF||colspan=6|
 
|-
 
!rowspan=4|*=<br/>*<br/>MULT_THING_BY_THING!!MULT_INT_BY_VAL{{ref|likely|[*]}}
 
|000B
 
!rowspan=4|2
 
|HI||I||colspan=6|
 
|-
 
!MULT_FLOAT_BY_VAL{{ref|likely|[*]}}
 
|000C||HF||F||colspan=6|
 
|-
 
!MULT_INT_BY_INT{{ref|likely|[*]}}
 
|002D||HI||HI||colspan=6|
 
|-
 
!|MULT_FLOAT_BY_FLOAT{{ref|likely|[*]}}
 
|002E||HF||HF||colspan=6|
 
|-
 
!rowspan=4|/=<br/>/<br/>DIV_THING_BY_THING!!DIV_INT_BY_VAL{{ref|likely|[*]}}
 
|000D
 
!rowspan=4|2
 
|HI||I||colspan=6|
 
|-
 
!DIV_FLOAT_BY_VAL{{ref|likely|[*]}}
 
|000E||HF||F||colspan=6|
 
|-
 
!DIV_INT_BY_INT{{ref|likely|[*]}}
 
|002F||HI||HI||colspan=6|
 
|-
 
!DIV_FLOAT_BY_FLOAT{{ref|likely|[*]}}
 
|0030||HF||HF||colspan=6|
 
|-
 
!rowspan=8|><br/>IS_THING_GREATER_THAN_THING!!IS_INT_GREATER_THAN_NUMBER{{ref|likely|[*]}}
 
|000F
 
!rowspan=8|2
 
|HI||I||colspan=6|
 
|-
 
!IS_NUMBER_GREATER_THAN_INT{{ref|likely|[*]}}
 
|0010||I||HI||colspan=6|
 
|-
 
!IS_INT_GREATER_THAN_INT{{ref|likely|[*]}}
 
|0011||HI||HI||colspan=6|
 
|-
 
!IS_FLOAT_GREATER_THAN_NUMBER{{ref|likely|[*]}}
 
|0012||HF||F||colspan=6|
 
|-
 
!IS_NUMBER_GREATER_THAN_FLOAT{{ref|likely|[*]}}
 
|0013||F||HF||colspan=6|
 
|-
 
!IS_FLOAT_GREATER_THAN_FLOAT{{ref|likely|[*]}}
 
|0014||HF||HF||colspan=6|
 
|-
 
!IS_INT_GREATER_THAN_CONSTANT{{ref|likely|[*]}}
 
|02E3||HI||C||colspan=6|
 
|-
 
!IS_CONSTANT_GREATER_THAN_INT{{ref|likely|[*]}}
 
|02E4||C||HI||colspan=6|
 
|-
 
!rowspan=8|>=<br/>IS_THING_GREATER_OR_EQUAL_TO_THING!!IS_INT_GREATER_OR_EQUAL_TO_NUMBER{{ref|likely|[*]}}
 
|0015
 
!rowspan=8|2
 
|HI||I||colspan=6|
 
|-
 
!IS_NUMBER_GREATER_OR_EQUAL_TO_INT{{ref|likely|[*]}}
 
|0016||I||HI||colspan=6|
 
|-
 
!IS_INT_GREATER_OR_EQUAL_TO_INT{{ref|likely|[*]}}
 
|0017||HI||HI||colspan=6|
 
|-
 
!IS_FLOAT_GREATER_OR_EQUAL_TO_NUMBER{{ref|likely|[*]}}
 
|0018||HF||F||colspan=6|
 
|-
 
!IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT{{ref|likely|[*]}}
 
|0019||F||HF||colspan=6|
 
|-
 
!IS_FLOAT_GREATER_OR_EQUAL_TO_FLOAT{{ref|likely|[*]}}
 
|001A||HF||HF||colspan=6|
 
|-
 
!IS_INT_GREATER_OR_EQUAL_TO_CONSTANT{{ref|likely|[*]}}
 
|02E5||HI||C||colspan=6|
 
|-
 
!IS_CONSTANT_GREATER_OR_EQUAL_TO_INT{{ref|likely|[*]}}
 
|02E6||C||HI||colspan=6|
 
|-
 
!rowspan=7|=<br/>IS_THING_EQUAL_TO_THING!!IS_INT_EQUAL_TO_NUMBER{{ref|likely|[*]}}
 
|001B
 
!rowspan=7|2
 
|HI||I||colspan=6|
 
|-
 
!IS_INT_EQUAL_TO_INT{{ref|likely|[*]}}
 
|001C||HI||HI||colspan=6|
 
|-
 
!IS_FLOAT_EQUAL_TO_NUMBER{{ref|likely|[*]}}
 
|001D||HF||F||colspan=6|
 
|-
 
!IS_FLOAT_EQUAL_TO_FLOAT{{ref|likely|[*]}}
 
|001E||HF||HF||colspan=6|
 
|-
 
!IS_TEXT_LABEL_EQUAL_TO_STRING{{ref|likely|[*]}}
 
|001F||HS8||S8||colspan=6|
 
|-
 
!IS_TEXT_LABEL_EQUAL_TO_TEXT_LABEL{{ref|likely|[*]}}
 
|0020||HS8||HS8||colspan=6|
 
|-
 
!IS_INT_EQUAL_TO_CONSTANT{{ref|likely|[*]}}
 
|02DB||HI||C||colspan=6|
 
|-
 
!colspan=2|GOTO_IF_TRUE{{ref|statem|[*]}}
 
|0021
 
!1
 
|O||colspan=7|
 
|-
 
!colspan=2|GOTO_IF_FALSE{{ref|statem|[*]}}
 
|0022
 
!1
 
|O||colspan=7|
 
|-
 
!colspan=2|TERMINATE_THIS_SCRIPT
 
|rowspan=2|0023
 
!rowspan=2|0
 
|rowspan=2 colspan=8|
 
|-
 
!colspan=2|MISSION_END
 
|-
 
!colspan=2|START_NEW_SCRIPT{{ref|undarg|[*]}}
 
|0024
 
!1+l
 
|O||colspan=7|*T
 
|-
 
!colspan=2|GOSUB
 
|0025
 
!1
 
|O||colspan=7|
 
|-
 
!colspan=2|RETURN
 
|0026
 
!0
 
|colspan=8|
 
|-
 
!rowspan=2|+=@<br/>+@<br/>ADD_THING_TO_THING_TIMED!!ADD_TIMED_VAL_TO_FLOAT{{ref|likely|[*]}}
 
|0031
 
!rowspan=2|2
 
|HF||F||colspan=6|
 
|-
 
!ADD_TIMED_FLOAT_TO_FLOAT{{ref|likely|[*]}}
 
|0032||HF||HF||colspan=6|
 
|-
 
!rowspan=2|-=@<br/>-@<br/>SUB_THING_FROM_THING_TIMED!!SUB_TIMED_VAL_FROM_FLOAT{{ref|likely|[*]}}
 
|0033
 
!rowspan=2|2
 
|HF||F||colspan=6|
 
|-
 
!SUB_TIMED_FLOAT_FROM_FLOAT{{ref|likely|[*]}}
 
|0034||HF||HF||colspan=6|
 
|-
 
!rowspan=2|=#<br/>CSET!!CSET_INT_TO_FLOAT{{ref|likely|[*]}}
 
|0038
 
!rowspan=2|2
 
|HI||HF||colspan=6|
 
|-
 
!CSET_FLOAT_TO_INT{{ref|likely|[*]}}
 
|0039||HF||HI||colspan=6|
 
|-
 
!rowspan=2|ABS!!ABS_INT{{ref|likely|[*]}}
 
|003A
 
!rowspan=2|1
 
|HI||colspan=7|
 
|-
 
!ABS_FLOAT{{ref|likely|[*]}}
 
|003B||HF||colspan=7|
 
|-
 
!colspan=2|RETURN_TRUE
 
|005E
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|RETURN_FALSE
 
|005F
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|VAR_INT{{ref|defvar|[*]}}{{ref|posngs|[*]}}
 
|0060
 
!n
 
|colspan=8|@VI
 
|-
 
!colspan=2|VAR_FLOAT{{ref|defvar|[*]}}{{ref|posngs|[*]}}
 
|0061
 
!n
 
|colspan=8|@VF
 
|-
 
!colspan=2|LVAR_INT{{ref|defvar|[*]}}{{ref|posngs|[*]}}
 
|0062
 
!n
 
|colspan=8|@LI
 
|-
 
!colspan=2|LVAR_FLOAT{{ref|defvar|[*]}}{{ref|posngs|[*]}}
 
|0063
 
!n
 
|colspan=8|@LF
 
|-
 
!colspan=2|VAR_TEXT_LABEL{{ref|defvar|[*]}}{{ref|posngs|[*]}}
 
|0064
 
!n
 
|colspan=8|@VS8
 
|-
 
!colspan=2|LVAR_TEXT_LABEL{{ref|defvar|[*]}}{{ref|posngs|[*]}}
 
|0065
 
!n
 
|colspan=8|@LS8
 
|-
 
!colspan=2|{{{ref|embdsc|[*]}}{{ref|posngs|[*]}}
 
|0066
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|}{{ref|embdsc|[*]}}{{ref|posngs|[*]}}
 
|0067
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|IF{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|0068
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|IFNOT{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|0069
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|ELSE{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|006A
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|ENDIF{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|006B
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|WHILE{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|006C
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|WHILENOT{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|006D
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|ENDWHILE{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|006E
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|REPEAT{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|006F
 
!2
 
|I||HI||colspan=6|
 
|-
 
!colspan=2|ENDREPEAT{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|0070
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|SWITCH{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|0071
 
!1
 
|HI||colspan=7|
 
|-
 
!colspan=2|ENDSWITCH{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|0072
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|CASE{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|0073
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|DEFAULT{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|0074
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|BREAK{{ref|statem|[*]}}{{ref|posngs|[*]}}
 
|0075
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|ANDOR{{ref|statem|[*]}}
 
|0078
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|LAUNCH_MISSION
 
|0079
 
!1
 
|O||colspan=7|
 
|-
 
!colspan=2|GOSUB_FILE
 
|01BA
 
!2
 
|O||O||colspan=6|
 
|-
 
!colspan=2|PLAYER_MADE_PROGRESS
 
|01DF
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|SET_PROGRESS_TOTAL
 
|01E0
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|REGISTER_MISSION_GIVEN
 
|01EA
 
!0
 
|colspan=8|
 
|-
 
!colspan=2|REGISTER_MISSION_PASSED
 
|01EB
 
!1
 
|S8||colspan=7|
 
|-
 
!colspan=2|SCRIPT_NAME
 
|0238
 
!1
 
|S8||colspan=7|
 
|-
 
!colspan=2|LOAD_AND_LAUNCH_MISSION
 
|0288
 
!1
 
|O||colspan=7|
 
|-
 
!colspan=2|LOAD_AND_LAUNCH_MISSION_INTERNAL
 
|0289
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|SET_TOTAL_NUMBER_OF_MISSIONS
 
|0296
 
!1
 
|I||colspan=7|
 
|-
 
!colspan=2|REGISTER_ODDJOB_MISSION_PASSED
 
|036A
 
!0
 
|colspan=8|
 
|-
 
!rowspan=2 colspan=2|CALL{{ref|undarg|[*]}}{{ref|argvar|[*]}}{{ref|likely|[*]}}
 
|rowspan=2|037A
 
!rowspan=2|1+i+o
 
|rowspan=2|O
 
|colspan=7|*T
 
|-
 
|colspan=7|HT
 
|-
 
!rowspan=2 colspan=2|CALLNOT{{ref|undarg|[*]}}{{ref|argvar|[*]}}{{ref|likely|[*]}}
 
|rowspan=2|037B
 
!rowspan=2|1+i+o
 
|rowspan=2|O
 
|colspan=7|*T
 
|-
 
|colspan=7|HT
 
|-
 
!colspan=2|SET_COLLECTABLE2_TOTAL
 
|04DA
 
!1
 
|I||colspan=7|
 
 
|}
 
|}
  
;Notes
+
==Control flows==
:{{note|misdef}} A special [[#Mission scripts|mission]] directive which is never compiled;
+
Insofar as subprograms, scripts are organized in a systematic arrangement through which goto branches, subroutine branches, function calls and returns or cutscene area markers are executed to form control flow statements and structures. These alter the [[Wikipedia:Program Counter|program counter]] most of the time affecting the top-down order all commands are fetched by. Facing off code duplication is quite recurring especially when the tasks to perform vary only in the input data, the case where a piece of code or subroutine, built once in the source, is invoked many times from various different places and returns back, as if the <code>GOSUB</code> statement is substituted in-place by the subroutine's body without <code>RETURN</code> during the control transferring, to shrink long codes and reduce the script overall size. In the last Trilogy chapter, a region of code can be marked as a nonnestable cutscene area wherein the rest of commands within <code>SKIP_CUTSCENE_START..SKIP_CUTSCENE_END</code> is skipped to the pressure of some key/button at the next script tick. The flow of execution can also be broken up conditionally by means of:
:{{note|statem}} It is used also to build [[#Statements|statements]] internally;
+
 
:{{note|defvar}} It is used to declare one or more variables;
+
* ''Decision-making structures'' (<code>IF</code>, <code>IFNOT</code>, <code>SWITCH</code>), which evaluate the result of one or more conditions and choose what path to follow based off the trueness or falseness of the check being tested. Been deemed the most basic tool of [[Wikipedia:Structured programming|structured programming]], <code>IF</code> is a bidirectional statement that proceeds with the execution of the underneath code only if the test carried out evaluates to true otherwise it transfers the control next to <code>ENDIF</code> instantly, unless a preceding and optional <code>ELSE</code> clause, establishing an alternative path, is specified. In the first Trilogy and both Stories chapters where <code>GOTO_IF_TRUE</code> is handled by game code, the barely used <code>IFNOT</code> can be deployed as a placeholder to easily invert the compare-flag, a boolean state which is set or cleared as a result of the bitwise [[Wikipedia:Bitwise operation#AND|conjunction]] or [[Wikipedia:Bitwise operation#OR|disjunction]] with the true/false state caught by a condition, applying the inversion according to the presence of the not-flag before accumulating. Logical operators make possible the connection among multiple conditions via the <code>AND</code> [[Wikipedia:Logical conjunction|conjunction]] and <code>OR</code> [[Wikipedia:Logical disjunction|disjunction]] giving the chance to verify if conditions are all true or if just one of them is satisfied bearing in mind that the <code>NOT</code> [[Wikipedia:Logical negation|negation]], inverting the boolean state of a single condition, may be supplied. Connectivity information are held by <code>ANDOR</code>, whose argument depicts a value in the range <code>[1,8)</code> or <code>[21,28)</code> (end-inclusive in Stories) for logical conjunction and disjunction respectively, limiting the amount of total conditions to provide to a maximum of 8 per check (the prominent intervals discrepancy also suggests <code>NAND</code> and <code>NOR</code> operators might have been a plan at some point). A value of 0 does nothing relevant functional-wise at runtime, what led developers to not compile said command in such a situation for Stories chapters and also make the argument one-based so that it effectively counts the number of commands used in a multi-condition check. The inability to create subexpressions enforces not to combine <code>AND</code> with <code>OR</code> in a check, plus evaluations are eager and therefore not short-circuited meaning all conditions are executed prior potentially branching through <code>GOTO_IF_FALSE</code> in the common case after the compare-flag gets processed. <code>IF-GOTO</code> and <code>IFNOT-GOTO</code> constructs are also viable to inline a bogus one-way control transferer, targeting an arbitrary location, nearby a one-condition check with no end-ing statement.
:{{note|embdsc}} It embeds a variable scope;
+
:Nesting lots of <code>IF-ELSE-ENDIF</code> structures of one-condition checks testing the equality of the same variable against a few integer literals or string constants can add a ridiculous code redundancy and performance overhead, sorted out in the last Trilogy chapter thanks to the introduction of the <code>SWITCH</code> statement, a multiway statement either branching to the switch section labelled by fall-through <code>CASE</code> statements of which one passses a value that shall match the variable content to compare or optionally branching to <code>DEFAULT</code> in the worst-case scenario, each ending with a nonmandatory <code>BREAK</code> statement goto-ing past <code>ENDSWITCH</code>. On compilation, the implementation somehow mimics the pattern of a [[Wikipedia:Jump table|jump table]] sorting case label references by value to fulfil the runtime's [[Wikipedia:Binary search|binary search]] among at least 1 of 75 entries (default case aside);
:{{note|undarg}} It has an undefined amount of [[#Arguments|arguments]];
+
* ''Looping structures'' (<code>WHILE</code>, <code>WHILENOT</code>, <code>REPEAT</code>), which repeatedly execute a block of code certain number of times or by constantly and successfully evaluating a check. The only condition-controlled loop statement featured is the widespread <code>WHILE</code>, a cyclical <code>IF</code> statement as well as <code>IFNOT</code> is for <code>WHILENOT</code>, repeating the embedded code over and over again if the verified check is true or till it becomes false when reaching <code>ENDWHILE</code>. Alongside well-known constructs the language supports a singular count-controlled structure, <code>REPEAT-ENDREPEAT</code>, looping some code at least once by advancing an integer variable at each iteration until the times specified (literal-only). Despite [[Wikipedia:Considered harmful|considered harmful]] in the programming literature for [[Wikipedia:High-level programming language|high-level programming languages]], an unconditional branch is the only way to go for breaking loops beforehand and enhance paradoxically the simplistic code logic or for creating infinite loops with a backward <code>GOTO</code>.
:{{note|likely}} It is a likely definition of the standard command;
+
 
:{{note|posngs}} It should exist but its position is purely guessed;
+
Control flows intersection is, arguably, trouble-free and it's up to the writer to not ruin the code integrity, but still substatements must match the closest opening statement they belong to. Optimization is not of compiler concern meaning control flows are encapsulated as-is with no code reduction even for empty blocks, resulting in goto-es branching right after or piled up in sequence.
:{{note|argvar}} Arguments amount varies when compiling.
 
  
{{incomplete}}
+
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="GOSUB">Subroutine structure: GOSUB</span>
  
===Uncommons===
+
GOSUB subroutine
 +
COMMAND
 +
GOTO somewhere
 +
 +
subroutine:
 +
COMMAND
 +
RETURN
  
[[#Arguments|Arguments]] of some commands keep uncommon [[#Value|values]] which look familiar after encoding:
+
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="SKIP_CUTSCENE_START_and_SKIP_CUTSCENE_END">Cutscene area structure: SKIP_CUTSCENE_START and SKIP_CUTSCENE_END</span>
  
{|class=wikitable style=text-align:center
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
!rowspan=2|Command
+
|width=50%|'''Mission script'''
!rowspan=2|Arg.<br/>ID
+
|width=16px rowspan=2|
!rowspan=2|Syntax
+
|width=50%|'''Script multifile'''
!colspan=4|Encoded
 
|-
 
!Command!!Arg.<br/>ID!!Value!!Type
 
|-
 
|colspan=7|{{icon|3}} {{icon|vc}} {{icon|sa}} {{icon|lcs}} {{icon|vcs}}
 
 
|-
 
|-
!GOTO
+
|style="vertical-align: top"|
|1||Any [[#Labels|label]]
+
<pre style="white-space: pre; overflow-x: scroll">
!GOTO
+
// Formerly thought as MARK_CUTSCENE_START.
|1||[[#Offsets|Offset]]||INT
+
SKIP_CUTSCENE_START
|-
+
    COMMAND
!GOTO_IF_FALSE
+
    WAIT 0
|1||Any label
+
    COMMAND
!GOTO_IF_FALSE
+
// Formerly thought as MARK_CUTSCENE_END.
|1||Offset||INT
+
SKIP_CUTSCENE_END
|-
+
</pre>
!GOSUB
+
|style="vertical-align: top"|
|1||[[#Gosubs|Gosub]] label
+
<pre style="white-space: pre; overflow-x: scroll">
!GOSUB
+
// Formerly thought as CUTSCENE_SCROLL?
|1||Offset||INT
+
SKIP_CUTSCENE_START_INTERNAL SPECIAL_LABEL_SKIP_CUTSCENE_STARTS_0
|-
+
    COMMAND
!rowspan=4|GOSUB_FILE
+
    WAIT 0
|1||Gosub label
+
    COMMAND
!rowspan=4|GOSUB_FILE
+
SPECIAL_LABEL_SKIP_CUTSCENE_STARTS_0:
|1||rowspan=2|0-based offset||rowspan=4|INT
+
SKIP_CUTSCENE_END
|-
+
</pre>
|2||[[#Foreign gosubs|Foreign gosub]] file||2
 
|-
 
|1||Gosub label||1||rowspan=2|Negative offset
 
|-
 
|2||Foreign gosub label||2
 
|-
 
!rowspan=2|START_NEW_SCRIPT
 
|1||[[#Scripts|Script]] label
 
!rowspan=2|START_NEW_SCRIPT
 
|1||Offset||INT
 
|-
 
|l||Passed [[#Local|locals]]||l||Passed locals||ANY_T
 
|-
 
!rowspan=2|LAUNCH_MISSION
 
|rowspan=2|1||[[#Subscripts|Subscript]] file
 
!rowspan=2|LAUNCH_MISSION
 
|rowspan=2|1||0-based offset||rowspan=2|INT
 
|-
 
|Subscript label||Negative offset
 
|-
 
!rowspan=2|LOAD_AND_LAUNCH_MISSION
 
|rowspan=2|1||[[#Mission scripts|Mission script]] file
 
!LOAD_AND_LAUNCH_MISSION_INTERNAL
 
|rowspan=2|1||Mission [[#Identifiers|identifier]]||rowspan=2|INT
 
|-
 
|Mission script label
 
!LOAD_AND_LAUNCH_MISSION
 
|Negative offset
 
|-
 
|colspan=7|{{icon|3}} {{icon|lcs}} {{icon|vcs}}
 
|-
 
!GOTO_IF_TRUE
 
|1||Any label
 
!GOTO_IF_TRUE
 
|1||Offset||INT
 
|-
 
|colspan=7|{{icon|vc}} {{icon|sa}}
 
|-
 
!rowspan=2|LOAD_AND_LAUNCH_MISSION_EXCLUSIVE
 
|rowspan=2|1||Mission script file
 
!LOAD_AND_LAUNCH_MISSION_INTERNAL
 
|rowspan=2|1||Negative mission identifier||rowspan=2|INT
 
|-
 
|Mission script label
 
!LOAD_AND_LAUNCH_MISSION
 
|Negative offset
 
|-
 
|colspan=7|{{icon|lcs}} {{icon|vcs}}
 
|-
 
!rowspan=6|CALL<br/>CALLNOT
 
|rowspan=4|1||rowspan=4|[[#Functions|Function]] label
 
!rowspan=6|CALL<br/>CALLNOT
 
|1||# of input arguments||rowspan=4|INT
 
|-
 
|2||# of output arguments
 
|-
 
|3||# of script locals
 
|-
 
|4||Offset
 
|-
 
|i||Input arguments||i||Input arguments||ANY_T
 
|-
 
|o||Output arguments||o||Output arguments||HOLD_T
 
 
|}
 
|}
  
{{incomplete}}
+
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="IF_and_IFNOT">Decision-making structures: IF and IFNOT</span>
  
===Compare flag===
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
 +
|width=50%|'''Mission script'''
 +
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
IF COMMAND
 +
    COMMAND
 +
ELSE
 +
    COMMAND
 +
ENDIF
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
ANDOR 0
 +
COMMAND
 +
GOTO_IF_FALSE SPECIAL_LABEL_IFS_ELSE_0
 +
    COMMAND
 +
    GOTO SPECIAL_LABEL_IFS_0
 +
SPECIAL_LABEL_IFS_ELSE_0:
 +
    COMMAND
 +
SPECIAL_LABEL_IFS_0:
 +
</pre>
 +
|}
  
The ''compare flag'' can handle up to ''8 checks'' per construct. ''006D'' ({{icon|3}} {{icon|vc}} {{icon|sa}}), ''00DB'' ({{icon|lcs}}) and ''0078'' ({{icon|vcs}}) indicate you are verifying a single check (0) or multiple checks with either '''AND''' (1 to 8) or '''OR''' (21 to 28) [[#Logical|logical operators]] (see also [[#ANDOR|ANDOR]]).
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
 +
|width=50%|'''Mission script'''
 +
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
IF COMMAND
 +
AND NOT COMMAND
 +
    COMMAND
 +
ENDIF
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
ANDOR 1
 +
COMMAND
 +
NOT COMMAND
 +
GOTO_IF_FALSE SPECIAL_LABEL_IFS_1
 +
    COMMAND
 +
SPECIAL_LABEL_IFS_1:
 +
</pre>
 +
|}
  
==Analysis==
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
 +
|width=50%|'''Mission script'''
 +
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
IFNOT COMMAND
 +
OR NOT COMMAND
 +
    COMMAND
 +
ENDIF
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
ANDOR 21
 +
COMMAND
 +
NOT COMMAND
 +
GOTO_IF_TRUE SPECIAL_LABEL_IFS_2
 +
    COMMAND
 +
SPECIAL_LABEL_IFS_2:
 +
</pre>
 +
|}
  
As an overview of the compiled source, [[#Statements|statements]] are literally nested meaning that the code is unoptimized. Furthermore, the jump of an embedded construct doesn't get merged with that of the construct itself, which consists of a benefit for the code parsing.
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
 +
|width=50%|'''Mission script'''
 +
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
IF COMMAND GOTO somewhere
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
ANDOR 0
 +
COMMAND
 +
GOTO_IF_TRUE somewhere
 +
</pre>
 +
|}
  
===IF===
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
 +
|width=50%|'''Mission script'''
 +
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
IFNOT COMMAND GOTO somewhere
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
ANDOR 0
 +
COMMAND
 +
GOTO_IF_FALSE somewhere
 +
</pre>
 +
|}
  
As regards the [[#IF|IF]] statement, if the whole check is true the ''consequence'' is performed and the code jumps to the end of the construct, otherwise it skips to the ''alternative'' (see also [[#Compare flag|Compare flag]]):
+
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="SWITCH">Decision-making structure: SWITCH</span>
  
{|width=100%
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
!width=50%|Decompiled
+
|width=50%|'''Mission script'''
!width=1px|{{icon|3}} {{icon|vc}} {{icon|sa}}
+
|width=16px rowspan=2|
!width=1px|{{icon|lcs}}
+
|width=50%|'''Script multifile'''
!width=1px|{{icon|vcs}}
 
!Compiled
 
 
|-
 
|-
|
+
|style="vertical-align: top"|
IF [NOT] {condition0}
+
<pre style="white-space: pre; overflow-x: scroll">
[AND|OR [NOT] {condition8}]
+
VAR_INT check
    {consequence}
+
SWITCH check
[ELSE
+
    CASE 0
    {alternative}]
+
        COMMAND
ENDIF
+
        BREAK
|
+
    CASE 1
{006D}
+
    CASE 3
{....}
+
        COMMAND
{....}
+
        BREAK
{004D}
+
    CASE 2
{....}
+
        COMMAND
{0002}
+
        BREAK
  ----
+
    CASE 4
{....}
+
    CASE 6
  ----
+
    CASE 5
|
+
    CASE 7
{00DB}
+
        COMMAND
{....}
+
        //BREAK
{....}
+
ENDSWITCH
{004D}
+
</pre>
{....}
+
|style="vertical-align: top"|
{0002}
+
<pre style="white-space: pre; overflow-x: scroll">
  ----  
+
SWITCH_START check 8 FALSE SPECIAL_LABEL_SWITCHES_0 0 SPECIAL_LABEL_SWITCHES_CASE_0_0 1 SPECIAL_LABEL_SWITCHES_CASE_1_0 2 SPECIAL_LABEL_SWITCHES_CASE_2_0 3 SPECIAL_LABEL_SWITCHES_CASE_1_0 4 SPECIAL_LABEL_SWITCHES_CASE_3_0 5 SPECIAL_LABEL_SWITCHES_CASE_3_0 6 SPECIAL_LABEL_SWITCHES_CASE_3_0
{....}
+
SWITCH_CONTINUED 7 SPECIAL_LABEL_SWITCHES_CASE_3_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0
  ----  
+
SPECIAL_LABEL_SWITCHES_CASE_0_0:
|
+
    COMMAND
{0078}
+
    GOTO SPECIAL_LABEL_SWITCHES_0
{....}
+
SPECIAL_LABEL_SWITCHES_CASE_1_0:
{....}
+
    COMMAND
{0022}
+
    GOTO SPECIAL_LABEL_SWITCHES_0
{....}
+
SPECIAL_LABEL_SWITCHES_CASE_2_0:
{0002}
+
    COMMAND
  ----  
+
    GOTO SPECIAL_LABEL_SWITCHES_0
{....}
+
SPECIAL_LABEL_SWITCHES_CASE_3_0:
  ----
+
    COMMAND
|
+
    //GOTO SPECIAL_LABEL_SWITCHES_0
ANDOR {value}
+
SPECIAL_LABEL_SWITCHES_0:
    [NOT] {condition0}
+
</pre>
    [[NOT] {condition8}]
 
GOTO_IF_FALSE ELSE
 
    {consequence}
 
    [GOTO ENDIF]
 
ELSE:
 
    [{alternative}
 
ENDIF:]
 
 
|}
 
|}
  
===IFNOT===
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
 +
|width=50%|'''Mission script'''
 +
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
{
 +
    LVAR_INT check
 +
    SWITCH check
 +
        CASE -2
 +
        CASE -1
 +
            COMMAND
 +
            BREAK
 +
        CASE 1
 +
        CASE 2
 +
            COMMAND
 +
            BREAK
 +
        CASE 0
 +
        DEFAULT
 +
            COMMAND
 +
            //BREAK
 +
    ENDSWITCH
 +
}
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
SWITCH_START check 5 TRUE SPECIAL_LABEL_SWITCHES_DEFAULT_1 -2 SPECIAL_LABEL_SWITCHES_CASE_0_1 -1 SPECIAL_LABEL_SWITCHES_CASE_0_1 0 SPECIAL_LABEL_SWITCHES_DEFAULT_1 1 SPECIAL_LABEL_SWITCHES_CASE_1_1 2 SPECIAL_LABEL_SWITCHES_CASE_1_1 -1 SPECIAL_LABEL_SWITCHES_1 -1 SPECIAL_LABEL_SWITCHES_1
 +
SPECIAL_LABEL_SWITCHES_CASE_0_1:
 +
    COMMAND
 +
    GOTO SPECIAL_LABEL_SWITCHES_1
 +
SPECIAL_LABEL_SWITCHES_CASE_1_1:
 +
    COMMAND
 +
    GOTO SPECIAL_LABEL_SWITCHES_1
 +
SPECIAL_LABEL_SWITCHES_DEFAULT_1:
 +
    COMMAND
 +
    //GOTO SPECIAL_LABEL_SWITCHES_1
 +
SPECIAL_LABEL_SWITCHES_1:
 +
</pre>
 +
|}
  
Not that much to say more than the preceding construct, the [[#IFNOT|IFNOT]] statement is built nearly in the same way. In fact, the '''ELSE''' clause points to the ''alternative'', whereas the [[#GOTO|GOTO]] jumps to its end. The substantial difference consists in the substitution of [[#GOTO_IF_FALSE|GOTO_IF_FALSE]] with [[#GOTO_IF_TRUE|GOTO_IF_TRUE]]:
+
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="WHILE_and_WHILENOT">Looping structures: WHILE and WHILENOT</span>
  
{|width=100%
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
!width=50%|Decompiled
+
|width=50%|'''Mission script'''
!width=1px|{{icon|3}}
+
|width=16px rowspan=2|
!width=1px|{{icon|lcs}}
+
|width=50%|'''Script multifile'''
!width=1px|{{icon|vcs}}
 
!Compiled
 
 
|-
 
|-
|
+
|style="vertical-align: top"|
IFNOT [NOT] {condition0}
+
<pre style="white-space: pre; overflow-x: scroll">
[AND|OR [NOT] {condition8}]
+
WHILE COMMAND
    {consequence}
+
    COMMAND
[ELSE
+
ENDWHILE
    {alternative}]
+
</pre>
ENDIF
+
|style="vertical-align: top"|
|
+
<pre style="white-space: pre; overflow-x: scroll">
{00D6}
+
SPECIAL_LABEL_WHILES_A_0:
{....}
+
ANDOR 0
{....}
+
COMMAND
{004C}
+
GOTO_IF_FALSE SPECIAL_LABEL_WHILES_B_0
{....}
+
    COMMAND
{0002}
+
    GOTO SPECIAL_LABEL_WHILES_A_0
  ----
+
SPECIAL_LABEL_WHILES_B_0:
{....}
+
</pre>
  ----  
 
|
 
{00DB}
 
{....}
 
{....}
 
{004C}
 
{....}
 
{0002}
 
  ----
 
{....}
 
  ----
 
|
 
{0078}
 
{....}
 
{....}
 
{0021}
 
{....}
 
{0002}
 
  ----  
 
{....}
 
  ----
 
|
 
ANDOR {value}
 
    [NOT] {condition0}
 
    [[NOT] {condition8}]
 
GOTO_IF_TRUE ELSE
 
    {consequence}
 
    [GOTO ENDIF]
 
ELSE:
 
    [{alternative}
 
ENDIF:]
 
 
|}
 
|}
  
===WHILE===
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
 
+
|width=50%|'''Mission script'''
The [[#WHILE|WHILE]] statement is pretty much similar to the previous, even though when the ''consequence'' is read the code is moved to the beginning of the construct:
+
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
WHILE COMMAND
 +
AND NOT COMMAND
 +
    COMMAND
 +
ENDWHILE
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
SPECIAL_LABEL_WHILES_A_1:
 +
ANDOR 1
 +
COMMAND
 +
NOT COMMAND
 +
GOTO_IF_FALSE SPECIAL_LABEL_WHILES_B_1
 +
    COMMAND
 +
    GOTO SPECIAL_LABEL_WHILES_A_1
 +
SPECIAL_LABEL_WHILES_B_1:
 +
</pre>
 +
|}
  
{|width=100%
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
!width=50%|Decompiled
+
|width=50%|'''Mission script'''
!width=1px|{{icon|3}} {{icon|vc}} {{icon|sa}}
+
|width=16px rowspan=2|
!width=1px|{{icon|lcs}}
+
|width=50%|'''Script multifile'''
!width=1px|{{icon|vcs}}
 
!Compiled
 
 
|-
 
|-
|
+
|style="vertical-align: top"|
WHILE [NOT] {condition0}
+
<pre style="white-space: pre; overflow-x: scroll">
[AND|OR [NOT] {condition8}]
+
WHILENOT COMMAND
    {consequence}
+
OR NOT COMMAND
ENDWHILE
+
    COMMAND
|
+
ENDWHILE
  ----  
+
</pre>
{006D}
+
|style="vertical-align: top"|
{....}
+
<pre style="white-space: pre; overflow-x: scroll">
{....}
+
SPECIAL_LABEL_WHILES_A_2:
{004D}
+
ANDOR 21
{....}
+
COMMAND
{0002}
+
NOT COMMAND
  ----
+
GOTO_IF_TRUE SPECIAL_LABEL_WHILES_B_2
|
+
    COMMAND
  ----
+
    GOTO SPECIAL_LABEL_WHILES_A_2
{00DB}
+
SPECIAL_LABEL_WHILES_B_2:
{....}
+
</pre>
{....}
 
{004D}
 
{....}
 
{0002}
 
  ----
 
|
 
  ----
 
{0078}
 
{....}
 
{....}
 
{0022}
 
{....}
 
{0002}
 
  ----
 
|
 
WHILE:
 
ANDOR {value}
 
    [NOT] {condition0}
 
    [[NOT] {condition8}]
 
GOTO_IF_FALSE ENDWHILE
 
    {consequence}
 
    GOTO WHILE
 
ENDWHILE:
 
 
|}
 
|}
  
===WHILENOT===
+
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="REPEAT">Looping structure: REPEAT</span>
  
To say the least, [[#WHILENOT|WHILENOT]] statement follows the same constitution of both [[#WHILE|WHILE]] and [[#IFNOT|IFNOT]] constructs, by exchanging [[#GOTO_IF_FALSE|GOTO_IF_FALSE]] with [[#GOTO_IF_TRUE|GOTO_IF_TRUE]]:
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
 +
|width=50%|'''Mission script'''
 +
|width=16px rowspan=2|
 +
|width=50%|'''Script multifile'''
 +
|-
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
VAR_INT steps
 +
REPEAT 4 steps // 0 or lesser still implies 1 step.
 +
    COMMAND
 +
ENDREPEAT
 +
</pre>
 +
|style="vertical-align: top"|
 +
<pre style="white-space: pre; overflow-x: scroll">
 +
SET_VAR_INT steps 0
 +
SPECIAL_LABEL_REPEATS_0:
 +
    COMMAND
 +
    ADD_VAL_TO_INT_VAR steps 1
 +
// Here ANDOR is accidentally missing in Trilogy.
 +
IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER steps 4
 +
GOTO_IF_FALSE SPECIAL_LABEL_REPEATS_0
 +
</pre>
 +
|}
  
{|width=100%
+
{|style="table-layout: fixed" width=100% cellspacing=0 cellpadding=0
!width=50%|Decompiled
+
|width=50%|'''Mission script'''
!width=1px|{{icon|3}}
+
|width=16px rowspan=2|
!width=1px|{{icon|lcs}}
+
|width=50%|'''Script multifile'''
!width=1px|{{icon|vcs}}
 
!Compiled
 
 
|-
 
|-
|
+
|style="vertical-align: top"|
WHILENOT [NOT] {condition0}
+
<pre style="white-space: pre; overflow-x: scroll">
[AND|OR [NOT] {condition8}]
+
{
    {consequence}
+
    LVAR_INT steps
ENDWHILE
+
    REPEAT 8 steps
|
+
        COMMAND
  ----  
+
    ENDREPEAT
{00D6}
+
}
{....}
+
</pre>
{....}
+
|style="vertical-align: top"|
{004C}
+
<pre style="white-space: pre; overflow-x: scroll">
{....}
+
SET_LVAR_INT steps 0
{0002}
+
SPECIAL_LABEL_REPEATS_1:
  ----
+
    COMMAND
|
+
    ADD_VAL_TO_INT_LVAR steps 1
  ----
+
IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER steps 8
{00DB}
+
GOTO_IF_FALSE SPECIAL_LABEL_REPEATS_1
{....}
+
</pre>
{....}
 
{004C}
 
{....}
 
{0002}
 
  ----
 
|
 
  ----
 
{0078}
 
{....}
 
{....}
 
{0021}
 
{....}
 
{0002}
 
  ----
 
|
 
WHILENOT:
 
ANDOR {value}
 
    [NOT] {condition0}
 
    [[NOT] {condition8}]
 
GOTO_IF_TRUE ENDWHILE
 
    {consequence}
 
    GOTO WHILENOT
 
ENDWHILE:
 
 
|}
 
|}
  
===REPEAT===
+
<span style="display: block; margin: 1em 0; font-size: 1.17em; font-weight: bold; color: black" id="Backward_GOTO">Infinite looping structure: backward GOTO</span>
 +
 
 +
loopstart:
 +
WAIT 0
 +
COMMAND
 +
GOTO loopstart
  
Seemingly, the [[#REPEAT|REPEAT]] statement is the first construct ever optimized as a result of a possible R* compiler fault. Moreover, it sounds ambiguous as it loops at least once. This was probably the intention of R* programmers, that is iterating at least once else the construct is useless. However, there are few chance they decide to use such structure to avoid some conflict with some other constructs:
+
=Multiscripts=
  
{|width=100%
+
The whole GTA series started as a world subdivided into several levels, each one per urban area spread across fewer cities, albeit 3D era titles has got a single-leveled design covering the entire game scene. Every level is shipped with a main script and a number of ancillary script files, simply called multiscripts, which are bundled inside a folder bearing the same name as the main script filename without extension. The robust scripting engine allows more scripts to cooperate simultaneously at runtime to let writing codes in a multithreading fashion but with no actual concurrency. A script is a unit of execution which, upon starting, is enqueued to a list of active scripts as long as an explicit termination, moving the script back to a list of idle scripts, occurs with <code>TERMINATE_THIS_SCRIPT</code> while <code>TERMINATE_ALL_SCRIPTS_NAMED</code> halts all instances of a script if the specified name, definitely unique to avert compiler complains, was ever set by <code>SCRIPT_NAME</code>. Running scripts are processed sequentially in a non-prioritized order and are paused pending one of the next script ticks using <code>WAIT</code> to delay the script execution of an instance some milliseconds ahead or at the earliest opportunity if 0.
!width=50%|Decompiled
 
!colspan=2|G/L {{icon|vc}} {{icon|sa}} {{icon|lcs}}
 
!width=1px|G/L {{icon|vcs}}
 
!Compiled
 
|-
 
|
 
REPEAT {times} {varname}
 
    {consequence}
 
ENDREPEAT
 
|width=1px|
 
{0004}
 
  ----
 
{....}
 
{0008}
 
{0028}
 
{004D}
 
|width=1px|
 
{0005}
 
  ----
 
{....}
 
{0009}
 
{0029}
 
{004D}
 
|
 
{0004}
 
  ----
 
{....}
 
{0007}
 
{0015}
 
{0022}
 
|
 
{varname} = {value0}
 
LOOP:
 
{consequence}
 
++ {varname}
 
    {varname} >= {valueN}
 
GOTO_IF_FALSE LOOP
 
|}
 
  
===SWITCH===
+
{{Incomplete}}
  
In {{icon|sa}}, the [[#SWITCH|SWITCH]] statement is more complex and efficient because the game uses internally a [[Wikipedia:Binary_search_algorithm|binary search algorithm]] to jump at the [[#Labels|label]] that matches with the value of a particular case. This method requires a known amount of cases which is up to 75. When a case is true, a ''consequence'' is executed and the code jumps to the end of the construct, otherwise the ''alternative'' may be performed. As the code is unoptimized, the [[#GOTO|GOTO]] of the last case is still compiled even though its label points right after the command mentioned earlier:
+
==Main script and Main extensions==
  
{|width=100%
+
{{Incomplete}}
!width=20%|Decompiled
 
!width=1px|{{icon|sa}}
 
!Compiled
 
|-
 
|
 
SWITCH {varname}
 
    CASE {value0}
 
        {consequence}
 
        BREAK
 
    [CASE {valueN}
 
        {consequence}
 
        BREAK]
 
    [DEFAULT
 
        {alternative}
 
        BREAK]
 
ENDSWITCH
 
|
 
{0871}
 
{0872}
 
  ----
 
{....}
 
{0002}
 
  ----
 
{....}
 
{0002}
 
  ----
 
{....}
 
{0002}
 
  ----
 
|
 
SWITCH_START {varname} {numcases} {isdefault} DEFAULT {value0} CASE0 ...
 
[SWITCH_CONTINUED ... {valueN} CASEN [-1 ENDSWITCH]]
 
CASE0:
 
    {consequence}
 
    GOTO ENDSWITCH
 
[CASEN:
 
    {consequence}
 
    GOTO ENDSWITCH]
 
[DEFAULT:
 
    {alternative}
 
    GOTO ENDSWITCH]
 
ENDSWITCH:
 
|}
 
  
In {{icon|lcs}} and {{icon|vcs}}, such statement is a set of nested [[#IF|IF]] constructs which causes a very slight loss of performance by considering that ''00DB'' ({{icon|lcs}}) and ''0078'' ({{icon|vcs}} aren't compiled:
+
==Scripts and Streamed scripts==
  
{|width=100%
+
{{Incomplete}}
!width=50%|Decompiled
 
!colspan=2|G/L {{icon|lcs}}
 
!width=1px|G/L {{icon|vcs}}
 
!Compiled
 
|-
 
|
 
SWITCH {varname}
 
    CASE {value0}
 
        {consequence}
 
        BREAK]
 
    [CASE {valueN}
 
        {consequence}
 
        BREAK]
 
    [DEFAULT
 
        {alternative}
 
        BREAK]
 
ENDSWITCH
 
|width=1px|
 
  ----
 
{0038}
 
{004D}
 
{....}
 
{0002}
 
  ----
 
{0038}
 
{004D}
 
{....}
 
{0002}
 
  ----
 
{....}
 
  ----
 
  ----
 
|width=1px|
 
  ----
 
{0039}
 
{004D}
 
{....}
 
{0002}
 
  ----
 
{0039}
 
{004D}
 
{....}
 
{0002}
 
  ----
 
{....}
 
  ----
 
  ----
 
|
 
  ----
 
{001B}
 
{0022}
 
{....}
 
{0002}
 
  ----
 
{001B}
 
{0022}
 
{....}
 
{0002}
 
  ----
 
{....}
 
  ----
 
  ----
 
|
 
CASE0:
 
    {varname} = {value0}
 
GOTO_IF_FALSE CASEN
 
    {consequence}
 
    GOTO ENDSWITCH0
 
CASEN:
 
        [{varname} = {valueN}
 
    GOTO_IF_FALSE DEFAULT
 
        {consequence}
 
        GOTO ENDSWITCHN
 
    DEFAULT:
 
        [{alternative}
 
    ENDSWITCHN:]]
 
ENDSWITCH0:
 
|}
 
  
==Optimization==
+
==Subscripts and Mission scripts==
  
In {{icon|lcs}} and {{icon|vcs}}, whenever a ''single condition'' is checked ''00DB'' ({{icon|lcs}}) and ''0078'' ({{icon|vcs}}) don't get compiled cause no [[#Logical|logical operator]] ('''AND''', '''OR''') is used and so they become really useless. Its lack increase the script efficiency a lot. However, the jump of the '''ELSE''' clause of an [[#IF|IF]] statement which points to the end of the construct is still compiled after a [[#GOTO|GOTO]]. Furthermore, ''Stories Games'' come with an improved data type managing which causes a considerable decrease of the compiled file size.
+
{{Incomplete}}
  
 
=Tools=
 
=Tools=
  
*[[SCRambl]] - an open-source tool provided by {{U|Deji}}
+
{{GTAF|566450|SCRambl}}, first ever attempt for a now discontinued third-party compiler by {{U|Deji}}<br/>
 +
{{GTAF|876530|GTA3script Toolchain}}, second and still work-in-progress attempt for an unofficial compiler by {{U|Link2012}}
  
 
=External links=
 
=External links=
  
*{{icon|2}} [http://gtamp.com/GTA2/gta2script.7z DMA's official GTA2script Compiler V9.6], [http://projectcerbera.com/gta/2/tutorials/scripting DMA's official GTA2script information] - found into the game copy
+
{{GTAF|876461|Learn GTA3script in Y minutes}}, tutorial for deep diving into the language in a short time by {{U|Link2012}}<br/>
*{{icon|3}} [https://www.dropbox.com/s/bwxqe33c8ownfc8/gta3ta_source.rar GTA III 10th Anniversary source] - found into the ''iOS'' game copy
+
[https://gtamodding.github.io/gta3script-specs/ GTA3script Language Specifications], community-based specifications of the language led and maintained by {{U|Link2012}}
*{{icon|vc}} [https://www.dropbox.com/s/dlxl90ra2wpgfpq/gtavc_defines.rar GTA VC definitions] - some sort of information by {{U|Wesser}} as a result of the reverse-engineering applied to the [http://www.rockstargames.com/ Rockstar Games]' official '''GTA3 Script Compiler V413'''
 
*{{icon|sa}} [http://pastebin.com/raw.php?i=Ra9JLLeN PC/PS2/XBOX script commands], [http://pastebin.com/raw.php?i=kCwS6rdG Mobile script commands] - taken directly from the ''Android'' application and rearranged by {{U|Wesser}}
 
*{{icon|3}} {{icon|vc}} [https://www.dropbox.com/s/7xgvqo8b9u1qw02/gta3sc_v413.rar Official GTA3 Script Compiler V413] - found into the ''GTA VC 10th Anniversary'' copy
 
  
{{N|SA|VC|3}}
+
=See also=
  
[[Category:Mission Script]]
+
[[SCM language III/VC definitions]]

Latest revision as of 01:25, 14 November 2021

40px-Ambox rewrite orange.svg.png This article may need to be rewritten.
Please help improve this article. The discussion page may contain suggestions.
This article deals with the native scripting language syntax of GTA 3 series, nothing other than III, VC, SA, LCS and VCS.
It may incorporate nonstandard specifications due to the fact R* hasn't published enough documentation about yet.

On the occasion of the "Grand Theft Auto III 10th Anniversary", after a long period of darkness where we fell about the real scripting language syntax, R* finally treated us (or was it, as it seems, a War Drum Studios sloppy oversight?) by attaching part of its own original source code into the Mobile release, available for iOS and Android devices. A year later, the so-called official compiler, somewhat customized for the sake of convenience, was shipped via the remastered edition of Vice City. As far back as 2001, a snip of some debugging scripts has been already provided with main.sc and debug.sc script files that were allegedly meaningful for a sort of script version checker uncut on debug builds. Nonetheless, many secrets are still unrevealed, thus some stuff cannot be fully documented at the moment, hopefully, and so they can be merely guessed. The .scm format abbreviation is one of countless proofs of such a downside which probably stands for Script Multifile, while .scc might be in turn the short form of Compiled Script. No doubt comes with source files, whose .sc extension is the contraction of Mission Script. Although we have enough information to suppose the currently unknown mysteries of the used language, we still have no safe clue about what was its original denomination. Furthermore, it is a matter of fact that R* developers have been left intact the miss2 executable filename of third generation compilers since the chapter 2. In this connection, we could imagine the newer language is a variant or an evolution of the GTA2script which label, initially referred to as GBHscript, expressly popped up in the ancient documentation by DMA Design Ltd. (at present Rockstar North). On those grounds, we are almost sure to say the name of the scripting language targeting each game with all peculiar but minimal enhancements or regressions is most likely GTA3script (as-is casing) for III, GTAVCscript for Vice City, GTASAscript for San Andreas, GTALCSscript for Liberty City Stories and lastly GTAVCSscript for Vice City Stories. However, it is definitely based on BASIC.

Fundamentals

Comments

Codes are usually self-explanatory for the author but large sources can compromise everyone's management capability, that means some annotation can save much time on the long-term particularly when being stuck trying to understand old stuff which should never happen in the first place, not to mention team mates would certainly blame the original writer on each revision and slow down the completion of cooperative projects. Sometimes, it is also required to temporarily/permanently disable code lines for testing purposes. Fortunately, the language supports the following typologies of comments:

  • Line comment, prefixed with // (two forward slashes), which extends till the end of the line. Everything is ignored inside: // Some comment.;
  • Block comment, enclosed with a pair of /* (a slash plus an asterisk) and */ (the other way around), which embodies a circumscribed text area. Several blocks can be nested together: /* Some /* comment */ . */.

Delimiters

Conventionally, lines can be splitted into various regions in order to enhance the code legibility through bracket-delimited and/or comma-separated elements. As being pure whitespaces, the opening parenthesis delimiter doesn't necessarily need to match the closing counterpart and viceversa. The only tangible use of separators carried out in public sources is related to inline declaration of multiple variables, text keys of print-commands and SETUP_ZONE_PED_INFO but codes can be organized to one's liking. Here are some demonstrations:

VAR_INT joeys_buggy, swank_taxi
PRINT_NOW (ASUKA) 2000 1
SETUP_ZONE_PED_INFO CHINA DAY (30) 350 600 0 (0 0 0 0) 0

Integers and Floating-points

Numeric values are used extensively throughout the whole script following no particular notation besides the decimal one. The specializing number representation tells whether a literal is an integer or a floating-point value: an appending f or F floatifies a number, whose suffix becomes superfluous if a radix point, discerning decimals from integral digits, is supplied. Float parts are alternatively omissible hence a 0 digit is implied if one and only one of them is missing. Literal parsing starts from the minus sign, radix point or number digit and stops at the first non number character after a series of digits, leading and/or trailing an eventual radix point, or float suffix. To sum things up, these values are valid numbers: 1, -0, 1f, -0f, 1.0, 1.0f, 1., 1.f, .0, .0f and also 1-2 (ill-formed on basic or compound assignments), 1..2, 1f2, producing 1 (1f-2 is ill-formed a priori). In the first Trilogy chapter, the fixed-point format was chosen meaning precision was guaranteed to not get lost if the decimal part wasn't lesser than just one-tenth.

Labels, Text labels and Strings

Thanks to the beneficial code fragmentation, the source is subject to script file inclusions, favouring modularity, and sparse goto branches, involving embedded code blocks diversification. Both kinds of partitioning are accomplished respectively through the specification of:

  • Filenames, that is special labels which somehow resemble legit pathnames, starting with any valid pathname character but not containing whitespaces. They are relative to the root path deriving from the .sc extension removal of the main script full path where files are searched in by default: X:\folder\main. Subfolders are scanned as well:
    • Till the first tree level if inside one of the subdirectories: X:\parent\main\child;
    • Till the second tree level if inside one of the parent directories: X:\parent or X:\parent\main;
    • Indefinitely (unlimited recursion till the maximum path length allowed).
The .sc extension at the end of filenames is mandatory else an argument mismatch is warned, by contrast the main script can have any extension to which m (multifile) or c (compiled) is appended in the target pathname. Due to a Cd image system limitation, all sorts of filename must be shorter than 20 characters and conventionally they must be free of extra dots for streamed scripts;
  • Labels, that is unique identifiers suffixed by a colon which identify a precise location of the source code representing the target position of goto-like, script starter, subroutine or function caller commands: my_label: (on a new line). Weirdly enough, they may begin with any character alike filenames or be empty despite being susceptible to the same restrictions of string identifiers whenever passed as arguments but, regardless, must not exceed 39 characters (colon included, yet blanked out) and whereas these are not commands, anything else can follow next to and be inlined so long as a splitting character is inserted.
Labels store a reference depicting either an absolute address falling within the main script space (including main extensions and generic subscripts) or a relative and negative address pointing to a place of the mission script space or that of a particular streamed script. Albeit addresses are zero-based anyway, it is discouraged to use a WHILE construct at or branch by hand to the almost very top of a mission/streamed script file or even communicate between different script spaces with gotos.

That said, labels are basically user-supplied identifiers whose existence is verified. The text label or text string counterpart is not fully compliant to this standard (script names are exempt, for instance) since string identifiers are massively employed as main/mission text keys or whatever referring to an internal resource, which the game handles according to a well-defined associative scheme. As a general rule, these are primarily supposed to be at most 7 characters long and must begin with a letter and never end with a colon or either begin with an underscore or an alphanumeric character in the last Trilogy and Stories chapter where text label variables are supported, provided that here their literals are not valid integer or floating-point numbers taking the precedence over string identifiers on parsing:

LOAD_SPECIAL_CHARACTER 1 eight
CUSTOM_PLATE_FOR_NEXT_CAR CAR_TAMPA _FELTCH_
SCRIPT_NAME 99red

In the last Trilogy chapter and nowhere else, longer text labels were introduced, some sort of Pascal strings having a variable length of maximum 40 characters for literals or a fixed length of 16 bytes for variables, twice as big as the shorter text label ones. Speaking of which, it is prohibited to get or handle a longer text label using a variable of shorter length but this one is rather passable to those text label parameters also permitting long-lengthed literals. Notoriously, identifiers length is anything but expensive for readability reasons, in addition they do not even offer the ability to insert whitespaces or other inadmissible characters owing to the by-design absence of delimiting tokens. At this matter, debug texts are sent as 127-character string literals enclosed by double quotes:

SAVE_STRING_TO_DEBUG_FILE "current_wanted_list = "

These quoted strings are, in essence, made up of four text labels aligned to 32 bytes (at the highest power of two possible per parameter) individually accessible as a result of a compiler bug, cause the first character of each literal-only argument is trimmed out as a quotemark – during the line reconstruction phase, the opening and closing quotemarks along with   / , ( )\t are swapped to A \0 \xD1-\xD6 and back again on code generation (the NUL-terminator at the end of string literals makes them rightmost arguments, ignoring the rest).
Unlike string literals, empty text labels are impracticable though $ alone compiles a NUL-string identifier in the last Stories chapter[no source] – as reported by some indiscreet speculations, the rearrangement of crucial commands signals a syntax enhancement the language has undergone which sees delimited strings superseding text labels, lowly probable because string constants are still disallowed for multi-type parameters. In San Andreas, text labels are implicitly comparable against NUL-string identifiers but no syntactical facility accommodates an explicit use.
It's worth noting text labels and string literals are not interchangeable because of their syntactic differences even if they present semantic similarities, moreover text labels do not ever interfere with command names and string constants. A final quirk to note concerning labels as a whole is they are automatically converted to upper case: this obvious evidence proves identifiers and whatnot are all case insensitive with the exemption that string literals are left as-is for remastered game builds.

Data types

Forasmuch as the language obeys the strong typing paradigm, the syntactic elements that denote a value during execution do have fixed data types, most of which are appended as a suffix at variable declaration. Their conspicuous assortment is listed below:

Name Format Size Range Is
main
Is
basic
Derivative data types Immediate
support
Variable
support
NONE
LABEL String identifier
(translated to address)
1, 2 or 4 1 to 38 Since GTA III
Filename
(translated to address or index)
1 to 19
INT Signed integer -2n-1 to 2n-1-1
(where n is 8, 16 or 32)
VAR_INT, VAR_INT_OPT,
LVAR_INT, LVAR_INT_OPT,
(Vice City Stories apart)
INPUT_INT, OUTPUT_INT
Since GTA III
FLOAT Q11.4 fixed-point
(III only)
2 -211 to 211-2-4 VAR_FLOAT, VAR_FLOAT_OPT,
LVAR_FLOAT, LVAR_FLOAT_OPT,
(Vice City Stories apart)
INPUT_FLOAT, OUTPUT_FLOAT
IEEE-754 floating-point
(packed in Stories)
1-4 ±2-126 to ±2127(2-2-23)
TEXT_LABEL String identifier
(NUL-terminated)
8 1 to 7 VAR_TEXT_LABEL, VAR_TEXT_LABEL_OPT,
LVAR_TEXT_LABEL, LVAR_TEXT_LABEL_OPT,
(Vice City Stories apart)
INPUT_TEXT_LABEL, OUTPUT_TEXT_LABEL
(Vice City Stories only)
Since GTA III San Andreas and Vice City Stories
TEXT_LABEL16 String identifier
(if non variable-only, accepts
TEXT_LABEL variables)
9-41
(Pascal string)
8 to n
(where n is <= 40)
VAR_TEXT_LABEL16, VAR_TEXT_LABEL16_OPT,
LVAR_TEXT_LABEL16, LVAR_TEXT_LABEL16_OPT
San Andreas only
16 1 to 15
TEXT_LABEL32 String identifier
(NUL-terminated)
32 1 to 39
(bugged)
San Andreas only
String literal
(NUL-terminated)
32×4 1 to 127
INPUT
(optional)
Includes INT and FLOAT
Includes TEXT_LABEL
(Vice City Stories only)
STRING
(internal only)
Label,
Variable name,
String constant[*],
Text labels,
Quoted string
UNKNOWN

^ String constants are only compatible with INPUT_INT data type but default constants favour INT regardless.

Immediates and Variables

Data can take the appearance of a few expressions varying from numeric, text label and string literals each of which occupies a certain area of storage with unfixed size. Immediates can also be preserved for later use and therefore reserve space over the private script memory corresponding to a variable. The strongly-typed language property imposes to explicitly declare variables anywhere in the current scope, namely the context inside which they are visible for usage. Sensibly, declarations should figure beforehand but likewise it is allowed for accessing backward declarations. Variables accessible from any location are marked as globals (starting from offset 8 or more, occupying lots of space in the script multifile, up to 64 kibibytes) and their declaration is achieved by prepending the VAR wording followed by one of the basic data types (multiple declarations of the same type can be inlined), both separated by an in-between underscore:

VAR_INT player scplayer
VAR_FLOAT x_float, y_float, z_float
VAR_TEXT_LABEL interior_name
VAR_TEXT_LABEL16 shop_item

Globals are capable of being selectively marked as saveable using the SAVE_VAR prefix, in order to restore their value on savegame loading and free generic variables. In Trilogy chapters, if enabled properly in a hacky manner, these are solely common variable declarations with no additional purpose, a plan not gone through. On the other hand, globals declared within the mission context are not visible outside in Stories chapters since they overlap the same space, making a discernment among true and al-most globals. However, there's no exact rule for variable naming apart they must begin with a specific character and never end with a colon just like string identifiers, expanding till a maximum of 39 characters. It's preferable definitions shall not contain operator tokens to prevent any parsing ambiguity plus, most importantly, they must not conflict with string constants and local timers. Nevertheless, text labels and variable names semantics may collide: in this case, the formers have priority over the latters unless a preceding dollar sign is added:

PRINT_BIG TEXTKEY 5000 2  // Compiles a text label literal.
PRINT_BIG $textkey 5000 2 // Compiles a text label variable.

Despite variables are freed and zero-initialized at runtime on new/load game or script allocation in broad terms, statistical information are still gathered whenever they are read before being written, besides if they are never read or never written (passing a variable as reference has no effect onto the content). Furthermore, if a variable is set to hold an entity handle (alias unique index) returned by a specific create-command it cannot be assigned to any other entity-command of different kind or none, including the forseeable assignment operations. This restriction propagates on script and function callings as well: starting/streaming the same script or calling the same function multiple times with variables of dissimilar entity types is forbidden if triggers are encountered prior the script or function lexical scope is fetched, in which case entities are explicitly initialized in the form of unreachable code:

{
    LVAR_INT fellow_char robbery_car money_bag sanity

    sanity = 0
    IF sanity = -1
        CREATE_CHAR PEDTYPE_CIVMALE male01 0f 0f 0f fellow_char
        CREATE_CAR admiral 0f 0f 0f robbery_car
        CREATE_OBJECT woodenbox 0f 0f 0f money_bag
    ENDIF
}

Lexical scope

Once a script is launched, a local storage space consisting of a context-dependent set of variables (16+2 in III/Vice City, 32+2 in San Andreas and 40+2 on Mobile, 96+8+2 in Stories) ready for use is also reserved. As opposed to global variables, locals have visibility only inside a particular region of the source code and are preceded by the LVAR wording at declaration within a nonnestable block embraced by { and }:

{
    LVAR_INT pickup message_num
}

Local names do not override global definitions, they must not collide together otherwise a warn is issued. Beyond user-defined locals, predefined TIMERA and TIMERB variables are provided: these timers measures the playing time milliseconds passed since the script beginning but they can be reset just fine. In the last Trilogy chapter, mission locals are mainly static variables starting from index 34 or 42 on Mobile whose space (having a size of 4 kibibytes) is shared among each mission thus being reasonably more abundant in this scenario but, as a side effect, local timers are unavailable. Transferring the control over and above the lexical scope boundaries or to another multiscript leaves the active context and hides local definitions, thereby switching across lexical scopes is bad practice and can lead to unpredictable results if contexts are not strictly equivalent in the variable declarations.

Arrays

Since the last Trilogy chapter, instead of declaring multiple scalar variables of same type, a one-dimensional indexed array can be defined. Each element is accessed through either a zero-based[no source] positive number or a variable index (local-only in Stories) in a subscript expression on assignment or argument passing. On declaration, a pair of square brackets enclose the array size which mustn't be bigger than 255 units:

VAR_INT prop_assets[32]
CREATE_FORSALE_PROPERTY_PICKUP -1969.27 282.47 34.6 50000 PROP_3 prop_assets[0]

In sooth, one-based arrays were already supported in the second Trilogy chapter but in a manner which is defective and incomplete: they missed the intrinsic data type, giving no reference point on how to interpret the compiled operands, producing corrupted intermediate code because of fall-through reading. There is no precedent to safely assert that arrays became zero-based later on the language evolution but what is certain is this sort of indexing lines up immediate with variable indices. Oddly, as a result of the uni-dimensionality constraint implementation, a complementary yet nonfactual identifier can follow the closing bracket immediately afterwards with no redundancy notice (i.e. prop_assets[0]anything). Moreover, scalar variables have an implicit array size of one element which is needlessly accessible and plus the index part of the first element of an array is in turn omissible, everything notwithstanding the misleading declaration. Granted that brackets do not encompass any separator character or identifiers wider than 39 characters, array indices reject string constants but admit local timers.

String constants

Very often, numeric literals express arbitrary values which are far from being self-documenting without descriptive labels belonging to a list of predefined names. These strings or enumerators are guaranteed to store an immutable constant and must forcibly pertain to the required enumeration if passed as arguments unless, if and only if no enumeration is set, the enumeration-free default constants TRUE/FALSE, ON/OFF, DAY/NIGHT or KILLFRENZY enumerators are supplied:

CHANGE_BLIP_DISPLAY blip1_jm1 BLIP_ONLY
flag_car_blip_displayed_jm1 = TRUE

Assignments and comparisons do not suffer such a restriction and, what's more, in case of too long lines (wider than 255 characters) immediates can safely replace string constants to shorten the exceeding length and fall within the limits. Of course, string constants are bound to the same parsing rules as string identifiers but, as being mainly hardcoded, they are just as limitless in length.
During the development stage, the game's map experiences lots of continuous changes that make the management of objects, as a result of having a fixed indexing, pretty awkward without taking into account their bulk amount. In this respect, parameters expecting level objects are able to define the used objects (no more longer than 23 characters) under the hood, bringing them together in a sorted array whose criteria depends on the order of their appearance, something other than the default models which are hardcoded (for peds, cars, weapons, wheels, cutscene objects and the like). A blank, unavailable object is always reserved, shifting ahead each next negated position becoming one-based. Negative indices assure models fit in the used objects array, according to which the runtime matches the right index through a lookup table:

REQUEST_MODEL bridgefuka // First use ever. It compiles -1 from now on.
REQUEST_MODEL bridgefukb // First use again. This time it compiles -2.
LOAD_ALL_MODELS_NOW
CREATE_OBJECT_NO_OFFSET bridgefuka 715.746 -937.908 40.194 damagea
CREATE_OBJECT_NO_OFFSET bridgefukb 787.835 -939.24 38.971 damageb

The lack of error-checking requires a meticulous handwriting to avoid script deadlocks at runtime, the reason why default models of which undefined names follow the format NOT_USED%d (where %d is a model index from 0 to 299) and level objects are loaded straight from IDE files for Vice City's remastered build. Nonetheless, iterating among several objects can be very expensive for a poorly optimized, rough compiler even on fast machines, not to mention enumerators are likely to collide without specializing prefixes (i.e. SNIPER camera mode and weapon name, formerly WEAPON_SNIPER), enough to revert back thereafter.
Assignments and comparisons have no clue about used objects and are therefore not designed to accommodate or implicitly define one on their own, because they are supposed to be strict with the identifier existence as being more prone to work out with variables. This concept somehow extends to those parameters not featuring used objects as a general rule. If an unusual application needs to take place, making use of non-inlined CONSTANT_INT declarations would hint the compiler to treat unequivocally the specified string constants as used objects, truly defining a new one on the first practical usage wherever it occurs and not yielding an undefined variable error:

CONSTANT_INT cj_pizza_1
CONSTANT_INT cj_pizza_2
VAR_INT food_model1 food_model2

REQUEST_MODEL pizzahigh  // -1
food_model1 = cj_pizza_1 // -2
food_model2 = cj_pizza_2 // -3
REQUEST_MODEL food_model1
REQUEST_MODEL food_model2

Any string constant passed in place of an object model compiles a used object indiscriminately assuming no CONSTANT_INT declaration, also preventing redefinitions towards default constants, enumerators and variable names, does exist. Messing around with frequent compiler tool recompilations can be tedious solely to establish broad, same-indexed or math-related string constants but fortunately, in the last Trilogy chapter, the language offers the opportunity to settle user-supplied default constants for numeric literals using CONST-prefixed declarations (maximum 39 characters long) which, alike for variables and CONSTANT_INTs, are backwards accessible:

CONST_INT gf_date_active 1
CONST_FLOAT math_pi 3.1415927

SET_BIT gf_date_flags gf_date_active
rad_angle = deg_angle * math_pi
rad_angle /= 180.0

Given that default models are also default constants in Stories chapters[no source], default constants and used objects count as pseudoconstants: contrary to what non-default enumerators entail, generic alternatives are favoured on assignment or comparison command matching. It should be pointed out that, due to a critical compiler bug, the high-order word of the value held by any enumerator is unexpectedly discarded on assignment or comparison and that, if set, the 16th bit yields a nonexistent variable error (i.e. THREAT_GANG9 flag) prior Stories chapters, after which a default constant is compiled instead (buggy behaviour) and recognized only if the low-order word represents a value not equal to -1[no source]:

Mission script Script multifile
SET_CHAR_THREAT_SEARCH npc_char THREAT_GANG_GOLFER
SET_CHAR_THREAT_SEARCH npc_char THREAT_GANG9
SET_CHAR_THREAT_SEARCH npc_char THREAT_EMERGENCY
threat_flag = THREAT_GANG_GOLFER
threat_flag = THREAT_GANG9 // Ill-formed in Trilogy.
threat_flag = THREAT_EMERGENCY
SET_CHAR_THREAT_SEARCH npc_char 16384
SET_CHAR_THREAT_SEARCH npc_char 32768
SET_CHAR_THREAT_SEARCH npc_char 65536
SET_VAR_INT_TO_CONSTANT threat_flag 16384
SET_VAR_INT threat_flag 32768
SET_VAR_INT_TO_CONSTANT threat_flag 0

This drawback unwittingly affects real code in Liberty City Stories in one circumstance. On a final note, string constants are incompatible with optional arguments and thus taking advantage of a temporary variable would overcome this syntactic limitation.

Operators

As soon as a numeric or text label variable is declared, it can be subjected to algebric operations and/or logical comparisons by virtue of several operators. Their support is sadly very primitive, in fact the ability to establish complex expressions with parentheses and such is not featured albeit one and only binary operation is enabled to follow the basic assignment. In this regard, the variable being assigned to the lvalue cannot be the same as the outer rvalue for non-commutative operations: VAR1 = THING - VAR1, VAR1 = THING / VAR1, VAR1 = THING +@ VAR1 and VAR1 = THING -@ VAR1 are all ill-formed (where THINGVAR1). This issue arises because the explicit usage of a temporary variable is needed which would be harmful for the compiler to waste by itself under the hood, thus here expressions are necessarily made up of distinct two-operand instructions, that is the lvalue content is initialized prior encoding any supplementary rvalue arithmetic:

Mission script Script multifile
VAR1 = 1 - VAR1 // Invalid, cause VAR1 = 1; VAR1 -= VAR1 doesn't make sense.
                // It would perform 1 - 1 = 0. Workaround needed.
VAR1 = 1 / VAR1 // Invalid, cause VAR1 = 1; VAR1 /= VAR1 does no effect.
                // It would perform 1 / 1 = 1. Workaround needed.
VAR1 = 1 - VAR2 // Valid, cause VAR1 = 1; VAR1 -= VAR2 doesn't null itself like above.
                // It performs x = 1 - y.
VAR1 = 1 + VAR1 // Valid, addition (as well as multiplication) is commutative so VAR1 += 1.
                // It performs x = x + 1.
NEGATE VAR1 // Unknown command (speculative). It would do x = -x.
ADD_THING_TO_THING VAR1 1
ONEOVER VAR1 // Unknown command (speculative). It would do x = 1 / x.
MULT_THING_BY_THING VAR1 1
SET VAR1 1
SUB_THING_FROM_THING VAR1 VAR2
ADD_THING_TO_THING VAR1 1

The subtraction of positive or negative rvalues necessitates a splitting character in order to discern the infix operator unambiguously, which would be treated as part of the literal or a variable decrement otherwise (i.e. VAR1 = VAR1 -1 or VAR1 = VAR1 --1). Typically, string constants are not suitable for math calculations because of the lack of matchable alternative commands but even so they are semantically contemplated as long as a non-default enumerator is provided as the inner rvalue of a ternary operation or a default constant or enumerator is passed to any rvalue (i.e. VAR1 = PAD1 + 1, VAR1 = DAY + 1 or VAR1 = 1 + KILLFRENZY_INITIALLY). Another clear limitation is prefix and postfix operators do not apply onto arguments, hence there's no concrete differentiation. However, the language introduces the timed addition/subtraction to looply update a variable in a frame-rate independent way, the cast assignment to do a mutual conversion between integers and floats but it doesn't give support for the modulo operation as its predecessor. The inequality comparison was planned but quickly gone obsolete[no source] – availing of the negated form of the equality operator would have sounded more intuitive but one should be aware the not-flag is not bundled with the command index when matching alternative commands. Due to a negligence of the programmers in charge, liable for forgetting some assets of the scripting environment, the local-global in/equality comparison between integer or float variables is not feasible except in the last chapter of Trilogy and Stories series. Surprisingly enough, the basic assignment may prepend ABS which in so doing would be capable of receiving numeric literals because of the pre-empted rvalue assigning (i.e. VAR = ABS THING). In principle, SET is not compiled only if both lvalue and rvalue (whether inner or outer) of a ternary operation or ABS assignment collide (identity).

Arithmetic operators

Name Syntax INT FLOAT TEXT_LABEL/16
Basic assignment
VAR = THING
Addition
THING + THING
Subtraction
THING - THING
Multiplication
THING * THING
Division
THING / THING
Timed addition
THING +@ THING
Timed subtraction
THING -@ THING
Increment Prefix
++ VAR
Postfix
VAR ++
Decrement Prefix
-- VAR
Postfix
VAR --

Compound assignment operators

Name Syntax Meaning INT FLOAT
Addition assignment
VAR += THING
VAR1 = VAR1 + THING
Subtraction assignment
VAR -= THING
VAR1 = VAR1 - THING
Multiplication assignment
VAR *= THING
VAR1 = VAR1 * THING
Division assignment
VAR /= THING
VAR1 = VAR1 / THING
Timed addition assignment
VAR +=@ THING
VAR1 = VAR1 +@ THING
 
Timed subtraction assignment
VAR -=@ THING
VAR1 = VAR1 -@ THING
Cast assignment
VAR =# THING
AS IS

Comparison operators/relational operators

Name Syntax INT FLOAT TEXT_LABEL/16
Equal to
VAR = THING
Not equal to[no source]
VAR <> THING
Greater than
THING > THING
Less than
THING < THING
Greater than or equal to
THING >= THING
Less than or equal to
THING <= THING

Logical operators

Name Syntax
Logical negation
NOT
Logical conjunction
AND
Logical disjunction
OR

Commands

The imperative programming paradigm provides for a conglomerate of commands the script is filled up of and structured in, which are seen as orders to instruct the execution of the relative built-in portion of game code at runtime. Their invocation is faithful to procedure calls: they may feature zero or more parameters (up to 16+ in III\Vice City, 32+ in San Andreas and Stories) of any type or indefinite, depending on whether or not qualified as optional, and receive as much as arguments either by-value or by-reference affecting the read/written access accordingly (do note a pure reference does not initialize anything). Alike procedures, no assignable result is returned but a boolean state is caught anyway on conditional evaluation. One major peculiarity is command names are usually identified by a verb in its imperative form:

GIVE_WEAPON_TO_CHAR mafia_1X WEAPONTYPE_UZI 999

Command names are leftmost identifiers not ending with a colon (not a label) and not preceded or followed by an operator token (not a variable). On code generation, their definition is turned into a 15-bit index reflecting the position the name is matched at in a list of command descriptors and packed with the not-flag stored in the most significant bit, accompained by a known or indeterminate number of typified, somewhat typified or thorougly nontypified operands completing several instructions which are arranged in order to bring forth the intermediate script bytecode. At every command corresponds an output except for variable, string constant and lexical scope declarators or for the classic NOP (no operation). Operand immediates mainly use the shortest representation for size optimization, yet label references always yield 32-bit addresses.
Game progress rely on many countable stuff to determine the percentage acquired at any given time which are extremely time spending and easily error-prone to quantize manually. Counter-commands come to aid, sort of adaptive counters featuring a possibly zero-valued argument updated automatically during the compilation process that keeps track of the times a few commands are used or of the total sum of some argument value of certain commands, discarding nonimmediates:

Initializer Dependency Is
addend
SET_COLLECTABLE1_TOTAL CREATE_COLLECTABLE1
SET_PROGRESS_TOTAL PLAYER_MADE_PROGRESS
SET_TOTAL_NUMBER_OF_MISSIONS REGISTER_MISSION_PASSED
REGISTER_ODDJOB_MISSION_PASSED
SET_MISSION_RESPECT_TOTAL AWARD_PLAYER_MISSION_RESPECT

Condition-based statements and counter-commands along with the file includers outside of the main script or main extensions, where labels are expected instead of filenames, are mostly parameterized regardless of their own descriptor (the type-check is still done though), while another category consisting of multicommands is able to look for the matching prototype into a list of akin commands on the basis of the data type of the passed arguments and choose, accordingly, the equivalent alternative in a direct and effortless way. Although the alternative commands are also accessible by and can share the same definition, the selection process is not entirely conform to function overloading because these still retain their exclusive name as being plainly resolved through weak aliases. A complete listing is shown below:

Trilogy and first Stories chapters Second Stories chapter
Command Game
support
Alternative
SET (=) Since GTA III
SET_VAR_INT
SET_VAR_FLOAT
SET_LVAR_INT
SET_LVAR_FLOAT
SET_VAR_INT_TO_VAR_INT
SET_LVAR_INT_TO_LVAR_INT
SET_VAR_FLOAT_TO_VAR_FLOAT
SET_LVAR_FLOAT_TO_LVAR_FLOAT
SET_VAR_FLOAT_TO_LVAR_FLOAT
SET_LVAR_FLOAT_TO_VAR_FLOAT
SET_VAR_INT_TO_LVAR_INT
SET_LVAR_INT_TO_VAR_INT
SET_VAR_INT_TO_CONSTANT Since Vice City
SET_LVAR_INT_TO_CONSTANT
SET_VAR_TEXT_LABEL San Andreas only
SET_LVAR_TEXT_LABEL
SET_VAR_TEXT_LABEL16
SET_LVAR_TEXT_LABEL16
CSET (=#) Since GTA III
CSET_VAR_INT_TO_VAR_FLOAT
CSET_VAR_FLOAT_TO_VAR_INT
CSET_LVAR_INT_TO_VAR_FLOAT
CSET_LVAR_FLOAT_TO_VAR_INT
CSET_VAR_INT_TO_LVAR_FLOAT
CSET_VAR_FLOAT_TO_LVAR_INT
CSET_LVAR_INT_TO_LVAR_FLOAT
CSET_LVAR_FLOAT_TO_LVAR_INT
ADD_THING_TO_THING (+=) Since GTA III
ADD_VAL_TO_INT_VAR
ADD_VAL_TO_FLOAT_VAR
ADD_VAL_TO_INT_LVAR
ADD_VAL_TO_FLOAT_LVAR
ADD_INT_VAR_TO_INT_VAR
ADD_FLOAT_VAR_TO_FLOAT_VAR
ADD_INT_LVAR_TO_INT_LVAR
ADD_FLOAT_LVAR_TO_FLOAT_LVAR
ADD_INT_VAR_TO_INT_LVAR
ADD_FLOAT_VAR_TO_FLOAT_LVAR
ADD_INT_LVAR_TO_INT_VAR
ADD_FLOAT_LVAR_TO_FLOAT_VAR
SUB_THING_FROM_THING (-=) Since GTA III
SUB_VAL_FROM_INT_VAR
SUB_VAL_FROM_FLOAT_VAR
SUB_VAL_FROM_INT_LVAR
SUB_VAL_FROM_FLOAT_LVAR
SUB_INT_VAR_FROM_INT_VAR
SUB_FLOAT_VAR_FROM_FLOAT_VAR
SUB_INT_LVAR_FROM_INT_LVAR
SUB_FLOAT_LVAR_FROM_FLOAT_LVAR
SUB_INT_VAR_FROM_INT_LVAR
SUB_FLOAT_VAR_FROM_FLOAT_LVAR
SUB_INT_LVAR_FROM_INT_VAR
SUB_FLOAT_LVAR_FROM_FLOAT_VAR
MULT_THING_BY_THING (*=) Since GTA III
MULT_INT_VAR_BY_VAL
MULT_FLOAT_VAR_BY_VAL
MULT_INT_LVAR_BY_VAL
MULT_FLOAT_LVAR_BY_VAL
MULT_INT_VAR_BY_INT_VAR
MULT_FLOAT_VAR_BY_FLOAT_VAR
MULT_INT_LVAR_BY_INT_LVAR
MULT_FLOAT_LVAR_BY_FLOAT_LVAR
MULT_INT_VAR_BY_INT_LVAR
MULT_FLOAT_VAR_BY_FLOAT_LVAR
MULT_INT_LVAR_BY_INT_VAR
MULT_FLOAT_LVAR_BY_FLOAT_VAR
DIV_THING_BY_THING (/=) Since GTA III
DIV_INT_VAR_BY_VAL
DIV_FLOAT_VAR_BY_VAL
DIV_INT_LVAR_BY_VAL
DIV_FLOAT_LVAR_BY_VAL
DIV_INT_VAR_BY_INT_VAR
DIV_FLOAT_VAR_BY_FLOAT_VAR
DIV_INT_LVAR_BY_INT_LVAR
DIV_FLOAT_LVAR_BY_FLOAT_LVAR
DIV_INT_VAR_BY_INT_LVAR
DIV_FLOAT_VAR_BY_FLOAT_LVAR
DIV_INT_LVAR_BY_INT_VAR
DIV_FLOAT_LVAR_BY_FLOAT_VAR
IS_THING_EQUAL_TO_THING (=) Since GTA III
IS_INT_VAR_EQUAL_TO_NUMBER
IS_INT_LVAR_EQUAL_TO_NUMBER
IS_INT_VAR_EQUAL_TO_INT_VAR
IS_INT_LVAR_EQUAL_TO_INT_LVAR
IS_INT_VAR_EQUAL_TO_INT_LVAR
IS_INT_LVAR_EQUAL_TO_INT_VAR San Andreas only
IS_FLOAT_VAR_EQUAL_TO_NUMBER
IS_FLOAT_LVAR_EQUAL_TO_NUMBER
IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR
IS_FLOAT_LVAR_EQUAL_TO_FLOAT_LVAR
IS_FLOAT_VAR_EQUAL_TO_FLOAT_LVAR
IS_FLOAT_LVAR_EQUAL_TO_FLOAT_VAR San Andreas only
IS_INT_VAR_EQUAL_TO_CONSTANT Since Vice City
IS_INT_LVAR_EQUAL_TO_CONSTANT
IS_VAR_TEXT_LABEL_EQUAL_TO_TEXT_LABEL San Andreas only
IS_LVAR_TEXT_LABEL_EQUAL_TO_TEXT_LABEL
IS_VAR_TEXT_LABEL16_EQUAL_TO_TEXT_LABEL
IS_LVAR_TEXT_LABEL16_EQUAL_TO_TEXT_LABEL
IS_THING_NOT_EQUAL_TO_THING (<>) Since GTA III
IS_INT_VAR_NOT_EQUAL_TO_NUMBER
IS_INT_LVAR_NOT_EQUAL_TO_NUMBER
IS_INT_VAR_NOT_EQUAL_TO_INT_VAR
IS_INT_LVAR_NOT_EQUAL_TO_INT_LVAR
IS_INT_VAR_NOT_EQUAL_TO_INT_LVAR
IS_INT_LVAR_NOT_EQUAL_TO_INT_VAR San Andreas only
IS_FLOAT_VAR_NOT_EQUAL_TO_NUMBER
IS_FLOAT_LVAR_NOT_EQUAL_TO_NUMBER
IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_VAR
IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR
IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR
IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_VAR San Andreas only
IS_THING_GREATER_THAN_THING (>, <=) Since GTA III
IS_INT_VAR_GREATER_THAN_NUMBER
IS_INT_LVAR_GREATER_THAN_NUMBER
IS_NUMBER_GREATER_THAN_INT_VAR
IS_NUMBER_GREATER_THAN_INT_LVAR
IS_INT_VAR_GREATER_THAN_INT_VAR
IS_INT_LVAR_GREATER_THAN_INT_LVAR
IS_INT_VAR_GREATER_THAN_INT_LVAR
IS_INT_LVAR_GREATER_THAN_INT_VAR
IS_FLOAT_VAR_GREATER_THAN_NUMBER
IS_FLOAT_LVAR_GREATER_THAN_NUMBER
IS_NUMBER_GREATER_THAN_FLOAT_VAR
IS_NUMBER_GREATER_THAN_FLOAT_LVAR
IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR
IS_FLOAT_LVAR_GREATER_THAN_FLOAT_LVAR
IS_FLOAT_VAR_GREATER_THAN_FLOAT_LVAR
IS_FLOAT_LVAR_GREATER_THAN_FLOAT_VAR
IS_INT_VAR_GREATER_THAN_CONSTANT Since Vice City
IS_INT_LVAR_GREATER_THAN_CONSTANT
IS_CONSTANT_GREATER_THAN_INT_VAR
IS_CONSTANT_GREATER_THAN_INT_LVAR
IS_THING_GREATER_OR_EQUAL_TO_THING (>=, <) Since GTA III
IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER
IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER
IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR
IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR
IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR
IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_LVAR
IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_LVAR
IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_VAR
IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_NUMBER
IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_NUMBER
IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR
IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_LVAR
IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR
IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR
IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR
IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_VAR
IS_INT_VAR_GREATER_OR_EQUAL_TO_CONSTANT Since Vice City
IS_INT_LVAR_GREATER_OR_EQUAL_TO_CONSTANT
IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_VAR
IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_LVAR
ADD_THING_TO_THING_TIMED (+=@) Since GTA III
ADD_TIMED_VAL_TO_FLOAT_VAR
ADD_TIMED_VAL_TO_FLOAT_LVAR
ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR
ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR
ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR
ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR
SUB_THING_FROM_THING_TIMED (-=@) Since GTA III
SUB_TIMED_VAL_FROM_FLOAT_VAR
SUB_TIMED_VAL_FROM_FLOAT_LVAR
SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR
SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_LVAR
SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR
SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR
ABS Since GTA III
ABS_VAR_INT
ABS_LVAR_INT
ABS_VAR_FLOAT
ABS_LVAR_FLOAT
IS_EMPTY San Andreas only
IS_VAR_TEXT_LABEL_EMPTY
IS_LVAR_TEXT_LABEL_EMPTY
IS_VAR_TEXT_LABEL16_EMPTY
IS_LVAR_TEXT_LABEL16_EMPTY
IS_BIT_SET San Andreas only
IS_GLOBAL_VAR_BIT_SET_CONST
IS_GLOBAL_VAR_BIT_SET_VAR
IS_GLOBAL_VAR_BIT_SET_LVAR
IS_LOCAL_VAR_BIT_SET_CONST
IS_LOCAL_VAR_BIT_SET_VAR
IS_LOCAL_VAR_BIT_SET_LVAR
SET_BIT San Andreas only
SET_GLOBAL_VAR_BIT_CONST
SET_GLOBAL_VAR_BIT_VAR
SET_GLOBAL_VAR_BIT_LVAR
SET_LOCAL_VAR_BIT_CONST
SET_LOCAL_VAR_BIT_VAR
SET_LOCAL_VAR_BIT_LVAR
CLEAR_BIT San Andreas only
CLEAR_GLOBAL_VAR_BIT_CONST
CLEAR_GLOBAL_VAR_BIT_VAR
CLEAR_GLOBAL_VAR_BIT_LVAR
CLEAR_LOCAL_VAR_BIT_CONST
CLEAR_LOCAL_VAR_BIT_VAR
CLEAR_LOCAL_VAR_BIT_LVAR
Command
Alternative
SET (=)
SET_VAR_INT
SET_VAR_FLOAT
SET_VAR_TEXT_LABEL
SET_VAR_INT_TO_VAR_INT
SET_VAR_FLOAT_TO_VAR_FLOAT
SET_VAR_TEXT_LABEL_TO_VAR_TEXT_LABEL
SET_VAR_INT_TO_CONSTANT
CSET (=#)
CSET_VAR_INT_TO_VAR_FLOAT
CSET_VAR_FLOAT_TO_VAR_INT
ADD_THING_TO_THING (+=)
ADD_VAL_TO_INT_VAR
ADD_VAL_TO_FLOAT_VAR
ADD_INT_VAR_TO_INT_VAR
ADD_FLOAT_VAR_TO_FLOAT_VAR
SUB_THING_FROM_THING (-=)
SUB_VAL_FROM_INT_VAR
SUB_VAL_FROM_FLOAT_VAR
SUB_INT_VAR_FROM_INT_VAR
SUB_FLOAT_VAR_FROM_FLOAT_VAR
MULT_THING_BY_THING (*=)
MULT_INT_VAR_BY_VAL
MULT_FLOAT_VAR_BY_VAL
MULT_INT_VAR_BY_INT_VAR
MULT_FLOAT_VAR_BY_FLOAT_VAR
DIV_THING_BY_THING (/=)
DIV_INT_VAR_BY_VAL
DIV_FLOAT_VAR_BY_VAL
DIV_INT_VAR_BY_INT_VAR
DIV_FLOAT_VAR_BY_FLOAT_VAR
IS_THING_EQUAL_TO_THING (=)
IS_INT_VAR_EQUAL_TO_NUMBER
IS_INT_VAR_EQUAL_TO_INT_VAR
IS_FLOAT_VAR_EQUAL_TO_NUMBER
IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR
IS_TEXT_LABEL_VAR_EQUAL_TO_TEXT_LABEL
IS_TEXT_LABEL_VAR_EQUAL_TO_TEXT_LABEL_VAR
IS_INT_VAR_EQUAL_TO_CONSTANT
IS_THING_GREATER_THAN_THING (>, <=)
IS_INT_VAR_GREATER_THAN_NUMBER
IS_NUMBER_GREATER_THAN_INT_VAR
IS_INT_VAR_GREATER_THAN_INT_VAR
IS_FLOAT_VAR_GREATER_THAN_NUMBER
IS_NUMBER_GREATER_THAN_FLOAT_VAR
IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR
IS_INT_VAR_GREATER_THAN_CONSTANT
IS_CONSTANT_GREATER_THAN_INT_VAR
IS_THING_GREATER_OR_EQUAL_TO_THING (>=, <)
IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER
IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR
IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR
IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_NUMBER
IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR
IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR
IS_INT_VAR_GREATER_OR_EQUAL_TO_CONSTANT
IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_VAR
ADD_THING_TO_THING_TIMED (+=@)
ADD_TIMED_VAL_TO_FLOAT_VAR
ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR
SUB_THING_FROM_THING_TIMED (-=@)
SUB_TIMED_VAL_FROM_FLOAT_VAR
SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR
ABS
ABS_VAR_INT
ABS_VAR_FLOAT

Control flows

Insofar as subprograms, scripts are organized in a systematic arrangement through which goto branches, subroutine branches, function calls and returns or cutscene area markers are executed to form control flow statements and structures. These alter the program counter most of the time affecting the top-down order all commands are fetched by. Facing off code duplication is quite recurring especially when the tasks to perform vary only in the input data, the case where a piece of code or subroutine, built once in the source, is invoked many times from various different places and returns back, as if the GOSUB statement is substituted in-place by the subroutine's body without RETURN during the control transferring, to shrink long codes and reduce the script overall size. In the last Trilogy chapter, a region of code can be marked as a nonnestable cutscene area wherein the rest of commands within SKIP_CUTSCENE_START..SKIP_CUTSCENE_END is skipped to the pressure of some key/button at the next script tick. The flow of execution can also be broken up conditionally by means of:

  • Decision-making structures (IF, IFNOT, SWITCH), which evaluate the result of one or more conditions and choose what path to follow based off the trueness or falseness of the check being tested. Been deemed the most basic tool of structured programming, IF is a bidirectional statement that proceeds with the execution of the underneath code only if the test carried out evaluates to true otherwise it transfers the control next to ENDIF instantly, unless a preceding and optional ELSE clause, establishing an alternative path, is specified. In the first Trilogy and both Stories chapters where GOTO_IF_TRUE is handled by game code, the barely used IFNOT can be deployed as a placeholder to easily invert the compare-flag, a boolean state which is set or cleared as a result of the bitwise conjunction or disjunction with the true/false state caught by a condition, applying the inversion according to the presence of the not-flag before accumulating. Logical operators make possible the connection among multiple conditions via the AND conjunction and OR disjunction giving the chance to verify if conditions are all true or if just one of them is satisfied bearing in mind that the NOT negation, inverting the boolean state of a single condition, may be supplied. Connectivity information are held by ANDOR, whose argument depicts a value in the range [1,8) or [21,28) (end-inclusive in Stories) for logical conjunction and disjunction respectively, limiting the amount of total conditions to provide to a maximum of 8 per check (the prominent intervals discrepancy also suggests NAND and NOR operators might have been a plan at some point). A value of 0 does nothing relevant functional-wise at runtime, what led developers to not compile said command in such a situation for Stories chapters and also make the argument one-based so that it effectively counts the number of commands used in a multi-condition check. The inability to create subexpressions enforces not to combine AND with OR in a check, plus evaluations are eager and therefore not short-circuited meaning all conditions are executed prior potentially branching through GOTO_IF_FALSE in the common case after the compare-flag gets processed. IF-GOTO and IFNOT-GOTO constructs are also viable to inline a bogus one-way control transferer, targeting an arbitrary location, nearby a one-condition check with no end-ing statement.
Nesting lots of IF-ELSE-ENDIF structures of one-condition checks testing the equality of the same variable against a few integer literals or string constants can add a ridiculous code redundancy and performance overhead, sorted out in the last Trilogy chapter thanks to the introduction of the SWITCH statement, a multiway statement either branching to the switch section labelled by fall-through CASE statements of which one passses a value that shall match the variable content to compare or optionally branching to DEFAULT in the worst-case scenario, each ending with a nonmandatory BREAK statement goto-ing past ENDSWITCH. On compilation, the implementation somehow mimics the pattern of a jump table sorting case label references by value to fulfil the runtime's binary search among at least 1 of 75 entries (default case aside);
  • Looping structures (WHILE, WHILENOT, REPEAT), which repeatedly execute a block of code certain number of times or by constantly and successfully evaluating a check. The only condition-controlled loop statement featured is the widespread WHILE, a cyclical IF statement as well as IFNOT is for WHILENOT, repeating the embedded code over and over again if the verified check is true or till it becomes false when reaching ENDWHILE. Alongside well-known constructs the language supports a singular count-controlled structure, REPEAT-ENDREPEAT, looping some code at least once by advancing an integer variable at each iteration until the times specified (literal-only). Despite considered harmful in the programming literature for high-level programming languages, an unconditional branch is the only way to go for breaking loops beforehand and enhance paradoxically the simplistic code logic or for creating infinite loops with a backward GOTO.

Control flows intersection is, arguably, trouble-free and it's up to the writer to not ruin the code integrity, but still substatements must match the closest opening statement they belong to. Optimization is not of compiler concern meaning control flows are encapsulated as-is with no code reduction even for empty blocks, resulting in goto-es branching right after or piled up in sequence.

Subroutine structure: GOSUB

GOSUB subroutine
COMMAND
GOTO somewhere

subroutine:
COMMAND
RETURN

Cutscene area structure: SKIP_CUTSCENE_START and SKIP_CUTSCENE_END

Mission script Script multifile
// Formerly thought as MARK_CUTSCENE_START.
SKIP_CUTSCENE_START
    COMMAND
    WAIT 0
    COMMAND
// Formerly thought as MARK_CUTSCENE_END.
SKIP_CUTSCENE_END
// Formerly thought as CUTSCENE_SCROLL?
SKIP_CUTSCENE_START_INTERNAL SPECIAL_LABEL_SKIP_CUTSCENE_STARTS_0
    COMMAND
    WAIT 0
    COMMAND
SPECIAL_LABEL_SKIP_CUTSCENE_STARTS_0:
SKIP_CUTSCENE_END

Decision-making structures: IF and IFNOT

Mission script Script multifile
IF COMMAND
    COMMAND
ELSE
    COMMAND
ENDIF
ANDOR 0
COMMAND
GOTO_IF_FALSE SPECIAL_LABEL_IFS_ELSE_0
    COMMAND
    GOTO SPECIAL_LABEL_IFS_0
SPECIAL_LABEL_IFS_ELSE_0:
    COMMAND
SPECIAL_LABEL_IFS_0:
Mission script Script multifile
IF COMMAND
AND NOT COMMAND
    COMMAND
ENDIF
ANDOR 1
COMMAND
NOT COMMAND
GOTO_IF_FALSE SPECIAL_LABEL_IFS_1
    COMMAND
SPECIAL_LABEL_IFS_1:
Mission script Script multifile
IFNOT COMMAND
OR NOT COMMAND
    COMMAND
ENDIF
ANDOR 21
COMMAND
NOT COMMAND
GOTO_IF_TRUE SPECIAL_LABEL_IFS_2
    COMMAND
SPECIAL_LABEL_IFS_2:
Mission script Script multifile
IF COMMAND GOTO somewhere
ANDOR 0
COMMAND
GOTO_IF_TRUE somewhere
Mission script Script multifile
IFNOT COMMAND GOTO somewhere
ANDOR 0
COMMAND
GOTO_IF_FALSE somewhere

Decision-making structure: SWITCH

Mission script Script multifile
VAR_INT check
SWITCH check
    CASE 0
        COMMAND
        BREAK
    CASE 1
    CASE 3
        COMMAND
        BREAK
    CASE 2
        COMMAND
        BREAK
    CASE 4
    CASE 6
    CASE 5
    CASE 7
        COMMAND
        //BREAK
ENDSWITCH
SWITCH_START check 8 FALSE SPECIAL_LABEL_SWITCHES_0 0 SPECIAL_LABEL_SWITCHES_CASE_0_0 1 SPECIAL_LABEL_SWITCHES_CASE_1_0 2 SPECIAL_LABEL_SWITCHES_CASE_2_0 3 SPECIAL_LABEL_SWITCHES_CASE_1_0 4 SPECIAL_LABEL_SWITCHES_CASE_3_0 5 SPECIAL_LABEL_SWITCHES_CASE_3_0 6 SPECIAL_LABEL_SWITCHES_CASE_3_0
SWITCH_CONTINUED 7 SPECIAL_LABEL_SWITCHES_CASE_3_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0 -1 SPECIAL_LABEL_SWITCHES_0
SPECIAL_LABEL_SWITCHES_CASE_0_0:
    COMMAND
    GOTO SPECIAL_LABEL_SWITCHES_0
SPECIAL_LABEL_SWITCHES_CASE_1_0:
    COMMAND
    GOTO SPECIAL_LABEL_SWITCHES_0
SPECIAL_LABEL_SWITCHES_CASE_2_0:
    COMMAND
    GOTO SPECIAL_LABEL_SWITCHES_0
SPECIAL_LABEL_SWITCHES_CASE_3_0:
    COMMAND
    //GOTO SPECIAL_LABEL_SWITCHES_0
SPECIAL_LABEL_SWITCHES_0:
Mission script Script multifile
{
    LVAR_INT check
    SWITCH check
        CASE -2
        CASE -1
            COMMAND
            BREAK
        CASE 1
        CASE 2
            COMMAND
            BREAK
        CASE 0
        DEFAULT
            COMMAND
            //BREAK
    ENDSWITCH
}
SWITCH_START check 5 TRUE SPECIAL_LABEL_SWITCHES_DEFAULT_1 -2 SPECIAL_LABEL_SWITCHES_CASE_0_1 -1 SPECIAL_LABEL_SWITCHES_CASE_0_1 0 SPECIAL_LABEL_SWITCHES_DEFAULT_1 1 SPECIAL_LABEL_SWITCHES_CASE_1_1 2 SPECIAL_LABEL_SWITCHES_CASE_1_1 -1 SPECIAL_LABEL_SWITCHES_1 -1 SPECIAL_LABEL_SWITCHES_1
SPECIAL_LABEL_SWITCHES_CASE_0_1:
    COMMAND
    GOTO SPECIAL_LABEL_SWITCHES_1
SPECIAL_LABEL_SWITCHES_CASE_1_1:
    COMMAND
    GOTO SPECIAL_LABEL_SWITCHES_1
SPECIAL_LABEL_SWITCHES_DEFAULT_1:
    COMMAND
    //GOTO SPECIAL_LABEL_SWITCHES_1
SPECIAL_LABEL_SWITCHES_1:

Looping structures: WHILE and WHILENOT

Mission script Script multifile
WHILE COMMAND
    COMMAND
ENDWHILE
SPECIAL_LABEL_WHILES_A_0:
ANDOR 0
COMMAND
GOTO_IF_FALSE SPECIAL_LABEL_WHILES_B_0
    COMMAND
    GOTO SPECIAL_LABEL_WHILES_A_0
SPECIAL_LABEL_WHILES_B_0:
Mission script Script multifile
WHILE COMMAND
AND NOT COMMAND
    COMMAND
ENDWHILE
SPECIAL_LABEL_WHILES_A_1:
ANDOR 1
COMMAND
NOT COMMAND
GOTO_IF_FALSE SPECIAL_LABEL_WHILES_B_1
    COMMAND
    GOTO SPECIAL_LABEL_WHILES_A_1
SPECIAL_LABEL_WHILES_B_1:
Mission script Script multifile
WHILENOT COMMAND
OR NOT COMMAND
    COMMAND
ENDWHILE
SPECIAL_LABEL_WHILES_A_2:
ANDOR 21
COMMAND
NOT COMMAND
GOTO_IF_TRUE SPECIAL_LABEL_WHILES_B_2
    COMMAND
    GOTO SPECIAL_LABEL_WHILES_A_2
SPECIAL_LABEL_WHILES_B_2:

Looping structure: REPEAT

Mission script Script multifile
VAR_INT steps
REPEAT 4 steps // 0 or lesser still implies 1 step.
    COMMAND
ENDREPEAT
SET_VAR_INT steps 0
SPECIAL_LABEL_REPEATS_0:
    COMMAND
    ADD_VAL_TO_INT_VAR steps 1
// Here ANDOR is accidentally missing in Trilogy.
IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER steps 4
GOTO_IF_FALSE SPECIAL_LABEL_REPEATS_0
Mission script Script multifile
{
    LVAR_INT steps
    REPEAT 8 steps
        COMMAND
    ENDREPEAT
}
SET_LVAR_INT steps 0
SPECIAL_LABEL_REPEATS_1:
    COMMAND
    ADD_VAL_TO_INT_LVAR steps 1
IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER steps 8
GOTO_IF_FALSE SPECIAL_LABEL_REPEATS_1

Infinite looping structure: backward GOTO

loopstart:
WAIT 0
COMMAND
GOTO loopstart

Multiscripts

The whole GTA series started as a world subdivided into several levels, each one per urban area spread across fewer cities, albeit 3D era titles has got a single-leveled design covering the entire game scene. Every level is shipped with a main script and a number of ancillary script files, simply called multiscripts, which are bundled inside a folder bearing the same name as the main script filename without extension. The robust scripting engine allows more scripts to cooperate simultaneously at runtime to let writing codes in a multithreading fashion but with no actual concurrency. A script is a unit of execution which, upon starting, is enqueued to a list of active scripts as long as an explicit termination, moving the script back to a list of idle scripts, occurs with TERMINATE_THIS_SCRIPT while TERMINATE_ALL_SCRIPTS_NAMED halts all instances of a script if the specified name, definitely unique to avert compiler complains, was ever set by SCRIPT_NAME. Running scripts are processed sequentially in a non-prioritized order and are paused pending one of the next script ticks using WAIT to delay the script execution of an instance some milliseconds ahead or at the earliest opportunity if 0.

This section is incomplete. You can help by fixing and expanding it.

Main script and Main extensions

This section is incomplete. You can help by fixing and expanding it.

Scripts and Streamed scripts

This section is incomplete. You can help by fixing and expanding it.

Subscripts and Mission scripts

This section is incomplete. You can help by fixing and expanding it.

Tools

GTA Net GTAForums: SCRambl, first ever attempt for a now discontinued third-party compiler by Deji
GTA Net GTAForums: GTA3script Toolchain, second and still work-in-progress attempt for an unofficial compiler by Link2012

External links

GTA Net GTAForums: Learn GTA3script in Y minutes, tutorial for deep diving into the language in a short time by Link2012
GTA3script Language Specifications, community-based specifications of the language led and maintained by Link2012

See also

SCM language III/VC definitions