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 exe attached confimation as "Game loaded" cap

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

Joined: 12 Nov 2013
Posts: 167

PostPosted: Sat Dec 28, 2013 3:03 am    Post subject: Game exe attached confimation as "Game loaded" cap Reply with quote

What is the script for showing "Game loaded" when the game exe is started and "Game not loaded" when the process is not attached to the trainer?
I tried this

Code:
function onOpenProcess()
control_setCaption(MyForm.CELabel1, "Game Loaded")


It changes the caption of CELabel1 correctly when game is opened.
But how to make it change to "game not loaded" when game exe is not opened up/user exits the game.
Guess, a timer should be attached that continously checks whether game exe is attached or not and changes the caption accordingly.

Can anyone give the script for it?
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Sat Dec 28, 2013 3:13 pm    Post subject: Reply with quote

Code:
check = createTimer(nil,false);
check.Interval = 1000;
check.onTimer = function ()   local SL=createStringlist(); getProcesslist(SL); for i=0,strings_getCount(SL)-1 do local entry = strings_getString(SL,i); local PID = tonumber('0x'..entry:sub(1,8)); if (getOpenedProcessID() == PID) then MyForm.CELabel1.Caption = "Game Loaded"; return; end end MyForm.CELabel1.Caption = "Game  not Loaded" end
check.Enabled = true;

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
mgr.inz.Player
I post too much
Reputation: 222

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

PostPosted: Sat Dec 28, 2013 3:55 pm    Post subject: Reply with quote

Here:

Code:
processname = "Cricket2013.exe"

if customOpenProcess~=nil then customOpenProcess.destroy(); customOpenProcess=nil end
customOpenProcess = createTimer(MyForm);
customOpenProcess.Interval = 100;
customOpenProcess.onTimer = function (timer)
  local processExist = ( readInteger(processname)~=nil )
  if not processExist then
    MyForm.CELabel1.Caption='Game NOT LOADED.'
    timer.Interval = 3000;
    openProcess(processname)
  else
    MyForm.CELabel1.Caption='Game loaded.'
    timer.Interval = 100;
  end
end



With this code above, you can remove those lines (if exists):
- strings_add(getAutoAttachList(), "Cricket2013.exe")
- getAutoAttachList().add("Cricket2013.exe")

You don't need them anymore.

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