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 


Game State in label

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
sjl002
Master Cheater
Reputation: 0

Joined: 31 Aug 2013
Posts: 305

PostPosted: Mon Sep 19, 2016 7:21 am    Post subject: Game State in label Reply with quote

Hi.
I can anyone help me to complete this script with timer (I mean is that when game is running timer type in label "game is running" and when game is not running timer type in label "game is not running")

Code:
if openProcess("game.exe") then
CETrainer.StateLabel.caption =  "Game is running"
else
CETrainer.StateLabel.caption = "game is not running"
end   


*Thanks my friend* Embarassed
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Mon Sep 19, 2016 8:34 am    Post subject: Reply with quote

If for ce 6.5+, may try
Code:

-- this is for ce 6.5+
CheckTimer = CheckTimer or createTimer()
CheckTimer.Interval = 5000
CheckTimer.OnTimer = function(tm)
  local target = 'game' -- change according to name check method below
  local attached = GetProcessList()[GetOpenedProcessID()]
  local isTarget = attached and attached:lower():match(target:lower())
--   for more restricted checking use
--local isTarget = attached and attached==target
--   target has to set exactly
  local state
  if not attached then
    state = 'Trainer is not attached to a process'
  elseif not isTarget then
    state = 'Trainer is attached to a different process: '..process
  else
    state = process .. ' is running'
  end
  GetMainForm().Caption = state  -- change 'GetMainForm()' to your ui
end

bye~

_________________
- Retarded.
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