Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help creating a timer that activates code after 1500ms

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Unicorngoulash
Newbie cheater
Reputation: 0

Joined: 19 Apr 2018
Posts: 19
Location: Netherlands

PostPosted: Fri Jan 25, 2019 5:11 am    Post subject: Help creating a timer that activates code after 1500ms Reply with quote

I am trying to find a way to add a timer that lets a value reach #513 and then sets it to #1 after 15000ms

Can it be done in auto assembly, and if so could someone please provide me with an example that I could try. Thank you!



Help.jpg
 Description:
 Filesize:  112.23 KB
 Viewed:  3573 Time(s)

Help.jpg


Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Fri Jan 25, 2019 7:00 am    Post subject: Reply with quote

Code:
pushad
push 05DC
call kernel32.Sleep
popad

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
Unicorngoulash
Newbie cheater
Reputation: 0

Joined: 19 Apr 2018
Posts: 19
Location: Netherlands

PostPosted: Fri Jan 25, 2019 7:31 am    Post subject: Reply with quote

Thank you for replying.
Where exactly should I add the line of code?

[ENABLE]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem:

push eax
mov eax,dword ptr [ePSXe.exe+B69EA4]
cmp dword ptr [ePSXe.exe+B69EA4],#513
cmovz eax,[newvalue2]
mov dword ptr [ePSXe.exe+B69EA4],eax
pop eax

jmp return

code:
// ...

newvalue2:
dd #1

return:

originalcode:
mov [eax+ePSXe.exe+A82020],dl

exit:
jmp returnhere

"ePSXe.exe"+65260:
jmp newmem
nop
returnhere:[/list]
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Fri Jan 25, 2019 10:05 am    Post subject: Reply with quote

If you're using a code injection, you shouldn't call sleep. It'll probably have other undesirable effects.
Code:
define(address,"ePSXe.exe"+65260)
define(bytes,88 90)

[ENABLE]
assert(address,bytes)

alloc(newmem,2048)
label(returnhere)
label(exit)
label(checkTime)
label(setTime)

newmem:
  push eax
  push ecx
  push edx
  cmp byte ptr[hitVal],0
  jne short checkTime
  cmp [val],#513
  je short setTime
exit:
  pop edx
  pop ecx
  pop eax
  mov [eax+ePSXe.exe+A82020],dl
  ret
checkTime:
  call GetTickCount
  sub eax,[oldt]
  cmp eax,#14999
  jbe short exit
  mov byte ptr[hitVal],0
  mov [val],1
  jmp short exit
setTime:
  mov byte ptr[hitVal],1
  call GetTickCount
  mov [oldt],eax
  jmp short exit

newmem+400:
oldt:
  dd 0
hitVal:
  db 0
 

address:
  jmp newmem
  nop
returnhere:

[DISABLE]

address:
  mov [eax+ePSXe.exe+A82020],dl
 
dealloc(newmem)

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Unicorngoulash
Newbie cheater
Reputation: 0

Joined: 19 Apr 2018
Posts: 19
Location: Netherlands

PostPosted: Fri Jan 25, 2019 11:30 am    Post subject: Reply with quote

Thank you for replying.
I tried your script but there seems to be errors in some lines.
Or I'm doing something wrong, I just copied and pasted it.

checkTime:
call GetTickCount
sub eax,[oldt]
cmp eax,#14999
jbe short exit
mov byte ptr[hitVal],0
mov [val],1 <----- Auto Assembly does not seem to know this.
jmp short exit
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Fri Jan 25, 2019 1:53 pm    Post subject: Reply with quote

Code:
cmp eax,#1499 // not #14999
// ...
newmem+400:
val:
dd 0

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Fri Jan 25, 2019 7:27 pm    Post subject: Reply with quote

val is just whatever address you're monitoring.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Unicorngoulash
Newbie cheater
Reputation: 0

Joined: 19 Apr 2018
Posts: 19
Location: Netherlands

PostPosted: Sat Jan 26, 2019 1:06 am    Post subject: Reply with quote

I am still having a lot of trouble trying those things without running into problems and my game crashing.
Could someone be so kind to take my existing script and edit it in a way that would work. I'm a noob.

I've been using this particular script and modifying it for a lot of different games thanks to "Old cheat engine user"

It's bassicaly a double jump code for Tomba 2.
Back to top
View user's profile Send private message
salumor
Advanced Cheater
Reputation: 0

Joined: 14 Jan 2019
Posts: 87

PostPosted: Sat Jan 26, 2019 8:27 am    Post subject: Reply with quote

Maybe because you mess with flags, but never restore them (if there is jump afterwards that makes use of flags set somewhere before).
Adding "pushf" before your first cmp and "popf" somewhere after last jump, where it will be always executed(!!) - in this case right at start of exit, might stop crashing. (if you did set val correctly so it's [ePSXe.exe+B69EA4] )
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Sat Jan 26, 2019 11:42 am    Post subject: Reply with quote

Unicorngoulash wrote:
I am still having a lot of trouble trying those things without running into problems and my game crashing.
Could someone be so kind to take my existing script and edit it in a way that would work. I'm a noob.

I've been using this particular script and modifying it for a lot of different games thanks to "Old cheat engine user"

It's bassicaly a double jump code for Tomba 2.

here is the complete script it should work without issues:
ParkourPenguin wrote:
If you're using a code injection, you shouldn't call sleep. It'll probably have other undesirable effects.
Code:
define(address,"ePSXe.exe"+65260)
//define(bytes,88 90)

[ENABLE]
//assert(address,bytes)

alloc(newmem,2048)
label(returnhere)
label(exit)
label(checkTime)
label(setTime)

newmem:
  push eax
  push ecx
  push edx
  cmp byte ptr[hitVal],0
  jne short checkTime
  cmp [ePSXe.exe+B69EA4],#513
  je short setTime
exit:
  pop edx
  pop ecx
  pop eax
  mov [eax+ePSXe.exe+A82020],dl
  jmp returnhere
checkTime:
  call GetTickCount
  sub eax,[oldt]
  cmp eax,#1499
  jbe short exit
  mov byte ptr[hitVal],0
  mov [ePSXe.exe+B69EA4],1
  jmp short exit
setTime:
  mov byte ptr[hitVal],1
  call GetTickCount
  mov [oldt],eax
  jmp short exit

newmem+400:
oldt:
  dd 0
hitVal:
  db 0
 

address:
  jmp newmem
  nop
returnhere:

[DISABLE]

address:
  mov [eax+ePSXe.exe+A82020],dl
 
dealloc(newmem)

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites