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. Forum Support

    3. Suggestions

Cleo My script crashes after changing the variable


baclaine
 Share

Recommended Posts

Hi

 

I'm starting to learn scripts it works but always crashes after loading the 45 car.

Any ideas?

I

 

{$CLEO .cs}
 
 0000: NOP
 0004: $41 = 400
:WACHT
0001: wait 90
0A90: is_hid_pressed 15
004D: jump_if_false @WACHT 
0A90: is_hid_pressed 12
004D: jump_if_false @WACHT
0002: jump @START

:TRST
0249: release_model $41 
01C3: remove_references_to_car [email protected]
00A6: destroy_car [email protected] 

:START
0001: wait 90 
0247: load_model $41   
0001: wait 0  
04C4: store_coords_to [email protected] [email protected] [email protected]  from_actor $PLAYER_ACTOR with_offset 0.0 5.0 -0.33
:CAR
0001: wait 90
0248:   model $41 available
004D: jump_if_false @START
00A5: [email protected] = create_car $41 at [email protected] [email protected] [email protected]

:ACTION0
0001: wait 0
03E5: show_text_box 'TEXT1'
0A90: is_hid_pressed 63
004D: jump_if_false @VOL1 
0002: jump @NEXT
:VOL1  
0A90: is_hid_pressed 12
004D: jump_if_false @VOL2 
0002: jump @ENDE
:VOL2  
0002: jump @ACTION0

:NEXT 
0001: wait 0
000A: $41 += 1
0039: $41 == 612 
004D: jump_if_false @WHY
0039: $41 == 400 
:WHY
0002: jump @TRST  
   
:ENDE  
0001: wait 0
01C3: remove_references_to_car [email protected] 
0002: jump @WACHT

 

 

 

Link to comment
Share on other sites

11 hours ago, baclaine said:

Hi

 

I'm starting to learn scripts it works but always crashes after loading the 45 car.

Any ideas?

I

 

{$CLEO .cs}
 
 0000: NOP
 0004: $41 = 400
:WACHT
0001: wait 90
0A90: is_hid_pressed 15
004D: jump_if_false @WACHT 
0A90: is_hid_pressed 12
004D: jump_if_false @WACHT
0002: jump @START

:TRST
0249: release_model $41 
01C3: remove_references_to_car [email protected]
00A6: destroy_car [email protected] 

:START
0001: wait 90 
0247: load_model $41   
0001: wait 0  
04C4: store_coords_to [email protected] [email protected] [email protected]  from_actor $PLAYER_ACTOR with_offset 0.0 5.0 -0.33
:CAR
0001: wait 90
0248:   model $41 available
004D: jump_if_false @START
00A5: [email protected] = create_car $41 at [email protected] [email protected] [email protected]

:ACTION0
0001: wait 0
03E5: show_text_box 'TEXT1'
0A90: is_hid_pressed 63
004D: jump_if_false @VOL1 
0002: jump @NEXT
:VOL1  
0A90: is_hid_pressed 12
004D: jump_if_false @VOL2 
0002: jump @ENDE
:VOL2  
0002: jump @ACTION0

:NEXT 
0001: wait 0
000A: $41 += 1
0039: $41 == 612 
004D: jump_if_false @WHY
0039: $41 == 400 
:WHY
0002: jump @TRST  
   
:ENDE  
0001: wait 0
01C3: remove_references_to_car [email protected] 
0002: jump @WACHT

 

 

 

This is the GTAV section and your post is tagged SA, you might want to self-report your post to get it moved into the correct section of the forums.

Link to comment
Share on other sites

ArmanCan

@baclaine at first i would like to say..

 

"$41" represents as a "useless IMPEXPM flag" and it's a "Global Variable".. you musn't use Global Variable or you should convert it to a "Local Variable"

 

 0004: $41 = 400

I don't know  what is the value "400" but if you are trying to use model ID "41" than you should write like this.. "#HFYST"..

