Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Stop lua script after close
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat May 28, 2016 1:05 pm    Post subject: Reply with quote

karaulov wrote:
Yes it works! Very Happy

Only for lua table window, not works with lua console 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

  local luaengineform=getLuaEngine()
  luaengineform.Panel3.Width = 218
  newButton = createButton(luaengineform.Panel3)
  newButton.Width = 129
  newButton.Caption = "Destroy all timers"
  newButton.AnchorSideTop.Control = luaengineform.btnExecute
  newButton.AnchorSideLeft.Control = luaengineform.btnExecute
  newButton.AnchorSideBottom.Control = luaengineform.btnExecute
  newButton.AnchorSideLeft.Side = asrBottom
  newButton.AnchorSideBottom.Side = asrBottom
  newButton.Anchors = '[akTop, akLeft, akBottom]'
  newButton.BorderSpacing.Left = 5
  newButton.OnClick = function ()
                       for _,v in ipairs(collectedTimers) do
                        v.destroy()
                       end
                       collectedTimers = {}
                      end
end

addDestroyTimersButton()

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites