|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
16-Bit Newbie cheater Reputation: 0
Joined: 17 Jan 2012 Posts: 21
|
Posted: Thu Jan 19, 2012 3:53 am Post subject: Problem with script |
|
|
Hi CE
This is my first attempt at a script using Cheat Engine and I'm having problems getting this code right.
Code: | function heal()
InputHP=3000
keyID=115
var=readInteger("xxx.exe+43E1B4")
if(var <= InputHP) then
keyDown(keyID)
keyUp(keyID)
end
end
t=createTimer(nil);
timer_setInterval(t,400)
timer_onTimer(t,heal)
timer_setEnabled(t,false)
function start()
timer_setEnabled(t,true)
end
function stop()
timer_setEnabled(t,false)
end
createHotkey("start", VK_NUMPAD5)
createHotkey("stop", VK_NUMPAD6) |
The code is based off the topic found here:
h ttp://forum.cheatengine.org/viewtopic.php?t=546035 <-- remove space
The script monitors the health by checking every 400ms and executes a key stroke to replenish the health. The script is turned on by pushing 5 and ends by pushing 6.
The issue I have with this script is that its based off a timer and tends to cause issues within the game such as pushing the hotkey twice, or tends to be too slow to initiate.
Is there any way to script this such that it only initiates when the value is changed - without the need for a timer. Similarly is there a better way to execute the on/off feature of the script.
Looking forward to reading the suggestions! Thanks |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Thu Jan 19, 2012 6:06 pm Post subject: |
|
|
Try increasing the speed of the timer (lower interval) and keep track when the last time was when you pressed the key.
If the time of last press is too small, don't press the key.
Hmm,not sure if lua provides time functions...
After pressing the key disable the timer and activate another timer that when it's timer triggers activates the main timer and disables itself till next keypressemu _________________
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 |
|
|
|
|
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
|
|