If your model ID is "400" than you should write this.. "#LANDSTAL"

 

For the car creation you need to "Load" the car/s first.. and than you can request your car/s..

 

Some local variables needs some "Definition" between "Const.. end" and it must be placed at the beginning of this script for example like this..

 

{$CLEO .cs}
// RTSM_Player_Skills_Final.txt
{ 
   Real Time Status Monitor - Player Skills
   by OrionSR & ArmanCan
   Jan 11, 2022
}

{Header - Configuring Sanny Builder}

const {Internal}
  is_right_panel = [email protected] // passed when launched
  
  int_val = [email protected]
  dec_part = [email protected]

  left_x_pos = [email protected]
  right_x_pos = [email protected]
  centered_x_pos = [email protected]
  title_x_pos = [email protected]    
  y_pos = [email protected]
  box_x_pos = [email protected]
  box_y_pos = [email protected]
  box_width = [email protected]
  box_height = [email protected]
  right_panel_disabled = [email protected]
  
  Key_O = 79 // For Left Panel
  Key_P = 80 // For Right Panel    

  Font_Pricedown = 0
  Font_Aharoni = 1
  Font_Gothic = 2
  Font_Beckett = 3   
end

 

üb dich weiter und beginnt Schritt bei Schritt..

 

Viel Glück und ich wünsche dir ein Frohes neues Jahr..🙂

Link to comment
Share on other sites

Spider-Vice
On 1/1/2023 at 10:14 AM, LeeC22 said:

This is the GTAV section and your post is tagged SA, you might want to self-report your post to get it moved into the correct section of the forums.

Moved :)

nitw_nightmareeyes.png

GTANet | Red Dead Network | 🌲

black lives matter | stop Asian hate | trans lives = human lives

the beginning is moments ago, the end is moments away

Link to comment
Share on other sites

On 12/31/2022 at 2:43 PM, baclaine said:

Any ideas?

{$CLEO .cs} - Cleo script for PC.
{$CLEO .csa} - Auto-run cleo script for Android.
{$CLEO .csi} - Menu launched cleo script for Android.

 

0A90: is_hid_pressed 15 - This is a mobile opcode. 
With only 1 parameter, Sanny wouldn't let you compile this script unless the SA Mobile edit mode is active.
The edit mode can be changed using the icon in the lower-right corner of SB's main window.

 

04C4: store_coords_to [email protected] [email protected] [email protected]  from_actor $PLAYER_ACTOR with_offset 0.0 5.0 -0.33

Always make sure the player is playing (player is defined) before using player based opcodes.

 

$41 - Global variable in a cleo script - bad practice in most cases.

 

:NEXT 
0001: wait 0
000A: $41 += 1
0039: $41 == 612 
004D: jump_if_false @WHY
0039: $41 == 400 
:WHY
0002: jump @TRST  

 

0039: $41 == 400

0039: is a condition check, not an assignment.

0004: $41 = 400

Should use a local variable, which have different opcodes.

0006: [email protected] = 400

 

//0039:   $41 == 612  // wrong!
0038:   $41 == 612 
0039:   [email protected] == 612 

You are using 0039 with a global argument.

 

Omitting the IF commands makes the script more difficult to read.
Save this trick for when saving a few bytes is necessary.

 

03E5: show_text_box 'TEXT1'

Please include a comment with the text displayed.

Edited by OrionSR
Link to comment
Share on other sites

baclaine
Posted (edited)

removed

Edited by baclaine
Link to comment
Share on other sites

baclaine
Posted (edited)

Hi,

 

Script is for the definitive edition.

I use opcode 0A90 because this script is for steam deck and controllers.

But still crashes after changing the value+- 20 times

 

This is how it looks in game: https://imgur.com/a/4O0RnPc

 

 

 

 

 

 

{$CLEO .cs}

 

0000: NOP

0006: [email protected] = 417

 

:WACHT

0001: wait 90

0A90: is_hid_pressed 15

