View previous topic :: View next topic |
Author |
Message |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 28, 2013 9:33 pm Post subject: How to set a timer for a value? |
|
|
I am writing a script that has a registersymbol called d_enable. When enabled, the value is set to 1. However, I would like the value to automatically change back to 0 after 1000 miliseconds. Is this possible?
Thanks. |
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Sun Apr 28, 2013 9:42 pm Post subject: |
|
|
This will disable it.
you can remove the last line, and add it to your function that enables the hack, so it will start the timer and after 1000ms (1 second) will disable it.
Code: | function AutoDisable()
if (readInteger('d_enable')==1) then
writeInteger('d_enable', 0)
end
end
DisableTimer = createTimer(nil,false)
timer_setInterval(DisableTimer, 1000)
timer_onTimer(DisableTimer, AutoDisable)
timer_setEnabled(DisableTimer,true) |
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 28, 2013 9:46 pm Post subject: |
|
|
Thanks for the reply.
Is there any trick to adding this to my script, directly? |
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Sun Apr 28, 2013 9:47 pm Post subject: |
|
|
Assembly script? _________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 28, 2013 9:48 pm Post subject: |
|
|
Yeah. |
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Sun Apr 28, 2013 9:49 pm Post subject: |
|
|
If you're using only assembly, then I will into it...
Check if it possible to call sleep...
because in LUA you could do this
Code: | sleep(1000)
writeInteger('d_enable', 0) |
Note: Cheat Engine will not respond during that second. _________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 28, 2013 10:00 pm Post subject: |
|
|
Thanks. Unfortunately, I do not have any programming background, so most of it is over my head. |
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 28, 2013 10:25 pm Post subject: |
|
|
No worries. I figured it out.
I just set another registersymbol called time. Set the value to whatever I want and subtract 1 from it. Just perform a couple of compares to jump where I want and set the d_enable back to 0.
I appreciate your help, though.
Thanks. |
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Sun Apr 28, 2013 10:30 pm Post subject: |
|
|
But doing so, might cause an endless loop or crash.
I wonder what kind of hack is it?
you could use this:
Code: |
push #1000
call sleep
mov [d_enable],0 |
But the bad part is that it freezes the game. _________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 28, 2013 10:40 pm Post subject: |
|
|
So far, so good. Part of the script:
Code: |
enemy:
push ebx
mov ebx,[eax+C4]
mov ebx,[ebx+2C]
mov ebx,[ebx+0C]
cmp ebx,00000000
pop ebx
jne originalcode
cmp [v_enable],1
je enemyvac
cmp [d_enable],1
je enemydrop
jmp originalcode
enemydrop:
cmp [time],0
jg drop
jmp reset
drop:
sub [time],1
mov [eax+38],(float)130.0
jmp exit
reset:
mov [d_enable],0
jmp originalcode
x_c:
dd 0
y_c:
dd 0
z_c:
dd 0
s_enable:
dd 0
l_enable:
dd 0
v_enable:
dd 0
d_enable:
dd 0
time:
dd 0 |
|
|
Back to top |
|
 |
|