Difference between revisions of "004F"
Line 1: | Line 1: | ||
− | < | + | {{Icon|trilogy}} '''START_NEW_SCRIPT''' |
− | '''Description''': Creates a new thread | + | <hr /> |
− | ''' | + | '''Description''' |
− | ''' | + | : Creates a new thread |
− | ''' | + | '''Syntax''' |
+ | : 004F: create_thread [''offset''] [''params''] | ||
+ | : create_thread [''offset''] [''params''] | ||
+ | '''Parameter''' | ||
+ | : ''offset'' | ||
+ | :: The position in the script from where the thread is started, usually identified by a [[label]] | ||
+ | : ''params'' | ||
+ | :: optional integer or float parameters | ||
+ | '''Native analog''' | ||
+ | : [[START_NEW_SCRIPT]] | ||
− | This | + | This creates a new [[thread]], which begins an execution from the position in the <code>[[main.scm]]</code> identified by a label or an integer value. |
− | + | ||
+ | This opcode has a variable number of parameters. The first parameter of the opcode is required, extra parameters depends on the scripter needs. The point is, the extra parameters set the values of the local variables of the new thread. The first extra parameter (the second one in the opcode) sets the value for the local variable 0@, the second extra parameter sets the value for 1@ and so forth. A total number of extra parameters varies from game to game: 16+2 for GTA 3 and Vice City, 32+2 for San Andreas. | ||
+ | |||
+ | To end the thread execution and free the memory use [[004E]] or [[0459]]. | ||
+ | |||
+ | This opcode is similar to the opcode [[00D7]] but the latter has only one parameter, without extra ones. | ||
==Example== | ==Example== | ||
Line 27: | Line 41: | ||
==Keywords== | ==Keywords== | ||
− | thread, create | + | thread, script, create, start |
==See also== | ==See also== | ||
− | [[Create a thread]] | + | * [[00D7]] – starts a new script with no parameters |
+ | * [[0417]] – launches a mission | ||
+ | * [[0A92]] – starts a new [[CLEO]] script | ||
+ | * [[Create a thread]] | ||
− | |||
[[Category:OpCodes]] | [[Category:OpCodes]] |
Revision as of 11:01, 14 February 2015
Description
- Creates a new thread
Syntax
- 004F: create_thread [offset] [params]
- create_thread [offset] [params]
Parameter
- offset
- The position in the script from where the thread is started, usually identified by a label
- params
- optional integer or float parameters
Native analog
This creates a new thread, which begins an execution from the position in the main.scm
identified by a label or an integer value.
This opcode has a variable number of parameters. The first parameter of the opcode is required, extra parameters depends on the scripter needs. The point is, the extra parameters set the values of the local variables of the new thread. The first extra parameter (the second one in the opcode) sets the value for the local variable 0@, the second extra parameter sets the value for 1@ and so forth. A total number of extra parameters varies from game to game: 16+2 for GTA 3 and Vice City, 32+2 for San Andreas.
To end the thread execution and free the memory use 004E or 0459.
This opcode is similar to the opcode 00D7 but the latter has only one parameter, without extra ones.
Example
$VAR = 10
004F: create_thread @MONEY 10 $VAR
...
...
:MONEY
03A4: name_thread 'MONEY'
00D6: if 0
003B: 0@ == 1@
004D: jump_if_false @EXIT
0109: player $PLAYER_CHAR money += 0@
:EXIT
004E: end_thread
When the game starts, it will execute this code and the player will receive 10 dollars.
Keywords
thread, script, create, start
See also
- 00D7 – starts a new script with no parameters
- 0417 – launches a mission
- 0A92 – starts a new CLEO script
- Create a thread