Difference between revisions of "0002"

From GTAMods Wiki
Jump to navigation Jump to search
m
(highlight)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Icon|trilogy}} '''GOTO'''
+
{{OpCode
<hr />
+
| games      = {{Icon|t}}
<onlyinclude>{{#ifeq:{{{transcludesection|opcode}}}|opcode|
+
| command    = GOTO
'''Description'''
+
| description = Jumps to a label in the [[script]]
: Jumps to a label in the thread.
+
| syntax1    = 0002: jump [''label'']
'''Syntax'''
+
| syntax2    = jump [''label'']
: 0002: jump [label]
+
| p1t        = [''label'']
: jump [label]
+
| p1d        = The position in the script it will go to, usually identified by a [[label]]
'''Parameters'''
+
}}
: [''label'']
 
:: 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 use the '''jump''' keyword instead. The destination point is identified by a label, which is then used as a parameter.
+
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.
}}</onlyinclude>
 
  
==See also==
+
== Example ==
* [[Label]]
+
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>
  
==Keywords==
+
<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
 
jump, goto, label
  
[[Category:OpCodes]]
+
== 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