Difference between revisions of "0002"

From GTAMods Wiki
Jump to navigation Jump to search
(highlight)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{This|This article is all about jumps in a [[mission script]]. For the [[IPL]] section creating an unique stunt jump see [[JUMP]].}}
 
 
{{OpCode
 
{{OpCode
| ini        = 0002=1,%1p%
+
| games      = {{Icon|t}}
| description = Jumps to a label
+
| command    = GOTO
| p1          = [[Label]]
+
| description = Jumps to a label in the [[script]]
| game        = GTA3, Vice City, San Andreas
+
| syntax1    = 0002: jump [''label'']
 +
| syntax2    = jump [''label'']
 +
| p1t        = [''label'']
 +
| p1d        = The position in the script it will go to, usually identified by a [[label]]
 
}}
 
}}
This is used in unconditional jumps. In both the [[Mission Builder]] and [[Sanny Builder]], you can type '''jump''' instead.
+
 
 +
This opcode is used in unconditional jumps, which allow the game to continue processing the script starting at the location of the label. In both the Mission Builder and [[Sanny Builder]], you can use the '''jump''' keyword instead.
 +
 
 +
== Example ==
 +
The following example, using Sanny Builder, shows a simple usage of a "jump" out of a while loop to the specified label after pressing [[00E1|button 13]] (CAMERA key). The message will change from 0 to 1 after a successful jump.
 +
{{Pre|class=sb-code|1=
 +
<span class="k">while</span> <span class="k">true</span>
 +
    <span class="k">wait</span> <span class="m">10</span> ms
 +
    01E5: text_1number_highpriority <span class="s1">'NUMBER'</span> <span class="m">0</span> <span class="m">10</span> ms <span class="m">1</span>
 +
    <span class="k">if</span>
 +
        [[00E1]]:  key_pressed <span class="m">0</span> <span class="m">13</span>  <span class="c1">// camera key</span>
 +
    <span class="k">then</span>
 +
        <span class="k">jump</span> <span class="nl">@label_goto</span>
 +
    <span class="k">end</span>
 +
<span class="k">end</span>
 +
 
 +
<span class="nl">:label_misc</span>
 +
<span class="c1">// miscellaneous content</span>
 +
 
 +
<span class="nl">:label_goto</span>
 +
01E5: text_1number_highpriority <span class="s1">'NUMBER'</span> <span class="m">1</span> <span class="m">5000</span> ms <span class="m">1</span>
 +
}}
 +
 
 +
== Keywords ==
 +
jump, goto, label
 +
 
 +
== See also ==
 +
* {{Icon|t}} [[004D]], goto if false

Latest revision as of 08:01, 2 December 2016

GTA III Vice City San Andreas GOTO


Description
Jumps to a label in the script
Syntax
0002: jump [label]
jump [label]
Parameter
[label]
The position in the script it will go to, usually identified by a label

This opcode is used in unconditional jumps, which allow the game to continue processing the script starting at the location of the label. In both the Mission Builder and Sanny Builder, you can use the jump keyword instead.

Example

The following example, using Sanny Builder, shows a simple usage of a "jump" out of a while loop to the specified label after pressing button 13 (CAMERA key). The message will change from 0 to 1 after a successful jump.

while true
    wait 10 ms
    01E5: text_1number_highpriority 'NUMBER' 0 10 ms 1
    if 
        00E1:   key_pressed 0 13  // camera key
    then
        jump @label_goto
    end
end

:label_misc
// miscellaneous content

:label_goto
01E5: text_1number_highpriority 'NUMBER' 1 5000 ms 1

Keywords

jump, goto, label

See also

  • GTA III Vice City San Andreas 004D, goto if false