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 


Help with attachment code

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

Joined: 11 Jun 2013
Posts: 9

PostPosted: Tue Feb 15, 2022 5:21 pm    Post subject: Help with attachment code Reply with quote

Good day everyone.

Just wondering if anyone can help me with the process attachment to Farmville 2 launcher?
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Tue Feb 15, 2022 10:52 pm    Post subject: Reply with quote

You can use OpenProcess like so:
Code:

OpenProcess('name_of_exe_here.exe')
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1522

PostPosted: Wed Feb 16, 2022 6:26 am    Post subject: Reply with quote

Code:
local prcs=getProcessIDFromProcessName('Farmville Two.exe')
OpenProcess(tonumber(prcs))

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Wed Feb 16, 2022 7:17 am    Post subject: Reply with quote

AylinCE wrote:
Code:
local prcs=getProcessIDFromProcessName('Farmville Two.exe')
OpenProcess(tonumber(prcs))


Just so you are aware, getProcessIDFromProcessName returns a numerical value so the function tonumber isn't required.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1522

PostPosted: Wed Feb 16, 2022 7:54 am    Post subject: Reply with quote

LeFiXER wrote:

Just so you are aware, getProcessIDFromProcessName returns a numerical value so the function tonumber isn't required.


That detail wasn't for you, it was to let the questioner know that ID is a numeric value!

Please don't feel so responsible.
This is not a race!

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Wed Feb 16, 2022 10:33 am    Post subject: Reply with quote

AylinCE wrote:
LeFiXER wrote:

Just so you are aware, getProcessIDFromProcessName returns a numerical value so the function tonumber isn't required.


That detail wasn't for you, it was to let the questioner know that ID is a numeric value!

Please don't feel so responsible.
This is not a race!


I was just informing you that the return value of that function is a number so the tonumber function wasn't necessary.

There is no competition here. I pass on knowledge that I have attained over the course of my time as a hobbyist game hacker.
Back to top
View user's profile Send private message
Frouk
Grandmaster Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 510

PostPosted: Wed Feb 16, 2022 11:37 pm    Post subject: Reply with quote

couple functions:
Code:
function IsProcessExists(procName)
return getProcessIDFromProcessName(procName) ~= nil
end

function IsAttached(procName)
return getProcessIDFromProcessName(procName) == getOpenedProcessID()
end

function ShouldAttach(procName)
if not IsProcessExists(procName) then return end
openProcess(procName)
end
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Thu Feb 17, 2022 12:55 am    Post subject: Reply with quote

Just thought I'd mention. I think Farmville 2 is a facebook game, so it's likely a browser game.
_________________
Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1522

PostPosted: Thu Feb 17, 2022 1:53 am    Post subject: Reply with quote

TheyCallMeTim13 wrote:
Just thought I'd mention. I think Farmville 2 is a facebook game, so it's likely a browser game.



There may be some bugs in this game. Wink
( Items lost for no reason and getting them back, game not opening problems after the update, etc. CE can be used to fix such errors. I think this relieves the burden of software developers. )

I guess the topic content is not cheating.
Yes, if the content was about cheating, we would not participate, because it is a superficial issue that is limited to the CE process list only.

Currently in the lead role; CE has a bug fix option. Smile

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website 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