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 


How do you do this?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
rog9001
Expert Cheater
Reputation: 2

Joined: 22 Dec 2015
Posts: 214
Location: Jupiter

PostPosted: Wed May 24, 2017 2:17 pm    Post subject: How do you do this? Reply with quote

So I felt like making a trainer for a game which has 2 processes (game.exe & game_DRMoff.exe) and wanted to do something along the lines of

Code:
function Toggle1Change(sender)
if(checkbox_getState(TestTrainer.Toggle1)==1) then
PL = createStringlist()
function Process()
getProcesslist(PL)
for i=0,PL.count-1 do
if PL[i]:find("game") then
autoAssemble([[

]])
elseif PL[i]:find("game_DRMoff") then
autoAssemble([[

]])
else
PL.clear()
autoAssemble([[

]])
end
end
end
end


but I don't think this will work. Anyone know how to make something like this or something that will have the same effect?

In words it would be:

Code:

If Toggle1 is 1 then
check process list for game / check if game is open
if its there, assemble THIS_1
else check process list for game_DRMoff / check if game_DRMoff is open
if its there, assemble THIS_2
else assemble THIS_3
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 54

Joined: 01 Oct 2008
Posts: 941

PostPosted: Wed May 24, 2017 5:17 pm    Post subject: Reply with quote

Hi,

If the process is already opened by CE, the process name can be check in Lua string type variable process (ce 6.5+ ?).
Then it may activate cheats according to this variable.
Don't need to check GetProcessList() this case.

If it is for some kind like auto attach process list, but trigger by some ui.
Then it is to looking for the right process, then OpenProcess (CE function) the right process, then apply cheats.

To looking into the processes using GetProcessList, there is another variant without the StringList parameter (ce 6.6+?), which already split the pid, and its name, it may be more handy in this case.
eg.
Code:

for pid, name in pairs(GetProcessList()) do
  if name == "game.exe" or name == "game_DRMoff.exe" then
  -- do OpenProcess(pid), apply cheats according to name
  end
end


the process need to OpenProcess by CE before applying cheats, in some case it may also need to wait for the symbol ready during process opening. May check reinitializeSymbolhandler in main.lua or celua.txt

...
If I'm not misunderstood, that there are actually 2 process exist during the game running, and you want to apply cheats on one process then apply another cheats to another process, that they are some kind related?

Then it may make some variable, say Stage which 0 init.
Then if Stage == 0, looking for process #1 and apply cheats #1,
if everything ok, set Stage = 1
Then if Stage == 1, looking for process #2 and apply cheats #2,
if everything ok, set Stage = 2

Note that CE can only handle 1 process in a time, symbol in process #1 should be lost when OpenProcess process #2

There may be some function to reset Stage.

Something like that~

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed May 24, 2017 5:19 pm    Post subject: Reply with quote

Code:
if readInteger("game.exe") then
  -- blah blah
elseif readInteger("game_DRMoff.exe") then
  -- blah blah
end
Back to top
View user's profile Send private message
rog9001
Expert Cheater
Reputation: 2

Joined: 22 Dec 2015
Posts: 214
Location: Jupiter

PostPosted: Thu May 25, 2017 6:30 am    Post subject: Reply with quote

Thank you both for your replies
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