Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

[Q] Cleo radar icon problem


richardcheckim
 Share

Recommended Posts

richardcheckim

Hello, I am newbie in making cleo scripts, but after reading of few tutorials, I decided to make "test cleo", what shows save diskette icon after pressing "8" key on numpad. This is my script code:

 

 

{$CLEO .cs}//-------------MAIN---------------thread 'TEST':TEST_1if  andPlayer.Defined($PLAYER_CHAR) 0AB0:   key_pressed 1040570: $630 = create_asset_radar_marker_with_icon 36 at 1410.187 1758.98 10.8203return

 

 

When I started my game, it crashed after loading screen. So I remove my test cleo, but game still won´t work. So I want to ask, where I made a mistake in my code, and what can cause that my game don´t work after removing that script. Thanks for your answers! smile.gif

Link to comment
Share on other sites

 

Hello, I am newbie in making cleo scripts, but after reading of few tutorials, I decided to make "test cleo", what shows save diskette icon after pressing "8" key on numpad. This is my script code:

 

 

{$CLEO .cs}//-------------MAIN---------------thread 'TEST':TEST_1if  andPlayer.Defined($PLAYER_CHAR) 0AB0:   key_pressed 1040570: $630 = create_asset_radar_marker_with_icon 36 at 1410.187 1758.98 10.8203return

 

 

When I started my game, it crashed after loading screen. So I remove my test cleo, but game still won´t work. So I want to ask, where I made a mistake in my code, and what can cause that my game don´t work after removing that script. Thanks for your answers!  smile.gif

read the tutorial again

 

Scripting/Writing a Thread

 

The scripts which are running in GTA are called THREAD

They are defined in the main.scm as thread with the create_thread command or a mission script as mission

As well the Extern scripts of script.img are also threads.

 

The cleo programm checks if there is .cs file in the Cleo folder

and if yes, it start this script as thread

 

Script structur / short version:

 

At first, the head, it beginns with the Cleo directive

 

{$CLEO .cs}

 

First Label (adress)

 

:Akt

 

Then give the thread a name

 

03A4: name_thread 'AKT'

 

now put a code inthere which will doing something and then end_custom_thread as last code

its ready then to test it ingame

 

 

{$CLEO .cs}:Akt03A4: name_thread 'AKT'08B2: toggle_thermal_vision 10A93: end_custom_thread

 

Script above activates the Infrarot view unless in cutscenes

The script ends then, will be deactivated because it ends with opcode 0A93: end_custom_thread

The script will be started by each loading of savegame or by start new game

 

______________________________________________________________________________________

 

 

 

Next step / using conditional checks

 

A conditional check requires minimum 3 opcodes

 

1. the IF-variation

2. the real question

3. the jump instruction by negation

 

 

 

1. if

 

2. 0AB0: key_pressed 8

 

3. 004D: jump_if_false @akt_01

 

 

We use the previous script again but now we wonna be able to switch into normal view

Therefore we use a conditional check and build a "LOOP"

 

Loop means that a jump instruction can send the reading process to a previous adress

I call such an adress "Loop-adress"

Important:

The first opcode after such a Loop-adress must be the wait opcode

mostly wait 0 millisecond

 

the jump instruction can be a jump instruction by negation

or also a normal jump instruction

 

 

004D: jump_if_false @akt_01

 

or

 

0002: jump @akt_01

 

 

 

The conditional check of a key press in the script below should be passed by pressing BACKSPACE

 

 

{$CLEO .cs}:Akt03A4: name_thread 'AKT'08B2: toggle_thermal_vision 1:Akt_01//----------------------------Loop adresse0001: wait 0 msif0AB0:   key_pressed 8004D: jump_if_false @Akt_01//--------jump instruction by negation08B2: toggle_thermal_vision 00A93: end_custom_thread

 

Script above activates the Infrarot view and toggle back to normal view by key_press

The reading process is looping as long as BACKSPACE is not pressed

the jump instruction by negation sends the reading process allways to the label :Akt_01

1000 times per second

Link to comment
Share on other sites

You have to make a jf or else_jump after an if. And you used a global ($630), that can make the game crash to, so use a local instead ([email protected] for example).

 

 

Data types

 

 

: (doublepoint) marks a Label (adress) 

 

: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_50050: gosub @SAVE_140002: jump @SAVE_1 

 

 

 

2. to mark LOCAL VARIABLES

 

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 local variable is builded with the @ sign and a number

[email protected], [email protected], ... [email protected] from [email protected] up to [email protected] is possible, [email protected] and [email protected] are for timers, thats maximum in an .cs file

 

[email protected] defines a parked_car generator

 

014B: [email protected] = 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 

 

[email protected] can then be used furthermore as variable name of the parked_car generator

 

014C: set_parked_car_generator [email protected] cars_to_generate_to 101 

 

 

 

 

$ 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 builded with the $ sign and a 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

 

 

 

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

You can create a car with a LOCAL variable in a thread as [email protected] and also with [email protected] in an other thread of main.scm

[email protected] = create_car

You have then 2 different cars, commanded from 2 different threads

 

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 a GLOBAL variable

At least:

The GLOBAL variables are storable, the LOCAL variables not

 

But dont using global variables in Cleo scripts because they can cause heavy bugs or crashs

only $PLAYER_CHAR, $PLAYER_ACTOR, $ONMISSION are valid

Edited by Bad.boy!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.