004D: jump_if_false @WACHT 

0A90: is_hid_pressed 12

004D: jump_if_false @WACHT

0002: jump @START

 

:TRST

0249: release_model [email protected]

01C3: remove_references_to_car [email protected]

00A6: destroy_car [email protected] 

 

:START

0001: wait 90 

0247: load_model [email protected]   

0001: wait 0  

04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 5.0 -0.33

:CAR

0001: wait 90

0248: model [email protected] available

004D: jump_if_false @START

00A5: [email protected] = create_car [email protected] at [email protected] [email protected] [email protected]

 

:ACTION0

0001: wait 0

03E5: show_text_box 'TEXT1'

0A90: is_hid_pressed 63

004D: jump_if_false @VOL1 

0002: jump @NEXT

:VOL1  

0A90: is_hid_pressed 12

004D: jump_if_false @VOL2 

0002: jump @ENDE

:VOL2  

0002: jump @ACTION0

 

:NEXT 

0001: wait 0

000A: [email protected] += 1

0039: [email protected] == 445 

004D: jump_if_false @WHY

0002: jump @FAILED

:WHY

0002: jump @TRST  

 

:FAILED

0004: [email protected] = 400 

0002: jump @TRST 

 

:ENDE  

0001: wait 0

01C3: remove_references_to_car [email protected] 

0002: jump @WACHT

 

Edited by baclaine
Link to comment
Share on other sites

7 hours ago, baclaine said:

Script is for the definitive edition.

Ah, that clears up the initial questions, and is critical information when posting scripting issues.

 

There are still a couple of wrong opcodes; global version used instead of local version.

//0004: [email protected] = 400 
0006: [email protected] = 400

//000A: [email protected] += 1
000B: [email protected] += 1

Note that for math and conditional commands that include a constant, if the opcode is omitted then SB can figure out the proper opcode for you.

 

I'm not sure if this would cause a crash or not, but... There doesn't appear to be any kind of trap to prevent a routine from executing multiple times while a HID is pressed.

 

Make sure the player is defined before executing player based commands.

04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 5.0 -0.33

 

Edited by OrionSR
Link to comment
Share on other sites

baclaine

Hi

 

I fixed it my biggest fault was release model after the number changed so I released a model which hasn't been spawned and flooded the ram probably.

Script work now next step is removing the RC vehicles from my spawner but that shouldn't be so hard. And define player more.

Thanks for your help.

 

Script now: 

 

 

{$CLEO .cs}

 

0000: NOP

0006: [email protected] = 400

 

:WACHT

0001: wait 90

0A90: is_hid_pressed 15

004D: jump_if_false @WACHT 

0A90: is_hid_pressed 12

004D: jump_if_false @WACHT

0002: jump @START

 

:START

00A6: destroy_car [email protected] 

0001: wait 90 

0247: load_model [email protected] 

038B: load_requested_models 

0001: wait 0

  

04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 5.0 -0.33

:CAR

0001: wait 90

0248: model [email protected] available

004D: jump_if_false @START

00A5: [email protected] = create_car [email protected] at [email protected] [email protected] [email protected]

0249: release_model [email protected] 

 

:ACTION0

0001: wait 0

03E5: show_text_box 'TEXT1'

0A90: is_hid_pressed 63

004D: jump_if_false @VOL1 

0002: jump @NEXT

:VOL1  

0A90: is_hid_pressed 12

004D: jump_if_false @VOL2 

0002: jump @ENDE

:VOL2  

0002: jump @ACTION0

 

:NEXT 

0001: wait 0

000B: [email protected] += 1

0039: [email protected] == 611 

004D: jump_if_false @WHY

0002: jump @FAILED

:WHY

0002: jump @START  

 

:FAILED

0006: [email protected] = 400 

0002: jump @START 

 

:ENDE  

0001: wait 0

01C3: remove_references_to_car [email protected] 

0002: jump @WACHT

 

 

 

 

 

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.