Difference between revisions of "Streamed Script"

From GTAMods Wiki
Jump to navigation Jump to search
m (Seemann moved page Streamed Scripts to Streamed Script: singular form preferred)
Line 1: Line 1:
An '''external script''' is a script file used only in San Andreas that is outside the main script file, the <code>[[main.scm]]</code>. An external script is a compiled binary file having an extension <code>.scm</code>. It contains the opcodes which are parsed by the game in the same way as the ones located at the <code>main.scm</code>. The difference from an ordinary SCM file is that an external script has no header. All the info about it is compiled at the <code>main.scm</code> header.<br>
+
An '''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.
External scripts are located in the <code>[[script.img]]</code> file in the <code>data/script</code> folder. The file is usually decompiled along with the <code>main.scm</code>. 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. The game currently has 78 defined external scripts.
 
  
==Tutorial==
+
== 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>
Line 11: Line 15:
 
{{incomplete}}
 
{{incomplete}}
  
==Opcodes==
+
===Opcodes===
 
You can use the following opcodes to do stuff to your script file.<br>
 
You can use the following opcodes to do stuff to your script file.<br>
 
[[07D3]] - I don't know how this work<br>
 
[[07D3]] - I don't know how this work<br>
Line 27: Line 31:
 
[[0929]] - Activates the external script when near the object's model<br>
 
[[0929]] - Activates the external script when near the object's model<br>
  
==Problems==
+
===Problems===
There is one main problem with external scripts: the script doesn't work if you save while the script is running. If you reload the game, the external script will be disabled. You have to force the script to end before saving to prevent this from happening.
+
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==
 
==See also==
*[[Script.img#San Andreas|List of external scripts]]
+
*[[Script.img#San Andreas|List of streamed scripts]]
  
[[Category:GTA SA]][[Category:Mission Script]]
+
{{IV-navi}}
 +
{{SA-navi}}
 +
[[Category:GTA SA]][[Category:GTA IV]][[Category:Mission Script]]

Revision as of 14:17, 3 February 2015

An 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

You can use the following opcodes to do stuff to your script file.
07D3 - I don't know how this work
0884 - Or this
08A9 - Loads the external script
08AB - Checks if the external script has been loaded
08E8 - Assigns an external script to a ped's model
090F - Ends the external script (doesn't seem to work)
0910 - Releases an external script from the memory (not tested!)
0913 - Runs the external script after it has been loaded
0914 - No operation in PC and XBox versions
091C - Gets an actor within a sphere of the object using an external script
0926 - Gets the status of the external script, 0 if not loaded
0928 - Activates the external script when near the ped's model
0929 - Activates the external script when near the object's 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

Template:IV-navi