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 


Change label when attach process

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

Joined: 18 Jul 2018
Posts: 8
Location: 1337

PostPosted: Tue Jul 24, 2018 7:46 am    Post subject: Change label when attach process Reply with quote

How i make when attach game.exe

the label non active will be active



1336.PNG
 Description:
 Filesize:  1.09 KB
 Viewed:  3728 Time(s)

1336.PNG


Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue Jul 24, 2018 7:54 am    Post subject: Reply with quote

You can set the label text in "onOpenProcess", but I think I saw something about a new one to use instead ("OnProcessOpened").

https://wiki.cheatengine.org/index.php?title=Lua:onOpenProcess

From "celua.txt"
Code:

function onOpenProcess(processid):
  If this function is defined it will be called whenever cheat engine opens a process.
  Note: The the same process might be opened multiple times in a row internally
  Note 2: This function is called before attachment is fully done. You can call reinitializeSymbolhandler() to force the open to complete, but it will slow down process opens. Alternatively, you could launch a timer which will run when the opening has finished


MainForm.OnProcessOpened: function(processid, processhandle, caption) - Define this if you want to be notified when a new process has been opened. Called only once from the main thread. It is recommended to use this instead of onOpenProcess

_________________
Back to top
View user's profile Send private message Visit poster's website
dark1337
How do I cheat?
Reputation: 0

Joined: 18 Jul 2018
Posts: 8
Location: 1337

PostPosted: Tue Jul 24, 2018 8:17 am    Post subject: Reply with quote

TheyCallMeTim13 wrote:
You can set the label text in "onOpenProcess", but I think I saw something about a new one to use instead ("OnProcessOpened").



From "celua.txt"
Code:

function onOpenProcess(processid):
  If this function is defined it will be called whenever cheat engine opens a process.
  Note: The the same process might be opened multiple times in a row internally
  Note 2: This function is called before attachment is fully done. You can call reinitializeSymbolhandler() to force the open to complete, but it will slow down process opens. Alternatively, you could launch a timer which will run when the opening has finished


MainForm.OnProcessOpened: function(processid, processhandle, caption) - Define this if you want to be notified when a new process has been opened. Called only once from the main thread. It is recommended to use this instead of onOpenProcess


thank for help but i dont understand

_________________
a new new newbie ce user
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
jgoemat
Master Cheater
Reputation: 23

Joined: 25 Sep 2011
Posts: 264

PostPosted: Tue Jul 24, 2018 7:54 pm    Post subject: Reply with quote

Create a table script that will run when your table is loaded and add this function:

Code:
function onOpenProcess(processid)
  -- here a new process has been opened,
  -- so change the label with code here
end


You should probably also store the old value and call it since I think it that function is just called and you will override the old one, such as the one in the mono lua code that enables the mono menu on attaching...

Code:
saved = saved or {} -- create new var IF DOESN'T EXIST
if saved.OLD_onOpenProcess == nil then saved.OLD_onOpenProcess = onOpenProcess end

[code]function onOpenProcess(processid)
  -- here a new process has been opened,
  -- so change the label with code here
  if saved.OLD_onOpenProcess then
    saved.OLD_onOpenProcess(processid)
  end
end[/code]
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Wed Jul 25, 2018 6:50 am    Post subject: Reply with quote

The new one for CE 6.8 seems to be "OnProcessOpened".
Code:
MainForm.OnProcessOpened = function(processId, processHandle, caption)
  -- Body
end

Quote:
Define this if you want to be notified when a new process has been opened. Called only once from the main thread. It is recommended to use this instead of "onOpenProcess".


dark1337 wrote:
...
thank for help but i dont understand

Very Leet of you my friend.

_________________
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Jul 25, 2018 11:37 am    Post subject: Reply with quote

I think dark1337 ask about change label actve / non active when game process attached, not about automate activating hack codes when game process attached.

Many ways to go China....

little example :


Code:
f = createForm()

lb1 = createLabel(f)
lb1.left = 10
lb1.top = 10
lb1.font.color = '0x000000'
lb1.caption = 'Active Trainer'

lb2 = createLabel(f)
lb2.left = 100
lb2.top = 10
lb2.font.color = '0x000000'
lb2.caption = 'Non Active'


function getProcessNameFromID(processId)
  local processName = nil
  local list = createStringlist()
  getProcesslist(list)
  for i = 0, list.Count-1 do
    local id, name = list.String[i]:match("(.*)-(.*)")
    if processId == tonumber(id, 16) then
      processName = name
      break
    end
  end
  return processName
end

function checkWhenOpen()
 openProcess('firefox.exe')   ---- game process name here
 local id = getOpenedProcessID()
 local name = getProcessNameFromID(id)
 print(id,name)
 if name == 'firefox.exe' then  ---- game process name here
  lb1.font.color = '0x4631FB'
  lb1.caption = 'Active Trainer'
  lb2.font.color = '0x000000'
  lb2.caption = 'Non Active'
 else
  lb2.font.color = '0x4631FB'
  lb2.caption = 'Non Active'
  lb1.font.color = '0x000000'
  lb1.caption = 'Active Trainer'
 end
end

f.OnShow = checkWhenOpen()



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
MateeJr GT
Advanced Cheater
Reputation: 0

Joined: 24 Dec 2017
Posts: 66

PostPosted: Thu Jul 26, 2018 7:25 am    Post subject: Reply with quote

xD, I Have just Super Simplest Script
here :
Code:

if openProcess("--Your Game.exe") then
UDF1.CELabel1.Caption = "Attached"
else
UDF1.CELabel1.Caption = "not attached"
end
end

NOTE : --Your Game.exe =Your game process, example : Growtopia.exe

_________________
Hi Lynxz Gaming
Back to top
View user's profile Send private message
dark1337
How do I cheat?
Reputation: 0

Joined: 18 Jul 2018
Posts: 8
Location: 1337

PostPosted: Mon Jul 30, 2018 6:12 am    Post subject: Reply with quote

MateeJr Gaming wrote:
xD, I Have just Super Simplest Script
here :
Code:

if openProcess("--Your Game.exe") then
UDF1.CELabel1.Caption = "Attached"
else
UDF1.CELabel1.Caption = "not attached"
end
end

NOTE : --Your Game.exe =Your game process, example : Growtopia.exe


thank

_________________
a new new newbie ce user
Back to top
View user's profile Send private message AIM Address Yahoo Messenger 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