  | 
				
				Cheat Engine The Official Site of Cheat Engine   
				
 
				 | 
			 
		 
		 
	
		| View previous topic :: View next topic   | 
	 
	
	
		| Author | 
		Message | 
	 
	
		Gear2ndGandalf Cheater
  Reputation: 0
  Joined: 22 Jan 2018 Posts: 36 Location: USA
  | 
		
			
				 Posted: Thu Dec 14, 2023 5:48 pm    Post subject: How Can i Auto-Attach Multiple Games In One Table? | 
				       | 
			 
			
				
  | 
			 
			
				I'm working on Devil May Cry HD Collection and want the table to auto attach to whichever game I'm running at the time (whether it is dmc1, dmc2, or dmc3). How would I go about doing this? What I've done below does not work.
 
 
 	  | Code: | 	 		  PROCESS_NAME = 'dmc1.exe, dmc2.exe, dmc3.exe'
 
--------
 
-------- Auto Attach
 
--------
 
local autoAttachTimer = nil ---- variable to hold timer object
 
local autoAttachTimerInterval = 1000 ---- Timer intervals are in milliseconds
 
local autoAttachTimerTicks = 0 ---- variable to count number of times the timer has run
 
local autoAttachTimerTickMax = 5000 ---- Set to zero to disable ticks max
 
local function autoAttachTimer_tick(timer) ---- Timer tick call back
 
        ---- Destroy timer if max ticks is reached
 
   if autoAttachTimerTickMax > 0 and autoAttachTimerTicks >= autoAttachTimerTickMax then
 
      timer.destroy()
 
   end
 
        ---- Check if process is running
 
   if getProcessIDFromProcessName(PROCESS_NAME) ~= nil then
 
      timer.destroy() ---- Destroy timer
 
      openProcess(PROCESS_NAME) ---- Open the process
 
   end
 
   autoAttachTimerTicks = autoAttachTimerTicks + 1 ---- Increase ticks
 
end
 
autoAttachTimer = createTimer(getMainForm()) ---- Create timer with the main form as it's parent
 
autoAttachTimer.Interval = autoAttachTimerInterval ---- Set timer interval
 
autoAttachTimer.OnTimer = autoAttachTimer_tick ---- Set timer tick call back | 	  [/code]
  Last edited by Gear2ndGandalf on Fri Dec 15, 2023 5:05 pm; edited 1 time in total | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		Gear2ndGandalf Cheater
  Reputation: 0
  Joined: 22 Jan 2018 Posts: 36 Location: USA
  | 
		
			
				 Posted: Fri Dec 15, 2023 5:02 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Lefixer gave me a solution below!
 
 
 
 
 	  | Code: | 	 		  local PROCESS_NAMES = { 'dmc1.exe', 'dmc2.exe', 'dmc3.exe', }
 
--------
 
-------- Auto Attach
 
--------
 
local maxTicks = 10
 
local timerTick = 0
 
 
local processCheck = createTimer(getMainForm())
 
processCheck.Interval = 60000 -- 1 minute, 60 * 1000
 
processCheck.OnTimer =  function(sender)
 
                            if timerTick > maxTicks then sender.destroy() end 
 
                            local pl = getProcessList()
 
                            local function checkProcess(list, name)
 
                                    for k,v in pairs(list) do
 
                                        if v == name then
 
                                            openProcess(k)
 
                                        end
 
                                    end
 
                                  end
 
                            for i = 1, #PROCESS_NAMES do
 
                                checkProcess(pl, PROCESS_NAMES[i])
 
                            end
 
                            timerTick = timerTick + 1
 
                        end | 	  
 | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
	 
	    
	   | 
	
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
  | 
   
 
		 |