GTA SAN ANDREAS
MODS for


DATA TYPE MEANING
: (doublepoint) marks a Label (adress)
- exemple:
:MAIN_1
@ is used for 2 different functions
1.) in jump instruction to mark the label which should be reached
@
004D: jump_if_false @SAVE_5
0050: gosub @SAVE_14
0002: jump @SAVE_1
2.) to mark LOCAL VARIABLES
@
- The stuff in the game needs an identity for registration to can
handle with it
The identities can be variable, for exemble by calculating something - in example below will the car_generator become the identity of 1@
- 1@ can then be used furthermore as variable name of the parked_car
generator
and to switch it on/off together with this code below - The local variable is build by the @ sign and a number
- 0@, 1@, ... 30@, from 0@ up to 31@ is possible, 32@ and 33@ are for timers, thats maximum in an .cs file
- this is true for threads of main.scm and Extern_Scripts
as well as Cleo-.CS files with Directive {$CLEO .cs} or {$CLEO .s} - @0 up to @999 can be used in mission scripts as well as in Cleo-.CM files with Directive {$CLEO .cm}
- local variables have a local scope and only be true for that script, and not for other scripts
- 32@ and 33@ are reserved for using in time checks
Its values are permanently counting ascending in milliseconds
32@ and 33@ can't be used for anything else or game can crash
They are allways integer values
We can restore the counting by setting the variable to zero
- After this is it permanently counting again ascending from the specified
value
Then it is possible to check if a specified time is passed
014B: 1@ = init_parked_car_generator #PCJ600 0 17 1 alarm 0 door_lock 0 0 10000 at 2490.0 -1682.0 13.5 angle 90.0
014C: set_parked_car_generator 1@ cars_to_generate_to 101
@33 = 0
if
33@ > 5000
else_jump @back
$ is used to mark a GLOBAL VARIABLE
- The stuff in the game needs a identity for registration to can handle with it
- The identities can be variable, for exemble by calculating something
- The global variable is build by the $ sign and a letter or a word or a number or both
-
But using global variables in Cleo scripts can cause heavy bugs or crashs
only $PLAYER_CHAR, $PLAYER_ACTOR, $ONMISSION are valid - To realize Global Variables for Cleo scripts exist following two
Cleo opcodes connected with a special expression:
Opcode 0AB3: and 0AB4: - read more at Special Particularities in Cleo
00A1: put_actor $PLAYER_ACTOR at 284.8976 2499.5959 16.4844
global, local, whats that ?
Global variables are used in the main.scm to communicate between different
threads
Local variables are also used in the main.scm but they can not communicate
between different threads
A LOCAL variable is given local scope. It is accessible only
from the thread in which it is declared
You can create a car with a LOCAL variable in a thread as 1@ and also
with 1@ in an other thread of main.scm
1@ = create_car
You have then 2 different cars, commanded from 2 different threads
A GLOBAL variable is given entire scope. It is accessible from everywhere of the script file (main.scm and script.img)
You can create a car with GLOBAL variable in a thread but dont use again the same global to create it again in an other thread.
$mycar5 = create_car
But you can command the car from an other thread of the main.scm by using the same GLOBAL variable
At least:
The GLOBAL variables are storable, the LOCAL variables not
# marks the connected entry as filename of a loadable model
- For Cleo can only be used model names which are
defined in vehicles.ide, peds.ide, default.ide or veh_mods.ide
Other models needs to use their ID number
0247: load_model #BMYCG
0247: load_model #HMYCM
0247: load_model #SWATVAN
0247: load_model #M4
0247: load_model #COLT45
'...'short string to insert letters or numbers like GXT entrynames or names of special IPL entries
03A4: name_thread 'MAIN'
0917: audio_zone 'BEACH' enable_sound 0
00BA: show_text_styled GXT 'INTRO_1' time 1000 style 2
0299: activate_garage 'MODLAST'
07FB: set_interior 'GYM1' access 1 // Ganton Gym
0390: load_txd_dictionary 'LD_BEAT'
076C: set_zone 'GAN1' gang 1 density_to 25
"..." long string to insert letters or numbers like animation- and IFP file names, bodypart names, particel names, etc...
- To set entries of strings equal to variable names must be used special opcodes and extended variable signs
- 05AA:
- 05A9:
- 06D2:
- 06D1:
- furthermore can strings also replaced with variables by using extended variable signs
087B: set_player $PLAYER_CHAR clothes_texture "PLAYER_FACE" model "HEAD" body_part 1
038F: load_texture "DOWN" as 1 // Load dictionary with 0390 first
0605: actor -1 perform_animation_sequence "DAN_LOOP_A" IFP_file "DANCING" 4.0 loop 1 0 0 0 time -1 // versionA
0674: set_car_model #GREENWOO numberplate "GROVE4L_"
0245: set_actor 5@ walk_style_to "GANG2"
064B: 25@ = create_particle "EXPLOSION_MOLOTOV" at 2010.0 -1610.0 16.5 type 1
@s local-string-variable
05AA: 5@s = 'FEM_OK'
00BC: show_text_highpriority GXT 5@s time 10000 flag 1
s$ global-string-variable
- Attension by using Global vars in cleo scripts, it can cause bugs or crashes!
05A9: s$Actor_Speech_GXT_Reference = 'CATX_UA' // ~z~Carl, you are a fucking idiota!
00BC: show_text_highpriority GXT s$Actor_Speech_GXT_Reference time 10000 flag 1
05AA: 5@s = s$Actor_Speech_GXT_Reference
00BC: show_text_highpriority GXT 5@s time 10000 flag 1
@v local-long-string-variable
06D2: 28@v = "LAPDAN1" // @v = string
0812: AS_actor $PLAYER_ACTOR perform_animation "LAPDAN_P" IFP_file 28@v 1000.0 loopA 0 lockX 0 lockY 0 lockF 1 time -1
v$ global-long string-variable
06D1: v$1225 = "Bat_block"// 16-byte strings
0605: actor $PLAYER_ACTOR perform_animation_sequence v$1225 from_file "BASEBALL" 4.0 1 0 0 0 -1 ms
// double slash indicates comments, everything behind double slash will be ignored by compiling
//--------- this is a comment
- A special feature by decompiling without opcodes
is to translate opcode based commands into
Classes and Keywords Classes
- Read more about classes in Sannybuilder-HELP theme: Coding >> Classes
- This code by decompiling with writing opcodes:
00AB: put_car 22@ at -1577.942 52.6333 40.0
will by shown by decompiling with without opcodes in this kind:
Car.PutAt(22@, -1577.942, 52.6333, 40.0)
the meaning of the code is defined by the class entries,
Car = class name
PutAt = class member
name and member are combined with a dot in the middle
22@ = class owner
class owner and parameters are placed in brackets and separated with comma
(parameter = needed information for the command)
KEYWORDS and CLASSES
Keywords
- A keyword is a single word that replaces the opcode for simple commands
- Instead writing
004D: jump_if_false @MAIN_6
can be written
jf @MAIN_6
or
else_jump @MAIN_6
you also can merge it:
004D: jf @MAIN_6
The keywords list can be displayed by pressing Ctrl+Space.
Opcode = Keyword
_____________
0001: = wait
00d6: = if
004d: = else_jump
004d: = jf
0002: = jump
0051: = return
0050: = gosub
016a: = fade
01B6: = set_weather
03a4: = thread
04BB: = select_interior
0417: = start_mission
00d8: = mission_cleanup
0317: = increment_mission_attempts
The Opcode
- Opcode means operation code and determines a command for a machine
The machine understand only instruction lines full of numbers in oppostite to a human readable form - A special programming language translates the opcodes and it's attached informations
into for machines executable instructions
These special programming languages, called Assembler language, are generally smaller and faster than high level programming languages
they are more efficient and can instruct commands directly to the hardware - The opcode in the decompiled gta scripts is written as a 4 digit number followed
by two dots like 03CB:
It defines a command wich instruct the game engine to execute an operation with the given parameters
Parameters are the input for the operation.
All opcodes (expect for a few) has a fixed number of parameters
Exemple:
03CB: set_camera 807.0 -937.0 36.5625
03CB: is the opcode to execute a function
807.0 -937.0 36.5625 are the input values of 3 parameter
- set_camera is a description for the opcode function which doesn't exist in the compiled script file.
The description will be embeded by decompiling by using a dictionary, written in the SASCM.INI
Sanny Builder 3\data\sa\SASCM.INI or SA Builder\SASCM.INI - You may also find lines without opcodes in the decompiled script
because Sannybuilder allows to use Keywords and Classes
It is depending to the settings in the editor options: with or without opcodes
- First Steps in Cleo Scripting with Sannybuilder
- Placing Cars by Using Parked_Car_Generator and Weapon Pickups
- The Editor Functions
- HELP
- Reading Coordinates of player poisition
- The Opcode
- DATA TYPE MEANING
- Special Particularities in Cleo
- mission script template
- Scripting/Writing a Thread - coding praxis - conditional checks
- Screenshot
- Slowmotion
- First Person Camera
INDEX
Example Scripts