CLEO Help Using jumps/looping?

CLEO related
Status
Not open for further replies.

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
Hey guys, I am making an automated script which basically uses location coords to send commands accordingly.
First I tried using a high-level while true and even repeat loops but it didn't work as I expected (my mistakes probably).
Here is my current code (all of it);
Code:
{$CLEO}

thread 'BoatGM'
wait 10000
0ac8: 15@ = 260
0ad3: 15@ = ""
$unlockVar = 0 //0=locked

:step1
wait 0
if and
        Player.Defined($PLAYER_CHAR)
        not Actor.Driving($PLAYER_ACTOR)
        0AF8: samp add_message_to_chat "{00FF00}just checked for driving or not"
then
        if
                00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //POSITION A
        then
                0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 1 start"
                0B2E: 0@ = read_samp_memory offset 0x015970 size 2          //SetPlayerPos NOP ON
                0B2D: write_samp_memory offset 0x015970 value 0xC390 size 2  //SetPlayerPos NOP ON
                0AF8: samp add_message_to_chat "{00FF00}NOP ON"
                wait 2000
                0C8F: samp process_chat_input "/enter" //get inside the house
                wait 2000
                0C8F: samp process_chat_input "/tp biz" // tp to BIZ, SEE THIS IS WHERE I TELEPORT TO POSITION B!
                wait 10000
                0B2D: write_samp_memory offset 0x015970 value 0@ size 2 //SetPlayerPos NOP OFF
                0AF8: samp add_message_to_chat "{00FF00}NOP OFF"
                wait 500
                0C8F: samp process_chat_input "/enter" // get inside the biz
                wait 2000
                0C8F: samp process_chat_input "/exit" //get outside the biz
                wait 2000
                0C8F: samp process_chat_input "/.playa" //walk to STEP 3 coords enterance only via WalkPathA.txt & WalkPathA.cs
                $unlockVar = 1 //0=locked     
        end 
end
wait 100
if
    $unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
    $unlockVar == 0//re-lock
    jump @step2
else
    wait 2000
    jump @step1
end
//////////////////////////
:step2
wait 0
if and
        Player.Defined($PLAYER_CHAR)
        not Actor.Driving($PLAYER_ACTOR)
then
        if
                00EC:   actor $PLAYER_ACTOR sphere 0 near_point 51.8815 -293.4846 radius 3.0 3.0//POSITION B
        then
                0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 2 start"
                //commands for this position go here
                $unlockVar = 1 //0=locked
        end 
end
wait 100
if
    $unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
    $unlockVar == 0//re-lock
    jump @step3
else
    jump @step2
end

/////////////////////////
:step3
wait 0
if and
        Player.Defined($PLAYER_CHAR)
        not Actor.Driving($PLAYER_ACTOR)
then
        if
                00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.5806 1581.9320 radius 3.0 3.0//POSITION C
        then
                0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 3 start"
               //commands for this position go here
                $unlockVar = 1 //0=locked
        end
end
wait 100
if
    $unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
    $unlockVar == 0//re-lock
    jump @step4
else
    jump @step3
end

//////////////////
:step4
wait 0
if and
        Player.Defined($PLAYER_CHAR)
        not Actor.Driving($PLAYER_ACTOR)
then
        if
                00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.2827 1551.8660 radius 3.0 3.0//POSITION D
        then
                0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 4 start"
                //commands for this position go here
                $unlockVar = 1 //0=locked
        end
end
wait 100
if
    $unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
    $unlockVar == 0//re-lock
    jump @step5
else
    jump @step4
end

////////////////////////////////
:step5
wait 0
if and
        Player.Defined($PLAYER_CHAR)
        not Actor.Driving($PLAYER_ACTOR)
then
        if
                00EC:   actor $PLAYER_ACTOR sphere 0 near_point 142.4275 -180.6222 radius 3.0 3.0 //POSITION B again!
        then
                //commands for this position go here
                $unlockVar = 1 //0=locked
        end
end
wait 100
if
    $unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
    $unlockVar == 0//re-lock
    jump @step6
