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 


auto attach to process
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials
View previous topic :: View next topic  
Author Message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Mon Jan 10, 2011 5:36 pm    Post subject: auto attach to process This post has 1 review(s) Reply with quote

The following script will auto attach cheat engine to the Tutorial process.
You can change it to any other process you like and put it in the Lua section of your cheat table so when your table is loaded it will automatically open the correct process

Code:

aalist=getAutoAttachList()
stringlist_add(aalist,"Tutorial-i386.exe");


Alternatively, you could do
Code:

OpenProcess("Tutorial-i386.exe")

But that will only work when the game has already been started as oposed to the autoattach which will also attach when the game has not yet been started.

There can be a max delay of 2 seconds between adding the item to the list or openening of the process and ce attaching to the process

_________________
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
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Jan 10, 2011 5:48 pm    Post subject: Reply with quote

Thank You, very useful info. Tested and working.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Mon Jan 10, 2011 6:09 pm    Post subject: Reply with quote

An alternative way faster auto attach (also a little bit more complex)

Code:

function myattach(timer)
  if getProcessIDFromProcessName("Tutorial-i386.exe") ~= nil then
    object_destroy(timer)
    openProcess("Tutorial-i386.exe") 
  end
end

t=createTimer(nil);
timer_setInterval(t,10)
timer_onTimer(t,myattach)

What it does is create a timer, set the interval to 10 milliseconds, and each interval it checks if the process exists and if so open it and destroy the timer

_________________
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
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Jan 10, 2011 7:08 pm    Post subject: Reply with quote

Hm, this isn't working for me. If I execute the script after the tutorial has started, it will not be attached.
And if I run this script before I would start the tutorial, it will show the "Successfully executed" window but I cannot close it whatever I do.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
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: Mon Jan 10, 2011 7:31 pm    Post subject: Re: auto attach to process Reply with quote

Dark Byte wrote:

Code:

aalist=getAutoAttachList()
stringlist_add(aalist,"Tutorial-i386.exe")



Works fine, but

There's an annoying "confirmation" window (keep the current address list/code list?).
1) when loaded (double click on .ct file)
2) when loaded (opened with ctrl-O )
weird because there wasn't other addess/code list.

_________________
Back to top
View user's profile Send private message MSN Messenger
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Jan 10, 2011 7:41 pm    Post subject: Re: auto attach to process Reply with quote

mgr.inz.Player wrote:
Dark Byte wrote:

Code:

aalist=getAutoAttachList()
stringlist_add(aalist,"Tutorial-i386.exe")



Works fine, but

There's an annoying "confirmation" window (keep the current address list/code list?).
1) when loaded (double click on .ct file)
2) when loaded (opened with ctrl-O )
weird because there wasn't other addess/code list.


Guess this window opens because You have a lua script too in the table.
Or I don't know. It is not doing it for me.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
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: Mon Jan 10, 2011 8:17 pm    Post subject: Re: auto attach to process Reply with quote

Geri wrote:
Guess this window opens because You have a lua script too in the table.

Of course it's in CT, inside "table extras" at "Lua Script" tab.

My mistake - "weird because there wasn't other addess/code list."
I meant "process from the list."

This confirmation window appears when we change(attach) from one process to another. And should be shown in this case only, I think.

_________________


Last edited by mgr.inz.Player on Mon Jan 10, 2011 8:39 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Mon Jan 10, 2011 8:39 pm    Post subject: Reply with quote

that script works on windows 7. Perhaps opened the wrong process? (e.g 5.6's version)

if it's an xp thing and it doesn't like timers without windows then try:
Code:


function myattach(timer)
  if getProcessIDFromProcessName("Tutorial-i386.exe") ~= nil then
    object_destroy(timer)
    openProcess("Tutorial-i386.exe")
  end
end

f=createForm(false) --create an invisible window
t=createTimer(f);
timer_setInterval(t,100) --10 might have been too fast for xp...
timer_onTimer(t,myattach)


also, I've just uploaded a minor fix which removes that annoying popup when automatically opening a process (It was a big enough annoyance to warrant a new version, but not really that important that you have to redownload if you don't want to)

