Difference between revisions of "Streamed Script"

From GTAMods Wiki
Jump to navigation Jump to search
 
(wrong IV category removed)
 
(20 intermediate revisions by 5 users not shown)
Line 1: Line 1:
An '''external script''' is a script file that is outside the main script file, the <code>main.scm</code>. External scripts are located in the <code>script.img</code> in the <code>data/maps</code> folder. The maximum number of external scripts that can be defined is 82. The maximum number of external scripts that can be used simultaneously is 70.
+
A '''streamed script''' is a script file that is streamed on demand, only when the script needs to be executed. They are stored in the [[script.img]] file. It contains the opcodes which are parsed by the game in the same way as the ones located in usual scripts, except that it has no header.
  
==How 2.0==
+
== GTA San Andreas ==
 +
The file is located in the <code>data/script/</code> directory and is loaded by [[gta.dat]].
 +
 
 +
The maximum number of streamed scripts that can be defined is 82. The maximum number of streamed scripts that can be used simultaneously is 70. The game currently has 78 defined streamed scripts.
 +
 
 +
===Tutorial===
 
In order to add more external script files, you have to define the number of files you are going to use:<br>
 
In order to add more external script files, you have to define the number of files you are going to use:<br>
 
<code>DEFINE EXTERNAL_SCRIPTS 78</code><br>
 
<code>DEFINE EXTERNAL_SCRIPTS 78</code><br>
 
Add the external script to the list with this:<br>
 
Add the external script to the list with this:<br>
<code>DEFINE SCRIPT <b>NAME</b> AT <b>LABEL</b></code><br>
+
<code>DEFINE SCRIPT '''NAME''' AT '''[[Label|LABEL]]'''</code><br>
 
At the end of the file add your code in.
 
At the end of the file add your code in.
  
==Opcodes==
+
{{incomplete}}
You can use the following opcodes to do stuff to your script file.<br>
+
 