else
    jump @step5
end

////////////////////////////////
:step6
wait 0
if and
        Player.Defined($PLAYER_CHAR)
        not Actor.Driving($PLAYER_ACTOR)
then
        if
                00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //POSITION A again
        then
                0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 6 start"
                0C8F: samp process_chat_input "/.stopb"
                wait 6000
                0AF8: samp add_message_to_chat "{00FF00}Looping again"  // done!
                $unlockVar = 1 //0=locked
        end
end
wait 100
if
    $unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
    $unlockVar == 0//re-lock
    jump @step1//lets go back and start all over again!
else
    jump @step6
end
////////////////////////////////

:SAY
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x65C60  // FUNC_SENDCMD for 0.3.7
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0

So basic idea (summary of code);
I have 5 positions!
Position A, B, C, D,.

Now what I want is;
Label Step 1, detects whenever I approach position A. [If I dont go near Position A, Step 1 should keep looping and keep checking until I arrive at Pos A, and currently this step works fine!]
When approached position A, performs the CMDs, then goes to position B (Step 2 label) and waits for player to approach it. [problem starts here]
Then Step 2 will do cmds from position B, then go to Position C (Step 3).
Then, Position C to Position D (Step 4).
And then Position D back to Position B (Step 5).
Then Position B back to Position A (Step 6).
Then repeat.


The problem is basically;
Step 1 works fine! But after it executes, step 1 sends player from A to B, but then CLEO jumps straight to Step 5 (as step 5 is also triggered by position B). But I want this to happen in sequential order! Step 1 2 3 4 and then 5 and 6.

How can I achieve this? Can anyone help me? If anyone has a high level solution I would prefer that than this, but I couldnt make a high level (i tried it was too buggy), so I tried low level. But this doesn't work either.
 
Last edited:

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
Don't just say "high-level" is buggy and resort to low-level, you're better off showing the incorrect high level code.
http://ugbase.eu/index.php?threads/help-dialogs.21528/#post-126118
Sure, I meant my own version of high level was buggy so I didn't use it. I thought I could do better with low level but I guess not. I only know Java coding (newbie beginner coder here), so I do prefer high level than low.

I think I got rid of my high-level code, but what I did was:
Code:
...............basic code like defining thread and etc, main code below
wait 0
if and
        Player.Defined($PLAYER_CHAR)
        not Actor.Driving($PLAYER_ACTOR)
then
        if
                00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //POS A
        then
                //commands to execute
                while true
                    wait 0
                    repeat
                        wait 0
                        0AD1: show_test "Waiting for location to enter POSB" time 2000
                        wait 3000
                    until 00EC:   actor $PLAYER_ACTOR sphere 0 near_point 51.8815 -293.4846 radius 3.0 3.0 //POS B
                        //commands     to execute 
                end
                while true
                    wait 0
                    repeat
                        wait 0
                        0AD1: show_test "Waiting for location of getcrate POSC" time 2000
                        wait 2200
                    until 00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.5806 1581.9320 radius 3.0 3.0 // POSC
                        //commands         to execute
                end
                //and so on for other positions

*This is just editing the "auto_getmats.cs" cleo, for my own use. All credits go to real authors.

This worked but it wasn't great. What happened was sometimes it approached Positon B for example, then it left, but CLEO still kept checking for position B. Or it might go position C and detect it, execute position C commands, but after leaving still checks for position C (mainly because of my wait time? But idk how else to do it).
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,690
Reaction score
103
Sure, I meant my own version of high level was buggy so I didn't use it. I thought I could do better with low level but I guess not. I only know Java coding (newbie beginner coder here), so I do prefer high level than low.

I think I got rid of my high-level code, but what I did was:
Code:
...............basic code like defining thread and etc, main code below
wait 0
if and
        Player.Defined($PLAYER_CHAR)
        not Actor.Driving($PLAYER_ACTOR)
