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 


Conditionally Close Cheat Engine from Within Trainer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
AntumDeluge
How do I cheat?
Reputation: 0

Joined: 20 Dec 2018
Posts: 9

PostPosted: Thu Dec 20, 2018 5:32 pm    Post subject: Conditionally Close Cheat Engine from Within Trainer Reply with quote

I'm wondering if it's possible to detect whether or not a trainer is being run from the Cheat Engine process, or as it's own standalone executable (.exe). If it's being run as a standalone, I need to call "closeCE()" to end the Cheat Engine process when the trainer window is closed/hidden. If it was launched from the main Cheat Engine interface, I want the main CE process to continue.

Right now, I just comment out the "closeCE()" line when not run as a standalone:
Code:
local function shutdown()
    -- close/hide trainer window
    Frame.hide()
    -- close Cheat Engine
    --closeCE()
end


Then I just uncomment to build the .exe:
Code:
local function shutdown()
    -- close/hide trainer window
    Frame.hide()
    -- close Cheat Engine
    closeCE()
end


I've looked around the forums, wiki, & Google a bit, but haven't yet found the information I am looking for.

-- Edit --

Oh! I just came across the TrainerOrigin variable on the wiki (would post a link but don't have permission yet). Perhaps that is what I am looking for. I will do some tests.

-- Solved --

Yup! That is exactly what I needed:
Code:
local function shutdown()
    -- close/hide trainer window
    Frame.hide()
    -- shutdown Cheat Engine process when run as a standalone application
    if TrainerOrigin ~= nil then
        closeCE()
    end
end
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