[[07D3]] - I don't know how this work<br>
+
===Opcodes===
[[0884]] - Or this<br>
+
* [[07D3]] - Adds a script brain for peds.
[[08A9]] - Loads the external script<br>
+
* [[0884]] - Adds a script brain for peds triggered by attractors.
[[08AB]] - Checks if the external script has been loaded<br>
+
* [[08A9]] - Loads a streamed script.
[[08E8]] - Assigns an external script to a ped's model<br>
+
* [[08AB]] - Checks if the streamed script has been loaded.
[[090F]] - Ends the external script (doesn't seem to work)<br>
+
* [[08E8]] - Attaches an animation to a ped model.
[[0913]] - Runs the external script after it has been loaded<br>
+
* [[090F]] - Marks a previously loaded streamed script as no longer needed.
[[0914]] - No operation in PC and XBox versions<br>
+
* [[0910]] - Frees an streamed script from the memory (shouldn't be used).
[[091C]] - Gets an actor within a sphere of the object using an external script<br>
+
* [[0913]] - Runs the streamed script (needs to be loaded first).
[[0926]] - Gets the status of the external script, 0 if not loaded
+
* [[091C]] - Gets an ped using an attractor with the specified model and in the specified area.
[[0928]] - Activates the external script when near the ped's model
+
* [[0926]] - Gets the number of instances of a script.
[[0929]] - Activates the external script when near the object's model
+
* [[0928]] - Tells the engine to start a streamed script when the player is within the range of the specified ped.
 +
* [[0929]] - Tells the engine to start a streamed script when the player is within the range of the specified model.
 +
 
 +
===Problems===
 +
There is one main problem with streamed scripts: the script doesn't work if you save while the script is running. If you reload the game, the streamed script will be disabled. You have to force the script to end before saving to prevent this from happening.
 +
 
 +
== GTA IV ==
 +
{{incomplete}}
 +
 
 +
==See also==
 +
* [[Resource Streaming]]
 +
* [[SCM]]
 +
* [[Script.img#San Andreas|List of streamed scripts]]
  
==List of Scripts==
+
{{N|SA|IV}}
The following is a list of external scripts that is used in the game.
+
[[Category:Mission Script]]
{|
 
! Number
 
! Name
 
! Description
 
|-
 
| 0
 
| PLAYER_PARACHUTE
 
| Controls the player's parachute
 
|-
 
| 1
 
| PARACHUTE
 
| Controls the AI's parachute
 
|-
 
| 2
 
| BCESAR2
 
| Smoke's money from Los Santos to San Fierro
 
|-
 
| 3
 
| BCESAR3
 
| Smoke's yay from San Fierro to Los Santos
 
|-
 
| 4
 
| SLOT_MACHINE
 
| Slot machine
 
|-
 
| 5
 
| ROULETTE
 
| Roulette
 
|-
 
| 6
 
| OTB_SCRIPT
 
| Off track betting machine
 
|-
 
| 7
 
| ARCADE
 
| Arcade game mission checker (not the game itself)
 
|-
 
| 8
 
| VENDING_MACHINE
 
| Vending machines (both food and drinks)
 
|-
 
| 9
 
| FOOD_VENDOR
 
| Food vendors
 
|-
 
| 10
 
| GATES_SCRIPT
 
| Airport gates
 
|-
 
| 11
 
| GYMBIKE
 
| Bike
 
|-
 
| 12
 
| GYMBENCH
 
| Bench
 
|-
 
| 13
 
| GYMTREAD
 
| Treadmill
 
|-
 
| 14
 
| GYMDUMB
 
| Dumbell
 
|-
 
| 15
 
| BASKETB
 
| Basketball
 
|-
 
| 16
 
| VIDPOK
 
| Video poker machine
 
|-
 
| 17
 
| BLACKJ
 
| Blackjack
 
|-
 
| 18
 
| WHEELO
 
| Wheel of Fortune
 
|-
 
| 19
 
| DEALER
 
| Drug dealer
 
|-
 
| 20
 
| HOME_BRAINS
 
| Hobo's AI
 
|-
 
| 21
 
| POOL_SCRIPT
 
| Pool
 
|-
 
| 22
 
| LOWR_CONT
 
| Lowrider contest
 
|-
 
| 23
 
| BURG_BRAINS
 
| Burgulary's ped AI
 
|-
 
| 24
 
| GF_MEETING
 
| Girlfriend meeting
 
|-
 
| 25
 
| GF_DATE
 
| Girlfriend date
 
|-
 
| 26
 
| GF_SEX
 
| Girlfriend sex
 
|-
 
| 27
 
| CASINO_AMBIENCE
 
| Casino ambience
 
|-
 
| 28
 
| BAR_AMBIENCE
 
| Bar ambience
 
|-
 
| 29
 
| FOODBRAINS
 
| Restaurant's ped AI
 
|-
 
| 30
 
| OTB_AMBIENCE
 
| Off track betting ambience
 
|-
 
| 31
 
| STRIP_AMBIENCE
 
| Strip club ambience
 
|-
 
| 32
 
| PLANES
 
| Airline traveling
 
|-
 
| 33
 
| TRAINS
 
|
 
|-
 
| 34
 
| ZERO_AMBIENCE
 
|
 
|-
 
| 35
 
| DANCE
 
|
 
|-
 
| 36
 
| SHOPKEEPER
 
|
 
|-
 
| 37
 
| CUSTOMER_PANIC
 
|
 
|-
 
| 38
 
| BAR_STAFF
 
|
 
|-
 
| 39
 
| BOUNCER
 
|
 
|-
 
| 40
 
| OTB_STAFF
 
|
 
|-
 
| 41
 
| PCHAIR
 
|
 
|-
 
| 42
 
| PCUSTOM
 
|
 
|-
 
| 43
 
| OTBWTCH
 
|
 
|-
 
| 44
 
| OTBSLP
 
|
 
|-
 
| 45
 
| OTBTILL
 
|
 
|-
 
| 46
 
| FBOOTHR
 
|
 
|-
 
| 47
 
| FBOOTHL
 
|
 
|-
 
| 48
 
| BARGUY
 
|
 
|-
 
| 49
 
| PEDROUL
 
|
 
|-
 
| 50
 
| PEDCARD
 
|
 
|-
 
| 51
 
| PEDSLOT
 
|
 
|-
 
| 52
 
| DANCER
 
|
 
|}
 

Latest revision as of 22:58, 5 February 2015

A streamed script is a script file that is streamed on demand, only when the script needs to be executed. They are stored in the script.img file. It contains the opcodes which are parsed by the game in the same way as the ones located in usual scripts, except that it has no header.

GTA San Andreas

The file is located in the data/script/ directory and is loaded by gta.dat.

The maximum number of streamed scripts that can be defined is 82. The maximum number of streamed scripts that can be used simultaneously is 70. The game currently has 78 defined streamed scripts.

Tutorial

In order to add more external script files, you have to define the number of files you are going to use:
DEFINE EXTERNAL_SCRIPTS 78
Add the external script to the list with this:
DEFINE SCRIPT NAME AT LABEL
At the end of the file add your code in.

This section is incomplete. You can help by fixing and expanding it.

Opcodes

  • 07D3 - Adds a script brain for peds.
  • 0884 - Adds a script brain for peds triggered by attractors.
  • 08A9 - Loads a streamed script.
  • 08AB - Checks if the streamed script has been loaded.
  • 08E8 - Attaches an animation to a ped model.
  • 090F - Marks a previously loaded streamed script as no longer needed.
  • 0910 - Frees an streamed script from the memory (shouldn't be used).
  • 0913 - Runs the streamed script (needs to be loaded first).
  • 091C - Gets an ped using an attractor with the specified model and in the specified area.
  • 0926 - Gets the number of instances of a script.
  • 0928 - Tells the engine to start a streamed script when the player is within the range of the specified ped.
  • 0929 - Tells the engine to start a streamed script when the player is within the range of the specified model.

Problems

There is one main problem with streamed scripts: the script doesn't work if you save while the script is running. If you reload the game, the streamed script will be disabled. You have to force the script to end before saving to prevent this from happening.

GTA IV

This section is incomplete. You can help by fixing and expanding it.

See also