then
        if
                00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //POS A
        then
                //commands
                while true
                    wait 0
                    repeat
                        wait 0
                        0AD1: show_test "Waiting for location to enter POSB" time 2000
                        wait 3000 
                    until 00EC:   actor $PLAYER_ACTOR sphere 0 near_point 51.8815 -293.4846 radius 3.0 3.0 //POS B
                        //commands                     
                end
                while true
                    wait 0
                    repeat
                        wait 0
                        0AD1: show_test "Waiting for location of getcrate POSC" time 2000
                        wait 2200 
                    until 00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.5806 1581.9320 radius 3.0 3.0 // POSC
                        //commands           
                end
                //and so on for other positions
You don't need to put loop within a loop like that, even you're using it to wait. Infact you don't need any sort of loops you can just use a var to check each condition. Obviously change the vars from the example to suit your own script.
Code:
WHILE TRUE
    WAIT 0
    
    IF AND
        0@ == 0
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //POS A
    THEN
        0@ = 1 // Allows next condition but not this one.
        // DO STUFF
    END
    
    IF AND
        0@ == 1 // Check to see if first condition has done it's thing.
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 51.8815 -293.4846 radius 3.0 3.0 //POS B
    THEN
        0@ = 2 // Go next
        // DO STUFF
    END
    
    IF AND
        0@ == 2
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.5806 1581.9320 radius 3.0 3.0 // POSC
    THEN
        0@ = 0 // Resets it back to POS A, obviously set it 3 if you want to carry on with more.
        // DO STUFF
    END
    
END
This sort of thing is much easier to control so say your script bugs or something and you want to go from POS B back to POS A or reset the entire thing you could just register a cmd or something to put 0@ = 0 and that will reset it. If you want those output messages that could be done by a number of ways aswell.
 

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
Thanks mate, I'll try in a little bit, before I do, can I ask;

Where can I find a guide to learn about variable printing, string concentation? I tried sanny builder website but it didn't help.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
149
hi, I think it would help a lot if you modified the code to have less repetitions, it would be much easier to find mistakes

Code:
{$CLEO}
0000: // added
 
thread 'BoatGM'
wait 10000
0ac8: 15@ = 260
0ad3: 15@ = ""


:reset_step
31@ = 0 // step variable

:next_step
31@ += 1

:main
wait 100
if and
    Player.Defined($PLAYER_CHAR)
    not Actor.Driving($PLAYER_ACTOR)
jf @main  // jump if false (it will allow to use 1 less indent level in the code underneath)

if and 
    31@ == 1
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //HOUSE
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 1 start"
    0B2E: 0@ = read_samp_memory offset 0x015970 size 2          //SetPlayerPos NOP ON
    0B2D: write_samp_memory offset 0x015970 value 0xC390 size 2  //SetPlayerPos NOP ON
    0AF8: samp add_message_to_chat "{00FF00}NOP ON" 
    wait 2000
    0C8F: samp process_chat_input "/enter" //get inside the house
    wait 2000
    0C8F: samp process_chat_input "/tp biz" // tp to BIZ
    wait 10000
    0B2D: write_samp_memory offset 0x015970 value 0@ size 2 //SetPlayerPos NOP OFF
    0AF8: samp add_message_to_chat "{00FF00}NOP OFF"
    wait 500
    0C8F: samp process_chat_input "/enter" // get inside the biz
    wait 2000
    0C8F: samp process_chat_input "/exit" //get outside the biz
    wait 2000
    0C8F: samp process_chat_input "/.playa" //walk to STEP 3 coords enterance only via WalkPathA.txt & WalkPathA.cs 
    jump @next_step  
end 

if and 
    31@ == 2
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 51.8815 -293.4846 radius 3.0 3.0 
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 2 start"
    jump @next_step   
end    

if and 
    31@ == 3
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.5806 1581.9320 radius 3.0 3.0
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 3 start"
    jump @next_step   
end 

if and
    31@ == 4
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.2827 1551.8660 radius 3.0 3.0
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 4 start"
    jump @next_step      
end

if and
    31@ == 5
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 142.4275 -180.6222 radius 3.0 3.0 //outside of BIZ enterance ((SEE, after step 1 executes, it teleports my character to this position, but what step 2 does is make the player walk away from here and step 4 will bing the player back here, then THIS should execute, not straight away after step1
then
    //commands for this position go here
    jump @next_step 
