View previous topic :: View next topic |
Author |
Message |
scofield96x !BEWARE! Deletes post on answer Reputation: 0
Joined: 06 Apr 2022 Posts: 7
|
Posted: Thu Apr 07, 2022 8:12 am Post subject: faster scripts activation after attach? |
|
|
hello since im am new in learning how to use lua on cheat engine i wanted to ask if there is an faster way to auto activate my script after the cheat engine build in auto attach?
i currently use this but it looks like its to slow and also would an auto attach in the script be faster then the build in one on cheat engine?
Code: | function onOpenProcess()
local timer = createTimer(nil, false)
timer.Interval = 1
timer.OnTimer = function(timer)
local list = getAddressList()
local mem = list.getMemoryRecordByDescription("Scripts")
mem.Active = true
timer.Destroy()
end
timer.Enabled = true
end |
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Thu Apr 07, 2022 11:47 am Post subject: |
|
|
We return to this subject again.
My advice is don't use a timer, run the code inside the function without lingering.
See the use case without the timer given in your previous post.
https://forum.cheatengine.org/viewtopic.php?t=619294
_________________
|
|
Back to top |
|
|
scofield96x !BEWARE! Deletes post on answer Reputation: 0
Joined: 06 Apr 2022 Posts: 7
|
Posted: Thu Apr 07, 2022 2:29 pm Post subject: |
|
|
thank you for your reply again but somehow when i do your codes with my script names the script seems like not activating somehow it only works with an timer but then sometimes it is to slow
the one i use right now is: Code: | function onOpenProcess()
local timer = createTimer(nil, false)
timer.Interval = 10
timer.OnTimer = function(timer)
local list = getAddressList()
local mem = list.getMemoryRecordByDescription("Scripts")
mem.Active = true
timer.Destroy()
end
timer.Enabled = true
end |
would this be correct? Code: | local list = getAddressList()
function onOpenProcess1()
local mem1 = list.getMemoryRecordByDescription("Scripts")
mem1.Active = true
end
local index=0
function onOpenProcessStart()
local timer = createTimer(nil, false)
timer.Interval = 10
timer.OnTimer = function(timer)
index=tonumber(index) + 1
if index==2 then onOpenProcess1() end
if index==6 then timer.Enabled = false index=0 end
--timer.Destroy()
end
timer.Enabled = true
end |
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Thu Apr 07, 2022 3:28 pm Post subject: |
|
|
Code: | list.getMemoryRecordByDescription("Scripts") |
All given examples are working.
Make sure you have processed the AA Script description correctly.
Is the script description "Scripts" in your case?
Or try this: (CE 7.4)
Code: | local list = getAddressList()
function onOpenProcess1()
local mem1 = addresslist_getMemoryRecordByDescription(list, "Hack1") -- "Hack1" Your script description
mem1.Active = true
end
-- active function and script:
onOpenProcess1()
|
_________________
|
|
Back to top |
|
|
scofield96x !BEWARE! Deletes post on answer Reputation: 0
Joined: 06 Apr 2022 Posts: 7
|
Posted: Thu Apr 07, 2022 4:09 pm Post subject: |
|
|
AylinCE wrote: | Code: | list.getMemoryRecordByDescription("Scripts") |
All given examples are working.
Make sure you have processed the AA Script description correctly.
Is the script description "Scripts" in your case?
Or try this: (CE 7.4)
Code: | local list = getAddressList()
function onOpenProcess1()
local mem1 = addresslist_getMemoryRecordByDescription(list, "Hack1") -- "Hack1" Your script description
mem1.Active = true
end
-- active function and script:
onOpenProcess1()
|
|
thank you for your helping hand. but on the CE 7.4 code it doesn't enable the scripts at all even if i use the Descriptions Power, Grip or Tyre or the header with active children Scripts.
Description: |
picture of the script descriptions |
|
Filesize: |
4.22 KB |
Viewed: |
3125 Time(s) |
|
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Thu Apr 07, 2022 5:14 pm Post subject: |
|
|
1) Right click on the "Scripts" description.
2) Hover over "Group Config" in the pop-up window.
3) In the other window that opens, select "Activating this entry activates".
4) Select "Deactivating this entry deactivates" with the same steps.
If you did the steps correctly, the problem will be solved.
_________________
|
|
Back to top |
|
|
scofield96x !BEWARE! Deletes post on answer Reputation: 0
Joined: 06 Apr 2022 Posts: 7
|
Posted: Thu Apr 07, 2022 7:18 pm Post subject: |
|
|
AylinCE wrote: | 1) Right click on the "Scripts" description.
2) Hover over "Group Config" in the pop-up window.
3) In the other window that opens, select "Activating this entry activates".
4) Select "Deactivating this entry deactivates" with the same steps.
If you did the steps correctly, the problem will be solved. |
i did the steps and now it activates the Scripts header on Cheat Engine start way before the game is attached, so only the header is active but not the scripts in its group.
is the Problem maybe that i am using the CE 7.4 auto attach or should i better use an Script for Auto Attach?
Code: | local list = getAddressList()
function onOpenProcess1()
local mem1 = addresslist_getMemoryRecordByDescription(list, "Scripts") -- "Scripts" Your script description
mem1.Active = true
end
-- active function and script:
onOpenProcess1() |
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Thu Apr 07, 2022 8:22 pm Post subject: |
|
|
It shouldn't be that hard to set this up.
Copy the code below and paste it into the Address List.
Then just click the "F8" key and see the result.
Code: | <?xml version="1.0" encoding="utf-8"?>
<CheatTable>
<CheatEntries>
<CheatEntry>
<ID>0</ID>
<Description>"Scripts"</Description>
<Options moActivateChildrenAsWell="1" moDeactivateChildrenAsWell="1"/>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>[ENABLE]
[DISABLE]
</AssemblerScript>
<Hotkeys>
<Hotkey>
<Action>Toggle Activation</Action>
<Keys>
<Key>119</Key>
</Keys>
<Description>ScriptKey</Description>
<ID>0</ID>
</Hotkey>
</Hotkeys>
<CheatEntries>
<CheatEntry>
<ID>1</ID>
<Description>"Power"</Description>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>[ENABLE]
{$lua}
print("Power active!")
{$asm}
[DISABLE]
{$lua}
print("Power deactive!")
</AssemblerScript>
</CheatEntry>
<CheatEntry>
<ID>2</ID>
<Description>"Grip"</Description>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>[ENABLE]
{$lua}
print("Grip active!")
{$asm}
[DISABLE]
{$lua}
print("Grip deactive!")
</AssemblerScript>
</CheatEntry>
<CheatEntry>
<ID>3</ID>
<Description>"Tyre"</Description>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>[ENABLE]
{$lua}
print("Tyre active!")
{$asm}
[DISABLE]
{$lua}
print("Tyre deactive!")
</AssemblerScript>
</CheatEntry>
</CheatEntries>
</CheatEntry>
</CheatEntries>
</CheatTable>
|
The following options are enabled in the "Scripts" setting in the script:
Code: | <Description>"Scripts"</Description>
<Options moActivateChildrenAsWell="1" moDeactivateChildrenAsWell="1" |
If you want to activate the code when the game process is opened, paste this code into the lua script and activate the lua script (Execute Script button) and open the game.
Code: | if actimer then actimer.Destroy() actimer=nil end
actimer=createTimer() actimer.Interval=100 actimer.Enabled=true
function activeScripts()
if actimer then actimer.Destroy() actimer=nil end
local list = getAddressList()
local mem1 = addresslist_getMemoryRecordByDescription(list, "Scripts")
mem1.Active = true
end
actimer.OnTimer=function()
local proc=getProcessIDFromProcessName("chrome.exe") --your game.exe process name ?
if proc~=nil then
openProcess(proc)
activeScripts()
end
end |
Try the codes I gave by opening a new CE window. (Process chrome.exe and google chrome if possible)
If successful, review the code and move it into your own script and use it.
_________________
|
|
Back to top |
|
|
scofield96x !BEWARE! Deletes post on answer Reputation: 0
Joined: 06 Apr 2022 Posts: 7
|
Posted: Thu Apr 07, 2022 8:58 pm Post subject: |
|
|
the last code did it but now when i open Cheat engine it finds the Process but it only shows 00000648-??? and the scripts have the module not found F1_2021_dx12.exe error
Code: | if actimer then actimer.Destroy() actimer=nil end
actimer=createTimer() actimer.Interval=100 actimer.Enabled=true
function activeScripts()
if actimer then actimer.Destroy() actimer=nil end
local list = getAddressList()
local mem1 = addresslist_getMemoryRecordByDescription(list, "Scripts")
mem1.Active = true
end
actimer.OnTimer=function()
local proc=getProcessIDFromProcessName("F1_2021_dx12.exe") --your game.exe process name ?
if proc~=nil then
openProcess(proc)
activeScripts()
end
end |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25298 Location: The netherlands
|
Posted: Thu Apr 07, 2022 11:18 pm Post subject: |
|
|
MainForm.OnOpenedProcess is recommended over onOpenProcess as in MainForm.OnOpenedProcess symbolhandler has been launched unlike onOpenProcess. (and is only called once, in the main thread)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
scofield96x !BEWARE! Deletes post on answer Reputation: 0
Joined: 06 Apr 2022 Posts: 7
|
Posted: Fri Apr 08, 2022 4:31 am Post subject: |
|
|
Dark Byte wrote: | MainForm.OnOpenedProcess is recommended over onOpenProcess as in MainForm.OnOpenedProcess symbolhandler has been launched unlike onOpenProcess. (and is only called once, in the main thread) |
could you help me with that MainForm.OnOpenedProcess where to put it in my code?
this one works perfect in combination with the build in Auto Attach on CE 7.4 but its just to slow it only work 1 of 5 times.
Code: | function onOpenProcess()
local timer = createTimer(nil, false)
timer.Interval = 1
timer.OnTimer = function(timer)
local list = getAddressList()
local mem = list.getMemoryRecordByDescription("Scripts")
mem.Active = true
timer.Destroy()
end
timer.Enabled = true
end |
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Fri Apr 08, 2022 5:25 am Post subject: |
|
|
Code: | if actimer then actimer.Destroy() actimer=nil end
actimer=createTimer() actimer.Interval=100 actimer.Enabled=false
local actvIndex=0
actimer.OnTimer=function()
actvIndex=tonumber(actvIndex) + 1
--print(actvIndex)
local list = getAddressList()
local mem = list.getMemoryRecordByDescription("Scripts")
mem.Active = true
if actvIndex==10 then --1 sec
mem.Active = false -- deactive script
actvIndex=0
print("Script deaktive!")
actimer.Enabled=false
end
end
MainForm.OnOpenedProcess=function() --opened process = scripts active ..
actimer.Enabled=true
end
--Do you need to activate this code 5 times? Use a key trigger.
--Active key "F8"
if activekey1 then activekey1.Destroy() activekey1=nil end
activekey1=createHotkey(function() sleep(100) actimer.Enabled=true end, VK_F8) |
_________________
|
|
Back to top |
|
|
scofield96x !BEWARE! Deletes post on answer Reputation: 0
Joined: 06 Apr 2022 Posts: 7
|
Posted: Fri Apr 08, 2022 5:35 am Post subject: |
|
|
AylinCE wrote: | Code: | if actimer then actimer.Destroy() actimer=nil end
actimer=createTimer() actimer.Interval=100 actimer.Enabled=false
local actvIndex=0
actimer.OnTimer=function()
actvIndex=tonumber(actvIndex) + 1
--print(actvIndex)
local list = getAddressList()
local mem = list.getMemoryRecordByDescription("Scripts")
mem.Active = true
if actvIndex==10 then --1 sec
mem.Active = false -- deactive script
actvIndex=0
print("Script deaktive!")
actimer.Enabled=false
end
end
MainForm.OnOpenedProcess=function() --opened process = scripts active ..
actimer.Enabled=true
end
--Do you need to activate this code 5 times? Use a key trigger.
--Active key "F8"
if activekey1 then activekey1.Destroy() activekey1=nil end
activekey1=createHotkey(function() sleep(100) actimer.Enabled=true end, VK_F8) |
|
i don't need an hotkey i only need the scripts to activate fast enough before the anti cheat/Game loads
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Fri Apr 08, 2022 7:09 am Post subject: |
|
|
scofield96x wrote: |
this one works perfect in combination with the build in Auto Attach on CE 7.4 but its just to slow it only work 1 of 5 times. |
I think I misunderstood that.
As a result you have the generic code.
Extract and use what you need.
_________________
|
|
Back to top |
|
|
|