jgoemat Master Cheater
Reputation: 23
Joined: 25 Sep 2011 Posts: 264
|
Posted: Sat Sep 22, 2012 11:42 am Post subject: Keyboard script |
|
|
I wrote this for some cheats I'm writing and thought others might find it useful or have comments on how to do it better or improve it.
I think it's handy to be able to have a cheat activated only while holding down a key or when a key is pressed. For instance in FTL I'm changing my code so that you can hover over scrap/fuel/missiles/drone parts and use shift+UP to add 100 and SHIFT+DOWN to subtract 100. And when you hover over a crew those buttons will do the same for their health, plus SHIFT+MMB will give them complete training. In GOF2 holding down shift will cause your and the shop's inventory not to go down when you buy/sell.
The keypress tutorial will let you see when a key is pressed, but this script has it's own thread and keeps track of the time the key was pressed so any cheat can see if it was pressed since the last time a check was done.
Code: | Sample call:
LABEL(MyKeyCode)
MyKeyCode:
// 14 is VK_CAPITAL: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731.aspx
DD 14 0 0 0
// now the code to actually check
push MyKeyCode
call CheckKeyPress
test eax, 80000001 // eax is return, also [MyKeyCode+8]
js DestinationIfNewPress // sign bit (MSB) is if new press (last call passing this struct wasn't pressed or was pressed at a different time)
jnz DestinationIfPressed // bit 0 (LSB) is set if pressed at all
// not pressed here |
Description: |
|
 Download |
Filename: |
Keyboard.cea |
Filesize: |
6.37 KB |
Downloaded: |
572 Time(s) |
|
|