end

if and
    31@ == 6
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //outside of House
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 6 start"
    0C8F: samp process_chat_input "/.stopb"
    wait 6000
    0AF8: samp add_message_to_chat "{00FF00}Looping again"  // done!
    jump @reset_step  
end    
jump @main



:SAY
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x65C60  // FUNC_SENDCMD for 0.3.7
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,690
Reaction score
103
Thanks mate, I'll try in a little bit, before I do, can I ask;
What does 0@= int do?
What is 0@ for? (sorry it's my third day coding CLEO so I am very new).

Also where can I find a guide to learn about variable printing, string concentation? I tried sanny builder website but it didn't help.
0@ - 31@ are just variables, nothing special about 0@ I just used it as it's the first variable available. Seen as you can run an "IF" check on the value of a variable so like check if 0@ == 1 then you might aswell change a variables ID to affect these different conditons you have.
Oh and the string stuff you can find here.
http://ugbase.eu/index.php?threads/tutorial-text-handling.19741/
 

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
hi, I think it would help a lot if you modified the code to have less repetitions, it would be much easier to find mistakes

Code:
{$CLEO}
0000: // added

thread 'BoatGM'
wait 10000
0ac8: 15@ = 260
0ad3: 15@ = ""


:reset_step
31@ = 0 // step variable

:next_step
31@ += 1

:main
wait 100
if and
    Player.Defined($PLAYER_CHAR)
    not Actor.Driving($PLAYER_ACTOR)
jf @main  // jump if false (it will allow to use 1 less indent level in the code underneath)

if and
    31@ == 1
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //HOUSE
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 1 start"
    0B2E: 0@ = read_samp_memory offset 0x015970 size 2          //SetPlayerPos NOP ON
    0B2D: write_samp_memory offset 0x015970 value 0xC390 size 2  //SetPlayerPos NOP ON
    0AF8: samp add_message_to_chat "{00FF00}NOP ON"
    wait 2000
    0C8F: samp process_chat_input "/enter" //get inside the house
    wait 2000
    0C8F: samp process_chat_input "/tp biz" // tp to BIZ
    wait 10000
    0B2D: write_samp_memory offset 0x015970 value 0@ size 2 //SetPlayerPos NOP OFF
    0AF8: samp add_message_to_chat "{00FF00}NOP OFF"
    wait 500
    0C8F: samp process_chat_input "/enter" // get inside the biz
    wait 2000
    0C8F: samp process_chat_input "/exit" //get outside the biz
    wait 2000
    0C8F: samp process_chat_input "/.playa" //walk to STEP 3 coords enterance only via WalkPathA.txt & WalkPathA.cs
    jump @next_step
end

if and
    31@ == 2
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 51.8815 -293.4846 radius 3.0 3.0
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 2 start"
    jump @next_step
end

if and
    31@ == 3
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.5806 1581.9320 radius 3.0 3.0
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 3 start"
    jump @next_step
end

if and
    31@ == 4
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.2827 1551.8660 radius 3.0 3.0
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 4 start"
    jump @next_step
end

if and
    31@ == 5
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 142.4275 -180.6222 radius 3.0 3.0 //outside of BIZ enterance ((SEE, after step 1 executes, it teleports my character to this position, but what step 2 does is make the player walk away from here and step 4 will bing the player back here, then THIS should execute, not straight away after step1
then
    //commands for this position go here
    jump @next_step
end

if and
    31@ == 6
    00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //outside of House
then
    0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 6 start"
    0C8F: samp process_chat_input "/.stopb"
    wait 6000
    0AF8: samp add_message_to_chat "{00FF00}Looping again"  // done!
    jump @reset_step
end
jump @main



:SAY
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x65C60  // FUNC_SENDCMD for 0.3.7
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0

Hey monday (or if anyone else knows, you're welcome to help ), I technically understand your code and it's similar to Zin, i think it should work but I have one issue.
When it goes to the end, at Step 6, you know where the message "Looping again" is popping up, after that, my player just bugs off. What happens if I do not see my character, health bar is gone and its just freezes. I have to relog to fix it. So basically it is not looping. Any idea why? Everything else works flawlessy. I didn't post my code because the issue is in looping (step 6, which monday has the code already so it's just that essentially).

I'll try incoporating this into a while loop as a different try, but I still wonder why this has the bug . Okay, I tried using Zin's method, still at the end, my player disappears, camera is set to high sky in Santa Maria, Health goes 0, A top left bar showing "Gambling" of 0% appears (like in GTA SA we have CJ's fat level or sex appeal). Then a relog fixes it. Reckon you know why? Only happens at the end. Both using while true and even monday's method.
The bug scene I get:
 
Last edited:

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
149
I can't see the issue by looking at the code. I also didn't test it myself so don't know if it actually produces the same problem... I think it's a bad practice to search for a bug in a code that wasn't tested in the same exact form. It would be much better if you posted the code that you tested (and noticed that bug) even if the changes to it were small and seem insignificant
 

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
I can't see the issue by looking at the code. I also didn't test it myself so don't know if it actually produces the same problem... I think it's a bad practice to search for a bug in a code that wasn't tested in the same exact form. It would be much better if you posted the code that you tested (and noticed that bug) even if the changes to it were small and seem insignificant
Code:
{$CLEO}
0000: // added

thread 'AutoDS'
wait 20000
0ac8: 15@ = 260
0ad3: 15@ = ""
5@ = 0

//:main
//if and
//    Player.Defined($PLAYER_CHAR)
//    not Actor.Driving($PLAYER_ACTOR)
//jf @main  // jump if false (it will allow to use 1 less indent level in the code underneath)

while true
    wait 0

    if and
        5@ == 0
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 2.5 2.5 //CL-HOUSE
    then
        5@ = 1 // Allows next condition but not this one.
        //MY COMMANDS
    end
    //.......lots of incrementing steps here, 5@ is incremented from 1 to 5 in here......

    if and
        5@ == 5
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 2.5 2.5 //outside of House
    then
        5@ = 0//reset, will loop again now
        0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 6 start"
        0C8F: samp process_chat_input "/.stopb"
        wait 6000//just incase entering before
        0AF8: samp add_message_to_chat "{00FF00}Looping again"  // done!
        wait 100 //SEE after this wait/message above, game gets bugged.
    end       
end

0AF8: samp add_message_to_chat "{00FF00}low key rn"
:SAY
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x65C60  // FUNC_SENDCMD for 0.3.7
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0

Sure here we go buddy. This isn't your code exactly, because I tried that, and then tried this (Zin's version). I'll just share this to keep things simple :)
Thats my code above in a nutshell, and here is the game being buggy after (tried in 2 PCs, same bug): With this bug, I can still use t and chat. Player messages come, just I cant move or see my player or anything else.
EDIT: Just tried via clean CLEO, so only this mod and the tp mod installed, same issue.
 
Last edited:

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
149
hmm, in the comment you wrote: "SEE after this wait/message above, game gets bugged."
The problem is that the code following that "wait/message" is not really included in the post... It's a bit like "Where's Wally?" with parts of the image hidden. I can only guess, make assumptions
 

Attachments

  • 1587460390098.png
    1587460390098.png
    969.5 KB · Views: 6

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
Code:
0AF8: samp add_message_to_chat "{00FF00}low key rn"
:SAY
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x65C60  // FUNC_SENDCMD for 0.3.7
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0
Hey, you mean this code after my comment? Idk, this was already in the CLEO I initially started off. But I just tried after removing this too, but still I get the error.
And ( 0AF8: samp add_message_to_chat "{00FF00}low key rn") was just for me to check if Cleo is going outsoide the While True statement or not (and it does not, it stays inside the while true but bug is still there).

ALso here is the full code if it helps;

Code:
{$CLEO}
0000: // added

thread 'AutoDS'
wait 20000
0ac8: 15@ = 260
0ad3: 15@ = ""
5@ = 0

//:main
//if and
//    Player.Defined($PLAYER_CHAR)
//    not Actor.Driving($PLAYER_ACTOR)
//jf @main  // jump if false (it will allow to use 1 less indent level in the code underneath)

while true
    wait 250
   
    if and
        5@ == 0
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 2.5 2.5 //CL-HOUSE
    then
        5@ = 1 // Allows next condition but not this one.
        wait 3500
        0AF8: samp add_message_to_chat "{00FF00}Performed loc check, Step 1 Start"
        0B2E: 0@ = read_samp_memory offset 0x015970 size 2          //SetPlayerPos NOP ON
        0B2D: write_samp_memory offset 0x015970 value 0xC390 size 2  //SetPlayerPos NOP ON
        0AF8: samp add_message_to_chat "{00FF00}NOP ON"
        wait 2000
        0C8F: samp process_chat_input "/enter" //get inside the house
        wait 2000
        0C8F: samp process_chat_input "/tp biz" // TP to BIZ
        wait 10000
        0B2D: write_samp_memory offset 0x015970 value 0@ size 2 //SetPlayerPos NOP OFF
        0AF8: samp add_message_to_chat "{00FF00}NOP OFF"
        wait 500
        0C8F: samp process_chat_input "/enter" // get inside the biz
        wait 2000
        0C8F: samp process_chat_input "/exit" //get outside the biz
        wait 2000
        0C8F: samp process_chat_input "/.playa" //walk to STEP 3 coords enterance only via WalkPathA.txt & WalkPathA.cs
    end
   
    if and
        5@ == 1 // Check to see if first condition has done it's thing.
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 51.9762 -293.5292 radius 2.5 2.5//outside of DF
    then
        5@ = 2 // Go next
        0AF8: samp add_message_to_chat "{00FF00}Performed loc check, Step 2 Start"
        0C8F: samp process_chat_input "/.stopa"//stop path A
        wait 200
        0C8F: samp process_chat_input "/enter" //get in DF
        wait 200
        0AF8: samp add_message_to_chat "{00FF00}Just entered DF"
        wait 200
        0C8F: samp process_chat_input "/.playc" // walk from DH interior entrance to getcrate point
    end
   
    if and
        5@ == 2
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.5806 1581.9320 radius 2.8 2.8//
    then
        5@ = 3
        0AF8: samp add_message_to_chat "{00FF00}Performed loc check, Step 3 Start"
        0C8F: samp process_chat_input "/.stopc"
        wait 200
        0C8F: samp process_chat_input "/te"
        wait 200
        0C8F: samp process_chat_input "c"
        wait 1000
        0C8F: samp process_chat_input "/.playd" // walk from point to DH exit door inside
    end
   
    if and
        5@ == 3
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2205.2827 1551.8660 radius 2.5 2.5 //DF exit point
    then
        5@ = 4
        0AF8: samp add_message_to_chat "{00FF00}Performed loc check, Step 4 Start"
        0C8F: samp process_chat_input "/.stopd"
        wait 200
        0C8F: samp process_chat_input "/exit"
        wait 200
        0AF8: samp add_message_to_chat "{00FF00}Just left DF"
        wait 500
        0C8F: samp process_chat_input "/.playe" // walk from DH enterance back to biz front enterance outside
    end
   
    if and
        5@ == 4
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 142.4275 -180.6222 radius 2.5 2.5 //outside of BIZ enterance
    then
        5@ = 5
        0AF8: samp add_message_to_chat "{00FF00}Performed loc check, Step 5 Start"
        wait 200
        0C8F: samp process_chat_input "/.stope"
        wait 200
        0B2E: 0@ = read_samp_memory offset 0x015970 size 2          //SetPlayerPos NOP ON
        0B2D: write_samp_memory offset 0x015970 value 0xC390 size 2  //SetPlayerPos NOP ON
        0AF8: samp add_message_to_chat "{00FF00}NOP ON"
        wait 1000
        0C8F: samp process_chat_input "/enter"   // bugged rn
        wait 2000
        0C8F: samp process_chat_input "/tp house"  //got home, still bugged
        wait 200
        0B2D: write_samp_memory offset 0x015970 value 0@ size 2 //SetPlayerPos NOP OFF
        0AF8: samp add_message_to_chat "{00FF00}NOP OFF"
        wait 2000
        wait 2000
        0C8F: samp process_chat_input "/enter"//enter house                                          
        wait 2000
        0C8F: samp process_chat_input "/exit"//exit the house, should be fine now no bugged
        wait 2000
        0C8F: samp process_chat_input "/.playb" // walk from house front to delivery point and then get back
        wait 2000//let me get away from the house before u start house enterance check again XD
    end
   
    if and
        5@ == 5
        00EC:   actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 2.5 2.5 //outside of House
    then
        5@ = 0//reset, will loop again now
        0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 6 start"
        0C8F: samp process_chat_input "/.stopb"
        wait 1000//just incase entering before 10sec restriction
        0AF8: samp add_message_to_chat "{00FF00}Looping again"  // done!
        wait 100
    end          
end

0AF8: samp add_message_to_chat "{00FF00}low key rn"
:SAY
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x65C60  // FUNC_SENDCMD for 0.3.7
    0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
149
I referred to the part you didn't include in the code (not necessarily under the end of while loop visually).
E.g. what if in the "not-included" part there's an opcode that frees memory from 15@ (which appears to be allocated at the begining only)? That could possibly lead to a bug on the next iteration of "while" loop. But again, I can only guess.

Edit:
It cannot be determined whether the parts preceding step 5 display any message (which would allow to notice whether the next iteration of the while loop at least starts executing following all the steps)
 

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
I referred to the part you didn't include in the code (not necessarily under the end of while loop visually).
E.g. what if in the "not-included" part there's an opcode that frees memory from 15@ (which appears to be allocated at the begining only)? That could possibly lead to a bug on the next iteration of "while" loop. But again, I can only guess.
Haha my bad buddy. I gave you my full code.

Also I dont think I need 15@ (I am editting auto_getmats.cs, all credits to real author), to my own taste. So That author used 15@, I didn't. I am using 5@. I just dont remove code I dont know so I stay away from ruining stuff. But yeah I think I can get rid of 15@ as I only use 5@.

EDIT: I did not fully get your EDIT, but as far as I understand, everything works normally until "Looping again". All commands, all messages, everything is executed normally. Straight after Looping again message appears, game goes buggy.
 
Last edited:

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
Actually, I fixed it! If I remove the message: "Looping again". Somehow this issue doesn't occur. Amazing lmao.
Reckon you know why so this message causes error?

Anyways a big big thank you to you Monday and Zin for both helping me out! Cheers guys!
 
Last edited:

Hidend

Expert
Joined
Mar 4, 2013
Messages
625
Reaction score
39
Maybe because you didn't add the color at the end?
0AF8: samp add_message_to_chat "{00FF00}Looping again" // done!
Should be
0AF8: samp add_message_to_chat "{00FF00}Looping again" -1

Maybe there's a default color if none is added but idk it could be that
 
Last edited:

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
Maybe because you didn't add the color at the end?
0AF8: samp add_message_to_chat "{00FF00}Looping again" // done!
Should be
0AF8: samp add_message_to_chat "{00FF00}Looping again" -1

Maybe there's a default color if none is added but idk it could be that
EDIT: Nah it's probably not that xd
Haha, nah colour looks fine. I tried changing text to "Test" and that crashed too. No text, works.
 

Hidend

Expert
Joined
Mar 4, 2013
Messages
625
Reaction score
39
Haha, nah colour looks fine. I tried changing text to "Test" and that crashed too. No text, works.
It's not that it doesn't work, you can change the color using {COLOR} inside the string (first parameter) but 0af8 takes 2 parameters according to the docs (https://blast.hk/wiki/opcodes:0af8), so the correct use should be 0af8: "text" -1, somehow you don't use the second parameter along all the code so maybe there's like a default color but I'm not sure about that...
 
Status
Not open for further replies.
Top