CLEO Help NR reverse timer - change "wait 1000" with something more efficient

CLEO related

Escalasion

Member
Joined
Sep 20, 2024
Messages
14
Reaction score
0
Hello. I would like to somehow replace this "wait 1000" in this cleo type timer with something more efficient, so that it does not affect the other codes implemented in "while true", because when this "wait 1000" runs, it also affects the other codes in "while true" to all have a delay of one second, which is a bit annoying, and I want this to stop happening and I was thinking that the only solution is to replace this "wait 1000" with something that does not affect the codes in "while true", an opcode, variable or something, because if I remove this "wait 1000", the timer no longer works correctly and starts to decrease instantly until it reaches 0 seconds and disappears in a fraction of a second. The problem is that I don't really know what other mechanism to add in exchange for this "wait 1000", so that the timer works and also decreases by one second until it reaches 0 seconds and then the timer starts to disappear automatically, without affecting the other codes in "while true" and having a delay of one second. How could I implement a new mechanism for the code? Because I would like the code to be exactly like now, but to replace only this "wait 1000" with another more efficient mechanism that does not affect the other codes in "while true" at all. I am waiting for an answer from you.
 

Attachments

  • NR reverse timer.cs
    21.5 KB · Views: 3

dphome

Well-known member
Joined
Mar 21, 2020
Messages
477
Solutions
9
Reaction score
170
Location
Poland
Try it like with 33@ using the example code below.
PHP:
{$CLEO .cs}
0000:
                                      
33@ = 0

WHILE TRUE
WAIT 0

IF AND
0AB0:   key_pressed 18 // ALT
0AB0:   key_pressed 50 // 2
THEN
    0B12: 30@ = 30@ XOR 1        
    WAIT 1000
END
    
IF 30@ == TRUE
THEN                     
    IF 33@ > 10000
    THEN           
        0AC8: 4@ = allocate_memory_size 260
        0AD3: 4@ = format "/g"
        0AB1: @SEND_CMD 1 4@
        0AC9: free_allocated_memory 4@
        33@ = 0
    END                                 
END

END
0A93: terminate_this_custom_script
 

Escalasion

Member
Joined
Sep 20, 2024
Messages
14
Reaction score
0
Thank you. It works perfectly exactly as I wanted, but one thing I don't understand, why does it only work with the local variable of type 32@ or 33@? If I enter with another local or global variable, it doesn't work. I don't understand that.
 
Top