Difference between revisions of "0001"

From GTAMods Wiki
Jump to navigation Jump to search
m
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{OpCode
 
{{OpCode
| ini        = 0001=1,%1d%
+
| games      = {{Icon|t}}
| description = Stops the execution of a [[thread]]
+
| command    = WAIT
| p1          = Time to wait (in milliseconds)
+
| description = Stops the execution of a [[script]]
| game        = [[GTA 3]], [[Vice City]], [[San Andreas]]
+
| syntax1    = 0001: wait [''int''] ms
 +
| syntax2    = wait [''int'']
 +
| p1t        = [''int'']
 +
| p1d        = Time to wait in milliseconds
 
| native      = [[WAIT]]
 
| native      = [[WAIT]]
 
}}
 
}}
This opcode stops an execution of the thread for specified amount of time in ms. In both the [[Mission Builder]] and [[Sanny Builder]], you can type '''wait''' instead. A parameter value of 0 (wait 0 ms) means that the thread will regain focus as soon as possible, whereas values greater than 0 denote the minimum time span that has to go by before the thread is revisited. A wait is required for almost all [[Create a thread#Loops|loops]].
 
  
==Keywords==
+
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 any [[Create a script#Loops|loops]] that do not terminate as soon as reasonably possible. Without a wait, the game locks itself into processing the script and cannot process the rest of the game. 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.
wait, thread
+
 
 +
== Example ==
 +
The following example using [[Sanny Builder]] shows a simple loop with the required "wait" opcode.
 +
{{Pre|class=sb-code|1=
 +
<span class="k">while</span> <span class="k">true</span>
 +
    <span class="k">wait</span> <span class="m">0</span> ms
 +
<span class="k">end</span>
 +
}}
 +
 
 +
== Keywords ==
 +
wait, thread, script

Latest revision as of 13:01, 21 December 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 any loops that do not terminate as soon as reasonably possible. Without a wait, the game locks itself into processing the script and cannot process the rest of the game. 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