Difference between revisions of "0001"

From GTAMods Wiki
Jump to navigation Jump to search
(testing new template)
Line 1: Line 1:
{{Icon|trilogy}} '''WAIT'''
+
{{OpCode
<hr />
+
| games      = {{Icon|t}}
'''Description'''
+
| command    = WAIT
: Stops the execution of a [[thread|script]]
+
| description = Stops the execution of a [[thread|script]]
'''Syntax'''
+
| syntax1    = 0001: wait [''int''] ms
: 0001: wait [''int''] ms
+
| syntax2    = wait [''int'']
: wait [''int'']
+
| p1t        = [''int'']
'''Parameter'''
+
| p1d        = Time to wait in milliseconds
: [''int'']
+
| native      = [[WAIT]]
:: Time to wait in milliseconds
+
}}
'''Native analog'''
 
: [[WAIT]]
 
  
 
This opcode stops an execution of the script for specified amount of time in milliseconds. A value of ''0'' means that the script will regain focus as soon as possible, whereas values greater than ''0'' denote the minimum time span that has to go by before the script is revisited. A wait is required for almost all [[Create a thread#Loops|loops]]. It is bad practice to use a very long wait in scripts that loop; for that, it is much better to use game timers like opcode [[01BD]] or local variable timers.
 
This opcode stops an execution of the script for specified amount of time in milliseconds. A value of ''0'' means that the script will regain focus as soon as possible, whereas values greater than ''0'' denote the minimum time span that has to go by before the script is revisited. A wait is required for almost all [[Create a thread#Loops|loops]]. It is bad practice to use a very long wait in scripts that loop; for that, it is much better to use game timers like opcode [[01BD]] or local variable timers.
Line 16: Line 14:
 
== Example ==
 
== Example ==
 
The following example, using [[Sanny Builder]], shows a simple loop with the required "wait" opcode.
 
The following example, using [[Sanny Builder]], shows a simple loop with the required "wait" opcode.
<syntaxhighlight lang="scm">while true
+
<syntaxhighlight lang="scm">
 +
while true
 
     wait 0 ms
 
     wait 0 ms
end</syntaxhighlight>
+
end
 +
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==
 
wait, thread, script
 
wait, thread, script
 
[[Category:OpCodes]]
 

Revision as of 21:44, 2 January 2016

GTA III Vice City San Andreas WAIT


Description
Stops the execution of a script
Syntax
0001: wait [int] ms
wait [int]
Parameter
[int]
Time to wait in milliseconds
Native analog
WAIT

This opcode stops an execution of the script for specified amount of time in milliseconds. A value of 0 means that the script will regain focus as soon as possible, whereas values greater than 0 denote the minimum time span that has to go by before the script is revisited. A wait is required for almost all loops. It is bad practice to use a very long wait in scripts that loop; for that, it is much better to use game timers like opcode 01BD or local variable timers.

Example

The following example, using Sanny Builder, shows a simple loop with the required "wait" opcode.

while true
    wait 0 ms
end

Keywords

wait, thread, script