| View previous topic :: View next topic |
| Author |
Message |
sjl002 Master Cheater
Reputation: 0
Joined: 31 Aug 2013 Posts: 305
|
Posted: Sat May 28, 2016 3:04 am Post subject: Keypress in script |
|
|
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 |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat May 28, 2016 3:15 am Post subject: |
|
|
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 |
|
 |
predprey Master Cheater
Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Sat May 28, 2016 3:33 am Post subject: |
|
|
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 |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat May 28, 2016 3:38 am Post subject: |
|
|
| predprey wrote: | | calling GetAsyncKeyState | -That too.
|
|
| Back to top |
|
 |
|