View previous topic :: View next topic |
Author |
Message |
karaulov Advanced Cheater Reputation: 0
Joined: 12 Aug 2013 Posts: 65 Location: Belarus
|
Posted: Fri May 27, 2016 1:48 am Post subject: Stop lua script after close |
|
|
How to stop lua script after close window?
F#cking script work after close window, show window back, i can't close it!!!!!!!!
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Fri May 27, 2016 3:23 am Post subject: |
|
|
axd an onClose event to the window. in there disable the script. like disabling timers, threads, and perhaps closing cheat engine completely
_________________
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 |
|
|
karaulov Advanced Cheater Reputation: 0
Joined: 12 Aug 2013 Posts: 65 Location: Belarus
|
Posted: Fri May 27, 2016 3:48 am Post subject: |
|
|
Why?!
Please create new function closeThisScript() for complete close script! If a lot of timers, threads etc - impossible to destroy all !!!!
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri May 27, 2016 4:14 am Post subject: Re: Stop lua script after close |
|
|
karaulov wrote: | How to stop lua script after close window?
F#cking script work after close window, show window back, i can't close it!!!!!!!! |
We are not magicians. We don't know what script you wrote.
Post your CT file (you can snip some things if you want) which shows your problem.
Then I or someone else will tell what to do and post back a fixed CT.
_________________
|
|
Back to top |
|
|
hhhuut Grandmaster Cheater Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Fri May 27, 2016 4:32 am Post subject: |
|
|
Because you do not always want to deactivate the script when just closing it.
|
|
Back to top |
|
|
karaulov Advanced Cheater Reputation: 0
Joined: 12 Aug 2013 Posts: 65 Location: Belarus
|
Posted: Fri May 27, 2016 5:15 am Post subject: |
|
|
Who does not want just do not use this feature. But it is needed!
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Fri May 27, 2016 5:40 am Post subject: |
|
|
closeCE() will close all threads and timers
alternatively, keep track of the timers and threads you create and terminate them.
tip: If your timer is embedded inside a form (owned by a form) then destroying the form will also kill the timer.
if you return caFree in the OnClose event of the form, the form will be destroyed instead of just hidden
_________________
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 |
|
|
karaulov Advanced Cheater Reputation: 0
Joined: 12 Aug 2013 Posts: 65 Location: Belarus
|
Posted: Fri May 27, 2016 6:46 am Post subject: |
|
|
How to add action OnCLose without form ?
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri May 27, 2016 7:41 am Post subject: |
|
|
Quote: | If a lot of timers, threads etc - impossible to destroy all !!!! |
Not a problem. You can write your own createTimer function so it will create and register all timers.
Code: | collectedTimers = {}
function myCreateTimer(...)
local timer = createTimer(...)
collectedTimers[#collectedTimers+1] = timer
return timer
end
function destroyAllTimers()
for _,v in ipairs(collectedTimers) do
v.destroy()
end
collectedTimers = {}
end
function disableAllTimers()
for _,v in ipairs(collectedTimers) do
v.Enabled=false
end
end
function enableAllTimers()
for _,v in ipairs(collectedTimers) do
v.Enabled=true
end
end
|
Just use myCreateTimer for every timer you want to create.
When you want to shutdown the timer(s) object just use this in "Lua Engine" window
About threads. This's more complicated. And solution will be different depending on how many threads you have, does one of those has "free on terminate" (which is the default setting)...
_________________
Last edited by mgr.inz.Player on Fri May 27, 2016 8:22 am; edited 1 time in total |
|
Back to top |
|
|
karaulov Advanced Cheater Reputation: 0
Joined: 12 Aug 2013 Posts: 65 Location: Belarus
|
Posted: Fri May 27, 2016 8:17 am Post subject: |
|
|
How to use it without form? (How to create onClose event)
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
|
Back to top |
|
|
karaulov Advanced Cheater Reputation: 0
Joined: 12 Aug 2013 Posts: 65 Location: Belarus
|
Posted: Fri May 27, 2016 11:45 pm Post subject: |
|
|
Help, i don't know, how to add event onClose in console script window?!
|
|
Back to top |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Sat May 28, 2016 2:48 am Post subject: |
|
|
yourObject.onClose = function (sender)
....your code(destroy(), etc...)
end
onClose is just a property though....your object needs to be able to call it, if its not a form
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat May 28, 2016 4:18 am Post subject: |
|
|
create new text file with .lua extension inside autorun folder, with this script:
Code: | collectedTimers = {}
originalCreateTimer = createTimer
function createTimer(...)
local timer = originalCreateTimer(...)
collectedTimers[#collectedTimers+1] = timer
return timer
end
function addDestroyTimersButton()
local btn=getMainForm().frmAutoInject.Button1
local newButton = createButton(getMainForm().frmAutoInject.Panel1)
newButton.Height = 31
newButton.Width = 129
newButton.Caption = "Destroy all timers"
newButton.AnchorSideTop.Control = btn
newButton.AnchorSideLeft.Control = btn
newButton.AnchorSideLeft.Side = asrBottom
newButton.BorderSpacing.Left = 5
newButton.OnClick = function ()
for _,v in ipairs(collectedTimers) do
v.destroy()
end
collectedTimers = {}
end
end
addDestroyTimersButton() |
It will add "Destroy all timers" button to "Lua Script: Cheat Table" window.
_________________
|
|
Back to top |
|
|
karaulov Advanced Cheater Reputation: 0
Joined: 12 Aug 2013 Posts: 65 Location: Belarus
|
Posted: Sat May 28, 2016 8:40 am Post subject: |
|
|
Yes it works!
Only for lua table window, not works with lua console script ??
|
|
Back to top |
|
|
|