View previous topic :: View next topic |
Author |
Message |
Meiyoh Master Cheater
Reputation: 1
Joined: 14 Mar 2015 Posts: 402
|
Posted: Thu May 19, 2016 3:21 pm Post subject: stop lua script |
|
|
Ok so how I stop my script which copies bytes from one address to another?
I can't stop it . closing the script that enables the address causes cheat engine to SAY "Stack overflow" and then It crashes.
Now I have to reset my game to be able to continue
Everything I found for information doesn't stop the script from running.
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4700
|
Posted: Thu May 19, 2016 4:29 pm Post subject: |
|
|
Code: | timer.Enabled = false |
If you want any more help than that, post your script. At the very least tell us if you're using Lua or asm.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Meiyoh Master Cheater
Reputation: 1
Joined: 14 Mar 2015 Posts: 402
|
Posted: Thu May 19, 2016 11:42 pm Post subject: |
|
|
Thank you very much.
t = createTimer()
t.Interval = 1000
t.OnTimer = function(sender)
local v = readBytes("EnemyData", 4, true)
writeBytes("EnemyData2", v)
local v = readBytes("EnemyData3", 4, true)
writeBytes("EnemyData+4", v)
local v = readBytes("EnemyData+8", 4, true)
writeBytes("PCHealth", v)
end
How can I make this script run and stop when those EnemyData address pointers stop working Eg the source address pointer stops working or is closed and displays ?? value to prevent script from crashing cheat engine.
Also I want to make this work on a Kyes press example Shift+4 ON, And Shift+5 Off - manually aside from the function which checks if the addresses have valid pointers (not ?? Value) .
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4700
|
Posted: Thu May 19, 2016 11:50 pm Post subject: |
|
|
Use the Enabled property like I showed, except use t for the variable instead of timer.
readBytes won't return anything if it doesn't successfully read from it, so just use an if statement and check if v is defined after each call to readBytes. If it's not defined, then disable the timer and return.
Use the GenericHotkey class to use hotkeys. See main.lua for documentation and use google for examples.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Meiyoh Master Cheater
Reputation: 1
Joined: 14 Mar 2015 Posts: 402
|
Posted: Fri May 20, 2016 1:50 am Post subject: |
|
|
ParkourPenguin wrote: | Use the Enabled property like I showed, except use t for the variable instead of timer.
readBytes won't return anything if it doesn't successfully read from it, so just use an if statement and check if v is defined after each call to readBytes. If it's not defined, then disable the timer and return.
Use the GenericHotkey class to use hotkeys. See main.lua for documentation and use google for examples. |
nah... I am stuck here
care to make an example especially the part with the IF V is defined.
Thank you.
Really need to start reading tutorials. I am good at finding stuff not scripting but that must change thanks to people like you.
Appreciate your help a lot.
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4700
|
Posted: Fri May 20, 2016 8:47 am Post subject: |
|
|
Code: | local v = readBytes("EnemyData", 4, true)
if not v then -- alternatively: if v == nil then
sender.Enabled = false
return
end |
PS: you only have to put local on the first declaration of the same variable, not every assignment. AKA, you only need to have "local v = ..." on the first one. Everything else you can have "v = ...".
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Meiyoh Master Cheater
Reputation: 1
Joined: 14 Mar 2015 Posts: 402
|
Posted: Fri May 20, 2016 11:04 am Post subject: |
|
|
ParkourPenguin wrote: | Code: | local v = readBytes("EnemyData", 4, true)
if not v then -- alternatively: if v == nil then
sender.Enabled = false
return
end |
PS: you only have to put local on the first declaration of the same variable, not every assignment. AKA, you only need to have "local v = ..." on the first one. Everything else you can have "v = ...". |
Thank you! Real people here real developers and people who like sharing! Because of people like you I am inspired to continue modding!
Thank you deeply! All the best to you and your family!
|
|
Back to top |
|
 |
|