Page 1 of 1

Script

Posted: Fri Oct 27, 2023 3:36 pm
by xapo
Hello, can someone help me?
i'd like to create an Script that change a SpeedHack between a specific time..

like SpeedHack is 1 then chante to 1.05 time ( 1000 ) change back to 1, wait (1000) change back to 1.05.. this in a infinite while until i press the key to stop it

Thank you

Re: Script

Posted: Fri Oct 27, 2023 6:25 pm
by LeFiXER
xapo wrote:
Fri Oct 27, 2023 3:36 pm
Hello, can someone help me?
i'd like to create an Script that change a SpeedHack between a specific time..

like SpeedHack is 1 then chante to 1.05 time ( 1000 ) change back to 1, wait (1000) change back to 1.05.. this in a infinite while until i press the key to stop it

Thank you
This works as intended:

Code: Select all

[ENABLE]
{$LUA}
if syntaxcheck then return end
-- Interval in seconds
local interval = 1
local active = true
speedhackTimer = createTimer(getMainForm())
speedhackTimer.Interval = interval * 1000
speedhackTimer.OnTimer = function ()
                            if active then
                               speedhack_setSpeed(1)
                            else
                               speedhack_setSpeed(1.05)
                            end
                            active = not active
                          end
{$ASM}
[DISABLE]
{$LUA}
if syntaxcheck then return end
if speedhackTimer then speedhackTimer.destroy(); speedhackTimer = nil end

Re: Script

Posted: Fri Oct 27, 2023 10:56 pm
by xapo
thank you, i can run it, i don't know why..... i'm trying

Re: Script

Posted: Sun Oct 29, 2023 9:17 pm
by LeFiXER
xapo wrote:
Fri Oct 27, 2023 10:56 pm
thank you, i can run it, i don't know why..... i'm trying
It's because you need to add it as a script. Click the Memory View button on the main window of Cheat Engine, In the new window that shows up click Tools on the menu and at the bottom will be Auto Assemble script. Paste the code in there, click File > Assign to current cheat table.