Difference between revisions of "0002"

From GTAMods Wiki
Jump to navigation Jump to search
(simple example)
Line 11: Line 11:
  
 
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 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.
 +
 +
== Example ==
 +
The following example, using Sanny Builder, shows a simple usage of a "jump" out of a while loop to a specified label after the CAMERA key is pressed. The message will change from 0 to 1 after a successful jump.
 +
<syntaxhighlight lang="scm">
 +
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
 +
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==

Revision as of 21:04, 30 December 2014

GTA III Vice City San Andreas GOTO


Description

Jumps to a label in the thread.

Syntax

0002: jump [label]
jump [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.

Example

The following example, using Sanny Builder, shows a simple usage of a "jump" out of a while loop to a specified label after the CAMERA key is pressed. 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