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 


Mono not usable in target, trainer attaching wrong process

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

Joined: 09 Dec 2020
Posts: 27

PostPosted: Sun Jul 16, 2023 6:35 am    Post subject: Mono not usable in target, trainer attaching wrong process Reply with quote

im trying to make a trainer on a game using mono (GRIME) and i have no problem activating it when im in the CT and i attach the process manually

the thing is when i use OpenProcess("GRIME.exe") it attach to B15C-GRIME.exe
but the good one is 5DF8-GRIME.exe , i got only one game running and do not understand why?

strangely it's when im writting post asking for help that i found solutions, i realized, it attach to processes and not only visible applications so i searched in cheat engine attach list in the processes tabs and found out that my trainer attach himself to old trainer processes still running named GRIME.exe too

so i got a new questions do i have to manually kill the process each time i close my trainer and where can i change the name used by my trainer ? because i named my exe Test16 and i thought it was sufficient

EDIT: Apparently it was sufficient and i have to manually kill trainer process sometimes but do not need to do anything else than renaming the exe i don't know why processes didn't kills themself in precedent tests

Oh and Now i got a DLL injection Failed error

EDIT: i just had to go inside the lua script and put LaunchMonoDataCollector() inside a function instead of outside and it worked fine
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4709

PostPosted: Sun Jul 16, 2023 11:04 am    Post subject: Reply with quote

Don't name your trainer the same thing as the game

The trainer form's OnClose event should do at least this:
Code:
UDF1.OnClose = function()
  closeCE()
  return caFree
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
wayden
Cheater
Reputation: 0

Joined: 09 Dec 2020
Posts: 27

PostPosted: Sun Jul 16, 2023 5:38 pm    Post subject: Reply with quote

well i already got it since i use trainergenrator to compile it, i search and found
that i could force windows to kill my process like this
Code:


function OnFormClose(Sender)
  os.execute("taskkill /F /IM GRIMETrainer.exe")
  closeCE()
  return caFree
end

CETrainer.OnClose = OnFormClose

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: Sun Jul 16, 2023 5:54 pm    Post subject: Reply with quote

wayden wrote:
well i already got it since i use trainergenrator to compile it, i search and found
that i could force windows to kill my process like this
Code:


function OnFormClose(Sender)
  os.execute("taskkill /F /IM GRIMETrainer.exe")
  closeCE()
  return caFree
end

CETrainer.OnClose = OnFormClose



No need for a separate function
Code:

CETrainer.OnClose = function()
  os.execute("taskkill /F /IM GRIMETrainer.exe")
  closeCE()
  return caFree
end
Back to top
View user's profile Send private message
wayden
Cheater
Reputation: 0

Joined: 09 Dec 2020
Posts: 27

PostPosted: Mon Jul 17, 2023 2:29 pm    Post subject: Reply with quote

Quote:
No need for a separate function
Code:

I thought the TrainerGenerator will erase it otherwise
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: Mon Jul 17, 2023 2:57 pm    Post subject: Reply with quote

wayden wrote:
Quote:
No need for a separate function
Code:

I thought the TrainerGenerator will erase it otherwise


Why would it? You are assigned an anonymous function to an event of that object. It should work just the same.
Back to top
View user's profile Send private message
wayden
Cheater
Reputation: 0

Joined: 09 Dec 2020
Posts: 27

PostPosted: Mon Jul 17, 2023 5:38 pm    Post subject: Reply with quote

Quote:
Why would it? You are assigned an anonymous function to an event of that object. It should work just the same.


Because every time i use the auto trainer generator it regenerate the part of the code containing
Code:

CETrainer.OnClose = function()
  closeCE()
  return caFree
end


so i thought there was no reason for it to not remove the line if i add it, i could probably just put it outside of the reseting part but i don't know wich of the two anonymous function will get assigned to the onclose event, perhaps both
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 Jul 18, 2023 5:53 am    Post subject: Reply with quote

wayden wrote:

Because every time i use the auto trainer generator it regenerate the part of the code containing
Code:

CETrainer.OnClose = function()
  closeCE()
  return caFree
end


so i thought there was no reason for it to not remove the line if i add it, i could probably just put it outside of the reseting part but i don't know wich of the two anonymous function will get assigned to the onclose event, perhaps both


There's only one function. It's only anonymous if you omit the name and assign a function to the event directly. I am not sure what you mean by "so i thought there was no reason for it to not remove the line if i add it". Could you elaborate?
Back to top
View user's profile Send private message
wayden
Cheater
Reputation: 0

Joined: 09 Dec 2020
Posts: 27

PostPosted: Tue Jul 18, 2023 9:13 am    Post subject: Reply with quote

When you use the autotrainer generator it generates in your lua file some lines in this part there is already :
Code:

CETrainer.OnClose = function()
  closeCE()
  return caFree
end


everytime i'll use it to compile my trainer it regenerate this part so if i modify anything in this part of the lua file it will just be reseted before compilation, wich mean adding a line inside the premade function will probably have no effect because it will be reseted to default before compilation

so if add the function outside of the reseting part i would have 2 assignement of anonymous function to the same event
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 Jul 18, 2023 10:11 am    Post subject: Reply with quote

Do you have to regenerate every time?
Back to top
View user's profile Send private message
wayden
Cheater
Reputation: 0

Joined: 09 Dec 2020
Posts: 27

PostPosted: Tue Jul 18, 2023 10:56 am    Post subject: Reply with quote

i think i have to if i want to have an taskbar app icon different than CheatEngine and i don't know how to manually compile it otherwise, i know i can just Save as .EXE instead of .CT and it will give me possibility to compile without regenerating the lua part but i think i'll lose the app icon in taskbar
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1531

PostPosted: Tue Jul 18, 2023 11:21 am    Post subject: Reply with quote

wayden wrote:
i think i have to if i want to have an taskbar app icon different than CheatEngine and i don't know how to manually compile it otherwise, i know i can just Save as .EXE instead of .CT and it will give me possibility to compile without regenerating the lua part but i think i'll lose the app icon in taskbar


This code makes the icon visible in the taskbar.
Add it somewhere in your code where it will activate after it disappears.
Code:
CETrainer.ShowInTaskBar="stAlways"



Of course if you use deadly codes in "OnClose" (cafree), the codes won't work.

Maybe in between work you want to use:

Code:
CETrainer.Hide()

-- or

CETrainer.Show()

_________________
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