Difference between revisions of "004F"
(highlight) |
m |
||
Line 3: | Line 3: | ||
| command = START_NEW_SCRIPT | | command = START_NEW_SCRIPT | ||
| description = Starts a [[Create a script|new script]] | | description = Starts a [[Create a script|new script]] | ||
− | | syntax1 = 004F: create_thread [''label''] ( [''any''] | + | | syntax1 = 004F: create_thread [''label''] ( [''any''] … ) |
− | | syntax2 = create_thread [''label''] ( [''any''] | + | | syntax2 = create_thread [''label''] ( [''any''] … ) |
| p1t = [''label''] | | p1t = [''label''] | ||
| p1d = The position in the script it will go to, usually identified by a [[label]] | | p1d = The position in the script it will go to, usually identified by a [[label]] | ||
− | | p2t = ( [''any''] | + | | p2t = ( [''any''] … ) |
| p2d = Optional parameters in any data type, up to 16+2 for GTA III and Vice City, 32+2 for San Andreas | | p2d = Optional parameters in any data type, up to 16+2 for GTA III and Vice City, 32+2 for San Andreas | ||
| native = [[START_NEW_SCRIPT]] | | native = [[START_NEW_SCRIPT]] |
Latest revision as of 02:26, 6 December 2016
- Description
- Starts a new script
- Syntax
- 004F: create_thread [label] ( [any] … )
- create_thread [label] ( [any] … )
- Parameter
- [label]
- The position in the script it will go to, usually identified by a label
- ( [any] … )
- Optional parameters in any data type, up to 16+2 for GTA III and Vice City, 32+2 for San Andreas
- Native analog
- START_NEW_SCRIPT
This opcode starts a new script and begins an execution from the label. It has a variable number of parameters. The first parameter of the opcode is required, with extra parameters depending on the scripter needs. The extra parameters set the values of the local variables of the new script. The first extra parameter (the second parameter of the opcode) sets the value for the new script's local variable 0@, the second extra parameter sets the value for 1@, and so forth. The total number of extra parameters varies from game to game: 16+2 for GTA III and Vice City, 32+2 for San Andreas. Opcodes 004E or 0459 can be used to terminate the scripts. This opcode is similar to opcode 00D7 but the latter has only one parameter, without extra ones.
Example
The following script, using Sanny Builder, will add $10 to the player when the script is started.
$VAR = 10 004F: create_thread @MONEY 10 $VAR ... ... :MONEY 03A4: name_thread 'MONEY' if 003B: 0@ == 1@ then 0109: player $PLAYER_CHAR money += 0@ end 004E: end_thread
Keywords
thread, script, create, start
See also
- Create a script
- 00D7, starts a new script with no parameters
- 0417, launches a mission
- 0A92, starts a new CLEO script