DATA TYPE MEANING

 


 

: (doublepoint) marks a Label (adress)

  1. exemple:
  2. 
    :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

@

  1. 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
  2. in example below will the car_generator become the identity of 1@
  3. 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
  4. 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
  5. 014C: set_parked_car_generator 1@ cars_to_generate_to 101
  6. The local variable is build by the @ sign and a number
  7. 0@, 1@, ... 30@, from 0@ up to 31@ is possible, 32@ and 33@ are for timers, thats maximum in an .cs file
  8. this is true for threads of main.scm and Extern_Scripts
    as well as Cleo-.CS files with Directive {$CLEO .cs} or {$CLEO .s}
  9. @0 up to @999 can be used in mission scripts as well as in Cleo-.CM files with Directive {$CLEO .cm}
  10.  
  11. local variables have a local scope and only be true for that script, and not for other scripts
  12.  

  13. 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
  14.  @33 =  0
  15. After this is it permanently counting again ascending from the specified value
    Then it is possible to check if a specified time is passed
  16. if
    33@ > 5000
    else_jump @back

 


 

$ is used to mark a GLOBAL VARIABLE

  1. The stuff in the game needs a identity for registration to can handle with it
  2. The identities can be variable, for exemble by calculating something
  3. in example below will the car_generator become the identity of $PARKED_HYDRA
  4. 014B: $PARKED_HYDRA = init_parked_car_generator #HYDRA color -1 -1 1 alarm 0 door_lock 0 0 10000 at 2527.2 -1677.1 19.2 angle 90.0
  5. $PARKED_HYDRA can then be used furthermore as variable name of the parked_car generator
    and to switch it on/off together with this code below
  6. 014C: set_parked_car_generator $PARKED_HYDRA cars_to_generate_to 101

     

  7. The Global Variable is build with the $ sign and a letter or a word or a number or both
    Global Variables have global scope, they're true for every scripts and will be stored in savegames in opposition to local variables, they have a local scope and only be true for that script
  8. $FREEFALL_STAGE = 0
    $1501 = -5.0
    
    if 
      $FREEFALL_STAGE == 3
    else_jump @PLCHUTE_23862
    2@ -= $1500
    

     

 


 

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

    0247: load_model #BMYCG
    0247: load_model #HMYCM
    0247: load_model #SWATVAN
    0247: load_model #M4
    0247: load_model #COLT45
  1. 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

 


 

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

    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

     


     

  1. To set entries of strings equal to variable names must be used special opcodes and extended variable signs
  2. 05AA:
  3. 05A9:
  4. 06D2:
  5. 06D1:
  6. furthermore can strings also replaced with variables by using extended variable signs

 

@s local-string-variable

    05AA: 5@s = 'FEM_OK'
    00BC: show_text_highpriority GXT 5@s time 10000 flag 1

 


 

s$ global-string-variable

  1. Attension by using Global vars in cleo scripts, it can cause bugs or crashes!
  2. 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

 

    KEYWORDS and CLASSES

  1. A special feature by decompiling without opcodes is to translate opcode based commands into
    Classes and Keywords
  2.  

  3. Classes

  4. Read more about classes in Sannybuilder-HELP theme: Coding >> Classes
  5. 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)

 

  1. Keywords

  2. A keyword is a single word that replaces the opcode for simple commands
  3. 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

  1. 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
  2.  

  3. 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
  4.  

  5. 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
  6.  

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

  1. 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
  2.  

  3. 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
  4.