Posted: Sun Apr 21, 2019 7:28 pm Post subject: CE Lua call function when stopped pressing hotkey
I am using CE Lua to create a hotkey for changing an addresses value. How can I also change the addresses value when I have stopped pressing the hotkey?
Example (not working):
Code:
function enableThing()
writeString(address, "enabled")
end
function disableThing()
writeString(address, "disabled")
end
bonus question: is there a way to do this in normal CE interface (can do something when hotkey pressed, but how to do something when hotkey stopped being pressed?
Use timer, check if key pressed(checkAsyncKey function) if key is pressed do action and set a variable to true (key press was pressed), add another check if key is not pressed but variable was set to true (means user no longer holds down a key but it previously did), reset variable (to false) and fire your action after key press.
Note that the variable must be defined out the function or as global.
Hope this helps, if you need any exame let me know I,ll post one when I get home. _________________
I'm rusty and getting older, help me re-learn lua.
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
Posted: Tue Apr 23, 2019 3:21 am Post subject:
are you sure it's not working?
Add print commands to your hotkey and check if they work or not
Is address valid?
and yes, you can do this in the ce interface. Just rightclick a memory record, and pick the set hotkey option
then create a set value hotkey _________________
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
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