Difference between revisions of "004F"

From GTAMods Wiki
Jump to navigation Jump to search
Line 1: Line 1:
<code>004F=-1,%1p%</code><br>
+
{{Icon|trilogy}} '''START_NEW_SCRIPT'''
'''Description''': Creates a new thread<br>
+
<hr />
'''Parameter 1''': [[Label]]<br>
+
'''Description'''
'''+extra parameters'''<br>
+
: Creates a new thread
'''Supports''': GTA3, Vice City, San Andreas<br>
+
'''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 opcode creates a new [[thread]]. It begins an execution from the place marked by the label passed as the parameter.<br>
+
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.
The distinctive feature of this opcode is that it has various number of the parameters. The first parameter (a label) must be always, extra parameters depends on the scripter needs. The aim of using of the extra parameters is to set the values of the local variables of the created thread. The first extra parameter (the second in the opcode) sets the value for the variable 0@, the second extra parameters set the one for 1@ and so on. Total possible number of extra parameters depends on the local variables number for the game: 16+2 for GTA3 and VC, 32+2 for SA. This opcode is similar to opcode [[00D7]] but the latter has only one parameter, without extra ones.
+
 
 +
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]] &ndash; starts a new script with no parameters
 +
* [[0417]] &ndash; launches a mission
 +
* [[0A92]] &ndash; starts a new [[CLEO]] script
 +
* [[Create a thread]]
  
{{SA-navi}}
 
 
[[Category:OpCodes]]
 
[[Category:OpCodes]]

Revision as of 11:01, 14 February 2015

GTA III Vice City San Andreas START_NEW_SCRIPT


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 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