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 


Check & Ask For Active Injections On Close

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Wed Jan 25, 2017 6:25 am    Post subject: Check & Ask For Active Injections On Close Reply with quote

This is more of a annoyance then anything else. I have multiple times closed a CE window with Injections Active that resulted in having to restart the game.

Updated to allow for native CE onclose event to be handled.
--This event closes CE child windows, turns off speedhack & other things. Thanks to mgr.inz for the explanation of why "closeCE" doesnt do all this to begin with. Now if he would only remove the code in his second post. For the sake of confusion.

So Here is a lightweight simple extension to "Ask" what you want to do if
injections are active and the process is attached.

Some Argument info those Interested.

If a process is NOT ACTIVE attached this check wont run.

If you Cancel or Close on the "Ask" will return to Cheat Engine.

Does Not Check on Pointers only Scripts

Turns off Injections in Reverse Order. Child First then Parent.

Enjoi guys I hope this will be helpful Cool

And A Snap Shot of the interface.




Active Cheat Check.lua
 Description:

Download
 Filename:  Active Cheat Check.lua
 Filesize:  1.67 KB
 Downloaded:  1171 Time(s)


_________________


Last edited by akumakuja28 on Fri Jan 27, 2017 7:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 217

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

PostPosted: Wed Jan 25, 2017 11:12 am    Post subject: Reply with quote

Nice. Here I slightly changed it (also should have better readability).

Code:
--------------------------------------------------------------------------------
----------  Cheat Engine Check For Active Scripts ------------------------------
--------------------------------------------------------------------------------

-- store orig onClose so CE can properly free some resources
local Ask_Cheats_Off_OrigOnClose = getMainForm().OnClose

local function Ask_Cheats_Off(sender)
  local openedProcess = string.sub(getMainForm().ProcessLabel.Caption,10)
  local list = getAddressList()
  local D = {}  -- Table for display (active AA scripts only)

  -- check if there is opened process
  if readInteger(openedProcess) == nil then Ask_Cheats_Off_OrigOnClose(sender); return caFree end

  for i=0,list.Count-1 do
    if list[i].Active and (list[i].Type == vtAutoAssembler) then
     D[1+#D] = list[i].Description
    end
  end


  if #D > 0 then -- there are active AA scripts
    local A = messageDialog(#D.." scripts are still active:\n\n"..table.concat (D,'\n')..
              "\n\nDo you wish to deactivate them before close?", mtConfirmation, mbYes, mbNo, mbCancel)

    if A == mrYes then
      for i=list.Count-1,0,-1 do
        list[i].Active = false -- deactivate (and also unfreeze, but, we do not care)
      end
      Ask_Cheats_Off_OrigOnClose(sender)
      return caFree
    elseif A == mrNo then
      Ask_Cheats_Off_OrigOnClose(sender)
      return caFree
    end

  else -- no active AA script(s)
    Ask_Cheats_Off_OrigOnClose(sender)
    return caFree
  end
end

getMainForm().OnClose = Ask_Cheats_Off



Edit:
make use of original onClose (so CE can properly free some resources)

_________________


Last edited by mgr.inz.Player on Fri Jan 27, 2017 3:01 pm; edited 2 times in total
Back to top
View user's profile Send private message MSN Messenger
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Wed Jan 25, 2017 2:00 pm    Post subject: Reply with quote

Thank You but that is not easier to read. Only the open process is easier to understand.

I have a PM box.

_________________
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Wed Jan 25, 2017 3:01 pm    Post subject: Reply with quote

Hate to have them indentations right notepad++ and not right for CE. That could confuse alot people.


D[1+#D] <---- tht was slick thou i like tht. Please just PM though if feel you would like help me out in learning LUA.

_________________
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 217

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

PostPosted: Wed Jan 25, 2017 3:10 pm    Post subject: Reply with quote

Quote:
right notepad++ and not right for CE

Not right for CE? PS: I will try to remember to send you PM next time.

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