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 


Quit CE when game shuts down

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

Joined: 08 Oct 2012
Posts: 577

PostPosted: Fri Apr 10, 2015 8:34 pm    Post subject: Quit CE when game shuts down Reply with quote

I have seen a post concerning this, but after 3 searches I haven't found it.
What would be the code lines to quit CE when/if the game attached shuts stops.
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Fri Apr 10, 2015 8:48 pm    Post subject: Reply with quote

Code:

t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
  if (getOpenedProcessID()~=0) and (readInteger("kernel32.dll")==nil) then
    closeCE()
  end
end
t.Enabled=true

_________________
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
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Fri Apr 10, 2015 8:55 pm    Post subject: Reply with quote

I can understand this (readInteger("kernel32.dll")==nil)

The other condition (getOpenedProcessID()~=0 seems odd, it would seem that if the game is running then this would be true, but if the game quits then the process ID seems like it would be 0?
Back to top
View user's profile Send private message Yahoo Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Apr 10, 2015 10:00 pm    Post subject: This post has 1 review(s) Reply with quote

If CE is able to resolve "kernel32.dll" then that means it is attached to something.

When getOpenedProcessID() equals zero, then CE has never been attached to anything.

So, the if statement sees if the Process ID is not zero (meaning CE was attached to something at some time), but "kernel32.dll" resolves to nil (meanining CE isn't currently attached to anything) and then closes.
Back to top
View user's profile Send private 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 Apr 11, 2015 2:57 am    Post subject: Reply with quote

instead of kernel32.dll you can use other modules as well:
(readInteger("gta5.exe")==nil)

If it is directx9 game:
(readInteger("d3d9.dll")==nil)

_________________
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