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 


How to make caption that tell the cheat is attach to game

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Lynxz Gaming
Expert Cheater
Reputation: 4

Joined: 01 Jul 2017
Posts: 208
Location: help

PostPosted: Sat Jul 01, 2017 6:04 am    Post subject: How to make caption that tell the cheat is attach to game Reply with quote

How to make caption that tell the cheat is attach to game?

can anyone help me?
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sat Jul 01, 2017 9:07 am    Post subject: Reply with quote

Code:

onOpenProcess = function(pid)
  yourlabel.Caption = "Attached to " .. pid
end


That won't update if you close the process (or it crashes). If you want that then as far as I know you'd need to create a timer and have it check eg.

Code:

-- on (re)attach update label
onOpenProcess = function(pid)
  CETrainer.CELabel1.Caption = "Attached to " .. pid
  reinitializeSymbolhandler() -- wait until fully attached
  local tmr = createTimer()
  tmr.OnTimer = function(this)
    -- getOpenedProcessID() did not update when I closed the test process
    local currentpid = getProcessIDFromProcessName(process)
    if currentpid == nil then
      CETrainer.CELabel1.Caption = "No longer attached"
      this.destroy() -- quit checking
    end
  end
  tmr.Interval = 1000 -- 1 second
end


Though at that point you may also want it to reattach automatically as well

Code:

-- on (re)attach update label
onOpenProcess = function(pid)
  local tmr = createTimer()
  tmr.OnTimer = function(this)
    -- getOpenedProcessID() did not update when I closed the test process
    local currentpid = getProcessIDFromProcessName(process)
    if currentpid == nil then
      CETrainer.CELabel1.Caption = "No longer attached"
      openProcess(targetprocess) -- try to reattach (if reopened)
    else
      CETrainer.CELabel1.Caption = "Attached to " .. currentpid
    end
  end
  tmr.Interval = 3000 -- 3 seconds
end


example ct
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
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