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 


Enabling my scripts every time it auto attaches to the game

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

Joined: 11 Sep 2019
Posts: 1

PostPosted: Wed Sep 11, 2019 2:53 pm    Post subject: Enabling my scripts every time it auto attaches to the game Reply with quote

So auto attach already is super useful. However, when the game auto attaches and my scripts are enabled it doesn't actually change anything in the game. Is there a way to make it so that after about 30 seconds or so after the game is attached the scripts will enable themselves?
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 30

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Thu Sep 12, 2019 1:56 am    Post subject: Reply with quote

An idea to get started.
With simple coding, 2 Timers will suffice.

Code:
form = createForm(true)
form.Position = poDesktopCenter

local t1 = createTimer(form)
t1.Interval = 2000 -- or 1000 or 100
t1.Enabled = true

local t2 = createTimer(form)
t2.Interval = 6000 -- or 25000 (25000 = 25 sec)
t2.Enabled = false

local l1 = createLabel(form)
l1.Left = 88
l1.Top = 50
l1.Font.Style = "fsBold"
l1.Font.Size = 14
l1.visible=true

t1.OnTimer = function()
openProcess("chrome.exe")
if openProcess then
l1.caption = "chrome.exe ON!"
t1.Enabled=false
t2.Enabled=true
else
t1.Enabled=true
end
end

function Hack1(sender)
local l2 = createLabel(form)
l2.Left = 88
l2.Top = 75
l2.Font.Style = "fsBold"
l2.Font.Size = 14
l2.caption = "Hack1 Enabled!"
end

function Hack2(sender)
local l3 = createLabel(form)
l3.Left = 88
l3.Top = 100
l3.Font.Style = "fsBold"
l3.Font.Size = 14
l3.caption = "Hack2 Enabled!"
end

function Hack3(sender)
local l4 = createLabel(form)
l4.Left = 88
l4.Top = 125
l4.Font.Style = "fsBold"
l4.Font.Size = 14
l4.caption = "Hack3 Enabled!"
end

t2.OnTimer = function()
t2.Enabled=false
Hack1()
Hack2()
Hack3()
showMessage("All Hack Enabled..")
end

_________________
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
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Thu Sep 12, 2019 3:18 am    Post subject: Reply with quote

There is the onProcessOpen event you can use to do your executions when the process is attached to.

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


As the notes say you can force symbol collection to finish to prevent lookup errors.

You can use other exposed Lua functions to ensure the processid is owned by the specific process you are targeting as well. Check the 'celua.txt' inside of Cheat Engines parent folder for more info on the Lua engine.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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