_________________
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
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Jan 10, 2011 8:48 pm    Post subject: Reply with quote

No, it is still not working. I am sure I have opened the correct process even in the first case. I have checked the process name even to see that it is surely starting with capital T.

It is the Tutorial-i386.exe in the process list but the script is not attaching CE to the process. It says "Successfully executed" as usual but still not attached.

The first script that You have posted is working perfectly.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
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: Mon Jan 10, 2011 8:55 pm    Post subject: Reply with quote

Dark Byte wrote:
I've just uploaded a minor fix which removes that annoying popup when automatically opening a process....

getAutoAttachList() works great now, without confirmation window

btw
a) CT doble clicked, process attached immediately
b) CT opened , process attached after 2 seconds



Dark Byte wrote:

Code:
function myattach(timer)
  if getProcessIDFromProcessName("Tutorial-i386.exe") ~= nil then
    object_destroy(timer)
    openProcess("Tutorial-i386.exe")
  end
end

f=createForm(false) --create an invisible window
t=createTimer(f);
timer_setInterval(t,100) --10 might have been too fast for xp...
timer_onTimer(t,myattach)



timer_setInterval
10 - 50% cpu (1core) usage
100 - 25~30% cpu (1core) usage

whole script do not work (WinXP Pro SP3 32 bit). It attaches (looks like, because grayed out controls get activated) to process but then immediately drop (I think).

executed alone: openProcess("xrengine.exe") do not work too (only grayed out controls get activated)
I'm testing at STALKER:COP


//sorry for frequent edits

_________________


Last edited by mgr.inz.Player on Tue Jan 11, 2011 7:21 am; edited 2 times in total
Back to top
View user's profile Send private message MSN Messenger
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Jan 10, 2011 9:06 pm    Post subject: Reply with quote

Oh really. The second script is working. Partially at least.

CE will still display "No Process Selected" but in fact, it is attached to the process. I can scan in it etc. So kinda strange.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
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: Tue Jan 11, 2011 2:39 pm    Post subject: Reply with quote

Dark Byte wrote:
if it's an xp thing and it doesn't like timers without windows

What I see, it isn't xp thing.
f=createForm(false); t=createTimer(f); works the same way as t=createTimer(nil);



openProcess("Tutorial-i386.exe"); This attach to process correctly, but informations placed in MainForm.ProcessLabel.caption are poor: "no process selected" or "processID-processID" (e.g 00000A0C-00000A0C) (SVN revision 671).



aalist=getAutoAttachList()
stringlist_add(aalist,"Tutorial-i386.exe")
Works great, and we get full information in MainForm.ProcessLabel.caption: processID-processName



timer_setInterval(t,50) less than 50 not recommended (WinXP SP3). Responsiveness drops drastically.

_________________
Back to top
View user's profile Send private message MSN Messenger
Dacnomania
Expert Cheater
Reputation: 1

Joined: 03 Sep 2010
Posts: 124

PostPosted: Tue Jan 11, 2011 4:12 pm    Post subject: Reply with quote

If you don't mind, How do I attach my trainer (I'm making one with cheat engine) to a process ?
Back to top
View user's profile Send private message Send e-mail AIM Address
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Tue Jan 11, 2011 4:51 pm    Post subject: Reply with quote

Just use the above script
As soon as your table is loaded the process will get attached when the process is started

If you want to know when the attach happens then use the second script, or use the first one in combination of onOpenProcess (declare that function and it will get called when a process is opened, including autoattach opens)

_________________
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
Dacnomania
Expert Cheater
Reputation: 1

Joined: 03 Sep 2010
Posts: 124

PostPosted: Tue Jan 11, 2011 4:59 pm    Post subject: Reply with quote

Nvm Someone helped me. Razz

Last edited by Dacnomania on Tue Jan 11, 2011 5:13 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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 cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites