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 


Keypress serious problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Wheel Of Fate
Advanced Cheater
Reputation: 0

Joined: 01 Oct 2010
Posts: 75

PostPosted: Sun Jun 19, 2016 5:54 pm    Post subject: Keypress serious problem Reply with quote

I Know this was posted like hundred times but i really need some help
after many crashes and failures.
here is the script which was generated by AA:
Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
fld dword ptr [esi+0000021C]

exit:
jmp returnhere

0046081D:
jmp newmem
nop
returnhere:

[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
0046081D:
fld dword ptr [esi+0000021C]
//Alt: db D9 86 1C 02 00 00


how to apply the keypress script and that instruction
Code:
add [esi+0000021C],(float)01

or these instructions
Code:
fld dword ptr [esi+0000021C]
cmp [esi+000002D4],0
jne exit
add [esi+0000021C],(float)01

to the script above
also i would like to refer keypress script by cheatengine website
what is origin refer to? in the keypress script?

Code:

origin:
jmp mycode
exit:

mycode:
pushad //I have no idea what registers get modified by GetAsyncKeystate (my guess eax,ebx,ecx but I hate guesing)
pushfd //always a good idea to save the flags

...
push 'X' ;key to watch, for special keys, check out google for virtual key codes
call GetAsyncKeyState
//bit 15 is 1 if it is CURRENTLY down
//bit 0 is 1 if it has been pressed down since last time it was hecked
//to check bit 0, do:
//and ax,1 //and mask with 0000000000000001
//cmp ax,1
//jne notpressedsincelasttime

//note, this is just to keep it simple, there are more optimized ways to do it, but more confusing as well (e.g using AND)
shr ax,#15 //shift bits in the AX register to the right and fill the left side with 0's, so 1000000000000000 changes to 0000000000000001 and since it's on a 16 bit register, there's no bit beyond bit 15
cmp ax,1 //if bit 15 was set to 1 ax now contains the value of either 1 or 0. 1 meaning it's pressed
jne notpressed

//it's pressed
...
...do whatever you want when the key is pressed (e.g. mov [ecx+24],#100 to set health to 100)
...

notpressed:
//cleanup
popfd
popad

originalcodeandothercleanupstuff:
...
jmp exit

i hope someone post a sample according to AA script


Last edited by Wheel Of Fate on Sun Jun 19, 2016 6:06 pm; edited 2 times in total
Back to top
View user's profile Send private message AIM Address
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Sun Jun 19, 2016 6:02 pm    Post subject: Reply with quote

If you just want to toggle the script, why don't you leave the key check out of it and right click on the script in address list and set hotkey?

If you want something else then someone else will help you.
Back to top
View user's profile Send private message
Wheel Of Fate
Advanced Cheater
Reputation: 0

Joined: 01 Oct 2010
Posts: 75

PostPosted: Tue Jun 21, 2016 5:42 am    Post subject: Reply with quote

Ok Thanks Guys Don't Bother I Figured It Out.
Special Thanks Goes To My Friend And My Mentor "Geri" For His Awesome Scripts.

Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
alloc(keypress,2048)
label(returnhere)
label(originalcode)
label(exit)

keypress: //this is allocated memory, you have read,write,execute access
//place your code here
pushad
pushfd
push edx
push 'R'
call GetAsyncKeyState
and ax,1
cmp ax,1
pop edx
jne originalcode
jmp newmem

newmem: //this is allocated memory, you have read,write,execute access
//place your code here
cmp [esi+000002D4],0
je exit
add [esi+0000021C],(float)01

originalcode:
popfd
popad
fld dword ptr [esi+0000021C]

exit:
jmp returnhere

0046081D:
jmp keypress
nop
returnhere:

[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
dealloc(keypress)
0046081D:
fld dword ptr [esi+0000021C]
//Alt: db D9 86 1C 02 00 00
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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