CLEO Help notify when minutes pass

CLEO related
Status
Not open for further replies.

noob213

Active member
Joined
Sep 15, 2017
Messages
88
Reaction score
6
a code to let me know when minutes have passed from the game time someone could pass it to me


I'm not very good with this
{$CLEO .cs}
0000: NOP

while true
wait 0
00BF: 27@ = current_time_hours, 27@ = current_time_minutes
if

then
chatmsg "6" -1
 
Last edited:

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
149
cleo has 2 variables that are timers (32@ and 33@), you could use one of them to check if 6 minutes passed

32@ = 0
while true
wait 0
if 32@ > 360000
then
// 6 minutes passed
32@ = 0
end
end


the downside of this method is that it probably it won't work when game gets minimized. Also if you lag, these timers will be affected and 6 minutes won't be perfectly measured as far as I know. Alternatively you could use this function:
http://ugbase.eu/index.php?threads/snippet-gettickcount.18999/

Or this thing, but it would require modification:
http://ugbase.eu/index.php?threads/snippet-date-and-time.16533/
 

noob213

Active member
Joined
Sep 15, 2017
Messages
88
Reaction score
6
If that would be a problem if the timer does not do its job if the game is minimized

some example how it would be using these snippets:(
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
149
to use the GetTickCount you can just copy the whole code (provided in that link) and paste it at the end of your file, and then use it like this:

Code:
0AB1: call_scm_func @GetTickCount 0 _returnedTickCount 0@ 
0@ += 360000
while true
    wait 0
    0AB1: call_scm_func @GetTickCount 0 _returnedTickCount 1@
    if 001D:   1@ > 0@
    then
        0085: 0@ = 1@
        0@ += 360000
        
        // 6 seconds passed
    end
end


you could use 'GetLocalTime' like this:
Code:
{$CLEO}
0000:

0AB1: call_scm_func @Get_Second 0 0@
while true
wait 0
    0AB1: call_scm_func @Get_Second 0 1@
    0062: 1@ -= 0@

    if 1@ < 0
    then 1@ += 60
    end

    if 1@ >= 6
    then
        0AB1: call_scm_func @Get_Second 0 0@

        // 6 seconds passed
        0AD1: show_formatted_text_highpriority "6 sec passed. (0@ = %d)" 3000 0@
    end
    
end


:Get_Second
0AC8: 30@ = allocate_memory_size 30
0AA2: 29@ = load_library "kernel32.dll" // IF and SET
    if 0AA4: 28@ = get_proc_address "GetLocalTime" library 29@
    then
        0A8C: write_memory 30@ size 2 value 1 virtual_protect 1
        0AA5: call_function 28@ num_params 1 pop 0 30@
        0085: 31@ = 30@ // (int)
        31@ += 12
        26@ = 0
        0A8D: 26@ = read_memory 31@ size 2 virtual_protect 1
    end
0AA3: free_library 29@
0AC9: free_allocated_memory 30@
0AB2: ret 1 26@
 

noob213

Active member
Joined
Sep 15, 2017
Messages
88
Reaction score
6
to use the GetTickCount you can just copy the whole code (provided in that link) and paste it at the end of your file, and then use it like this:

Code:
0AB1: call_scm_func @GetTickCount 0 _returnedTickCount 0@
0@ += 360000
while true
    wait 0
    0AB1: call_scm_func @GetTickCount 0 _returnedTickCount 1@
    if 001D:   1@ > 0@
    then
        0085: 0@ = 1@
        0@ += 360000
       
        // 6 seconds passed
    end
end


you could use 'GetLocalTime' like this:
Code:
{$CLEO}
0000:

0AB1: call_scm_func @Get_Second 0 0@
while true
wait 0
    0AB1: call_scm_func @Get_Second 0 1@
    0062: 1@ -= 0@

    if 1@ < 0
    then 1@ += 60
    end

    if 1@ >= 6
    then
        0AB1: call_scm_func @Get_Second 0 0@

        // 6 seconds passed
        0AD1: show_formatted_text_highpriority "6 sec passed. (0@ = %d)" 3000 0@
    end
   
end


:Get_Second
0AC8: 30@ = allocate_memory_size 30
0AA2: 29@ = load_library "kernel32.dll" // IF and SET
    if 0AA4: 28@ = get_proc_address "GetLocalTime" library 29@
    then
        0A8C: write_memory 30@ size 2 value 1 virtual_protect 1
        0AA5: call_function 28@ num_params 1 pop 0 30@
        0085: 31@ = 30@ // (int)
        31@ += 12
        26@ = 0
        0A8D: 26@ = read_memory 31@ size 2 virtual_protect 1
    end
0AA3: free_library 29@
0AC9: free_allocated_memory 30@
0AB2: ret 1 26@
works fine thanks
 
Status
Not open for further replies.
Top