View previous topic :: View next topic |
Author |
Message |
mordax Expert Cheater Reputation: 1
Joined: 16 Apr 2010 Posts: 121
|
Posted: Tue May 29, 2012 6:21 am Post subject: Hotkeys in lua |
|
|
pretty much what it says. i was asking in other topic, but i guess it went too much offtopic and i did not get reply.
i know that hotkey for button is like this
Code: | createHotkey(CEButton14Click, VK_INSERT) |
but what if i want hotkey to set specific value and not press a button?
how could i do tht?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25291 Location: The netherlands
|
Posted: Tue May 29, 2012 8:01 am Post subject: |
|
|
Not really sure what you're asking and why you think this is button specific code. (CEButton14Click is just a functionname, not a button)
anyhow:
Code: |
createHotkey(functionThatSetsSpecificValue, VK_INSERT)
|
example:
Code: |
function functionThatSetsSpecificValue(sender)
writeInteger("[[bla.exe+1234]+12]+13", 123456)
end
createHotkey(functionThatSetsSpecificValue, VK_INSERT)
|
_________________
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 |
|
|
mordax Expert Cheater Reputation: 1
Joined: 16 Apr 2010 Posts: 121
|
Posted: Tue May 29, 2012 1:58 pm Post subject: |
|
|
thanks. i got it now. im just having problems understanding lua. it was quite stupid question really, but im all new to lua.
I have another question. what would be the function to toggle freeze of the value instead of specific value?
like if i want to write a hotkey function that freezes/unfreezes the value at specific address/pointer ?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25291 Location: The netherlands
|
Posted: Tue May 29, 2012 2:59 pm Post subject: |
|
|
3 methods
1: just toggle the freeze property of a memoryrecord
2: create a timer that sets the value every time it executes and then enable/disable the timer to freeze/unfreeze
3: create a thread in an infinite loop that sets the value to the address. Use a variable to determine if it should set or not
3b: same as 3 but instead of a thread use an infinite loop and use processMessages to prevent freezing (Stupid method)
_________________
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 |
|
|
mordax Expert Cheater Reputation: 1
Joined: 16 Apr 2010 Posts: 121
|
Posted: Wed May 30, 2012 6:46 am Post subject: |
|
|
im still beginner in lua. can you plz show me example of whichever you think would work best?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25291 Location: The netherlands
|
Posted: Wed May 30, 2012 7:05 am Post subject: |
|
|
First two options work the best
3th one is a bit more complex and more cpu intensive
1: Just add a memoryrecord to your cheattable and assign it a toggle hotkey (rightclick, assign hotkey)
Alternatively, get the addresslist (getAddressList() ), then get the memoryrecord from the addresslist(e.g: addresslist_getMemoryRecordByDescription(addresslist, description), then call memoryrecord_freeze(memrec) to freeze and memoryrecord_unfreeze(memrec) to unfreeze
2:
Code: |
function address1Freezer(timer)
writeInteger(0x12345, 123)
end
function freezeAddress1()
if (address1FreezeTimer==nil) then --first time init
address1FreezeTimer=createTimer(nil,false)
timer_setInterval(address1FreezeTimer,100) --set value every 100 milliseconds
timer_onTimer(address1FreezeTimer, address1Freezer)
end
timer_setEnabled(address1FreezeTimer, true)
end
function unfreezeAddress1()
if (address1FreezeTimer~=nil) then
timer_setEnabled(address1FreezeTimer, false) --stop the freezer
end
end
|
call freezeAddress1() to freeze and unfreezeAddress1() to unfreeze
_________________
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 |
|
|
|