|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Reclaimer Shawn Advanced Cheater Reputation: 0
Joined: 09 Jun 2015 Posts: 77
|
Posted: Fri Sep 02, 2016 10:01 pm Post subject: How to create a Hotkey in Lua that writes to address |
|
|
So, my code is 99.9% complete(and yours too, Zanzer. I included you in the credits.) 99% of the time my codes work, but sometimes a write occurs that cannot be taken back within a millisecond of time. Most of the time this will not happen, but when it does, I want it to be correctable. So, I want them to be able to press something like the A key, Alt Key, or an F# key. How would I write this? After this, the code is finished!
|
|
Back to top |
|
|
cooleko Grandmaster Cheater Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Fri Sep 02, 2016 10:46 pm Post subject: |
|
|
Why dont you have the code itself check if the write "took" by performing a read and writing it again if it didnt? Users shouldnt have to do the work themselves, they wanted you to do it, that is why they want to use your works!
If you are dead set on it, then:
Code: | function checkKeys(timer)
if (isKeyPressed(VK_A)) then
write_w/e(address,value)
end
end
t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)
|
|
|
Back to top |
|
|
Reclaimer Shawn Advanced Cheater Reputation: 0
Joined: 09 Jun 2015 Posts: 77
|
Posted: Fri Sep 02, 2016 11:07 pm Post subject: |
|
|
cooleko wrote: | Why dont you have the code itself check if the write "took" by performing a read and writing it again if it didnt? Users shouldnt have to do the work themselves, they wanted you to do it, that is why they want to use your works!
If you are dead set on it, then:
Code: | function checkKeys(timer)
if (isKeyPressed(VK_A)) then
write_w/e(address,value)
end
end
t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)
|
|
Now, for all of my writes I've had to use writeBytes as the entire game is in Big Endian format. The only reason I'm using this is because freezing the address is not viable. It has to do with health values, but those are also directly related with battle termination. If it continously went, the battle never ends. But, if it doesn't the value doesn't sync. And I can't see how many times the value gets written to via ASM because the game is in PPC. See my dilemmas? I really appreciate the help though! So, how would I use this with the writeBytes function?
|
|
Back to top |
|
|
cooleko Grandmaster Cheater Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Fri Sep 02, 2016 11:30 pm Post subject: |
|
|
replace writes_w/e with writeBytes
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri Sep 02, 2016 11:31 pm Post subject: |
|
|
Code: | if health_hotkey ~= nil then
health_hotkey.destroy()
end
health_hotkey = createHotkey(function()
writeBytes("address", bytes)
end, VK_A) |
|
|
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
|
|