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 in script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
sjl002
Master Cheater
Reputation: 0

Joined: 31 Aug 2013
Posts: 305

PostPosted: Sat May 28, 2016 3:04 am    Post subject: Keypress in script Reply with quote

Hi.
How can make the Keypress in AutoAssemble(scripts)
I test Geri script (Super Health with F1, drain health with F2) for stronghold crusaderII but game crashed
*Very thanks*
Sjl002
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat May 28, 2016 3:15 am    Post subject: Reply with quote

If you don't want to use LUA, you can use registersymbol, set up a hotkey for that symbol, and incorporate a conditional jump inside your script that checks the value. For example, set up a hotkey that sets the value to 1, then, inside your script, check if the value is 1, if it is, jump to code section. Inside code section, set the value back to 0 and execute your code.

Alternatively, you can find the address/instruction that handles that key (or all keys), and hook the function to store the address (or value) to be used in your script for your conditional jump etc.
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Sat May 28, 2016 3:33 am    Post subject: Reply with quote

calling GetAsyncKeyState should give you a return value for whether a key is pressed. Google for the Virtual Key value you want and push it onto the stack before calling. then write a conditional jump to skip your code if key is not pressed.

e.g
push 70 //code for "F1" in hex
call GetAsyncKeyState
cmp ax,1
jne originalcode


Last edited by predprey on Sat May 28, 2016 3:39 am; edited 1 time in total
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat May 28, 2016 3:38 am    Post subject: Reply with quote

predprey wrote:
calling GetAsyncKeyState
-That too. Very Happy
Back to top
View user's profile Send private message
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