|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Redouane Master Cheater Reputation: 3
Joined: 05 Sep 2013 Posts: 363 Location: Algeria
|
Posted: Tue Jun 24, 2014 2:27 pm Post subject: GenericHotkey objects |
|
|
Hello,In a platform game,I am doing a script that allows you to teleport your player anywhere,it remplaces the codes that write to your coordinates with nops,then it sets Left,Right,Up,Down as hotkeys to change the coordinates,each time up arrow is pressed,the player y's value is decreased (and he goes up) etc.
The problem is that createHotkey is defined as createHotkey( function(self) , key1 , key2... )
So the function (arg 1) cannot get the pressed key if there are many defined,here's what I did:
Code: | local h = createHotkey( move , VK_UP , VK_DOWN , VK_LEFT , VK_RIGHT ) |
And the function move:
Code: | do
local numbers = {[VK_UP] = -15 , [VK_DOWN]=15 , [VK_RIGHT]=15 , [VK_LEFT]=-15 }
function move ( self , key )
memRecord.Value = memRecord.Value + numbers[ key ]
end |
key is not passed as an argument,is there any way to get it inside the function?
Thanks.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Tue Jun 24, 2014 2:42 pm Post subject: |
|
|
Code: |
createHotkey( move , VK_UP , VK_DOWN , VK_LEFT , VK_RIGHT )
|
that will create a hotkey that will trigger when up, down left and right are down all at the same time.
What you need to do is create a hotkey for every key with each a different function.
so:
Code: |
createHotkey( moveUp , VK_UP )
createHotkey( moveDown , VK_DOWN )
createHotkey( moveLeft , VK_LEFT )
createHotkey( moveRight , VK_RIGHT )
|
If you like it combined then let each function call a main function with an identifier indicating which key it was
(also, you could use the getKeys() method of the self parameter to figure out which key is pressed)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Redouane Master Cheater Reputation: 3
Joined: 05 Sep 2013 Posts: 363 Location: Algeria
|
Posted: Tue Jun 24, 2014 3:02 pm Post subject: |
|
|
Dark Byte wrote: | Code: |
createHotkey( move , VK_UP , VK_DOWN , VK_LEFT , VK_RIGHT )
|
that will create a hotkey that will trigger when up, down left and right are down all at the same time.
What you need to do is create a hotkey for every key with each a different function.
so:
Code: |
createHotkey( moveUp , VK_UP )
createHotkey( moveDown , VK_DOWN )
createHotkey( moveLeft , VK_LEFT )
createHotkey( moveRight , VK_RIGHT )
|
If you like it combined then let each function call a main function with an identifier indicating which key it was
(also, you could use the getKeys() method of the self parameter to figure out which key is pressed) |
Thank you.
|
|
Back to top |
|
|
|
|
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
|
|