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 


Help with randomized speedhack

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

Joined: 26 Aug 2019
Posts: 6

PostPosted: Wed Aug 28, 2019 2:42 pm    Post subject: Help with randomized speedhack Reply with quote

hey i'm new to this
i was wondering if someone could help me make a script
what i want the script to do:
Have the speedhack set to 1 (default) then after 5 seconds
make it go to 1.2 for 2 seconds
then go back to 1 (default) for 5 seconds
and just put that on a loop.

if anyone could help me out that would be greatly appreciated
thank you for your time!
Back to top
View user's profile Send private message
DaVinci69
How do I cheat?
Reputation: 0

Joined: 18 Feb 2019
Posts: 6

PostPosted: Wed Aug 28, 2019 6:07 pm    Post subject: Re: Help with randomized speedhack Reply with quote

bad script but ok, not sure if this is what u wanted

Code:
interval = 1000 --1 second(s)
max = 5
min = 1
addNumber = 1
currentSpeed = min
upOrDown = {1}

if t then
    t.destroy()
end

t = createTimer(nil)
timer_setInterval(t, interval)
timer_onTimer(t, function(t)
    speedhack_setSpeed(currentSpeed)
    if max > currentSpeed and upOrDown[1] == 1 then
        currentSpeed = currentSpeed + addNumber
    elseif max <= currentSpeed and upOrDown[1] == 1 then
        upOrDown[1] = 0
    end
    if min < currentSpeed and upOrDown[1] == 0 then
        currentSpeed = currentSpeed - addNumber
    elseif min >= currentSpeed and upOrDown[1] == 0 then
        currentSpeed = currentSpeed + addNumber
        upOrDown[1] = 1
    end
end)
timer_setEnabled(t, true)
Back to top
View user's profile Send private message
Six09
How do I cheat?
Reputation: 0

Joined: 26 Aug 2019
Posts: 6

PostPosted: Wed Aug 28, 2019 6:18 pm    Post subject: Sorry i suck at explaining Reply with quote

what i meant is
i would want the timer to stay on 1 (default) for 5 seconds
then change to 1.2 for 2 seconds
then go back to 1 (default) for 5 seconds
and to just put that on a loop.
Sorry for confusing you
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Wed Aug 28, 2019 8:01 pm    Post subject: Reply with quote

maybe something like
Code:
{$lua}
if syntaxcheck then return end
[ENABLE]
global_speed_states = {{1,5000},{1.2,2000}}
global_speed_state = 1
if not global_speed_timer then
  global_speed_timer = createTimer(nil)
  function statechange(tmr)
    local info = global_speed_states[global_speed_state]
    if not info then global_speed_state=1 speedhack_setSpeed(1) tmr.Enabled = false return end
    --print(info[1], global_speed_state)
    global_speed_state = global_speed_state + 1
    if global_speed_state > #global_speed_states then global_speed_state = 1 end
    speedhack_setSpeed(info[1])
    tmr.Interval=info[2]
  end
  global_speed_timer.OnTimer = 'statechange'
  statechange(global_speed_timer) -- call it manually once to start
  -- alternatively set the interval to something and let it happen later.
end
global_speed_timer.Enabled = true -- make sure it's activated after being deactivated
[DISABLE]
global_speed_state = #global_speed_states+1

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Six09
How do I cheat?
Reputation: 0

Joined: 26 Aug 2019
Posts: 6

PostPosted: Wed Aug 28, 2019 8:22 pm    Post subject: FreeER Reply with quote

i tried to paste your script into lua
but it just keeps saying 1: unexpected symbol near }
so it's not launching the script
I'm sorry i have never used this before
Back to top
View user's profile Send private message
Lynxz Gaming
Expert Cheater
Reputation: 4

Joined: 01 Jul 2017
Posts: 208
Location: help

PostPosted: Wed Aug 28, 2019 8:23 pm    Post subject: Re: Help with randomized speedhack Reply with quote

or maybe this
the timer interval is 1000
Code:
a = 0
mode = 0
function CETimer1Timer(sender)
a = a+1
if mode == 0 then
 if a == 5 then
  speedhack_setSpeed(1.2)
  mode = 1
  a = 0
 end
end
if mode == 1 then
 if a == 2 then
  speedhack_setSpeed(1)
  mode = 0
  a = 0
 end
end
end

_________________
my english is bad
discord : rynx#9828
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Six09
How do I cheat?
Reputation: 0

Joined: 26 Aug 2019
Posts: 6

PostPosted: Wed Aug 28, 2019 8:46 pm    Post subject: Lynxz Gaming Reply with quote

i tried your script and nothing happened
i didn't get an error or anything
it just didn't enable the timer / speedhack
Back to top
View user's profile Send private message
Lynxz Gaming
Expert Cheater
Reputation: 4

Joined: 01 Jul 2017
Posts: 208
Location: help

PostPosted: Thu Aug 29, 2019 2:15 am    Post subject: Re: Lynxz Gaming Reply with quote

Six09 wrote:
i tried your script and nothing happened
i didn't get an error or anything
it just didn't enable the timer / speedhack

u need to make the timer manually and set the ontimer event CETimer1Timer

_________________
my english is bad
discord : rynx#9828
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Thu Aug 29, 2019 6:41 am    Post subject: Re: FreeER Reply with quote

Six09 wrote:
i tried to paste your script into lua
but it just keeps saying 1: unexpected symbol near }
so it's not launching the script
I'm sorry i have never used this before
Mine is designed to go in an AA script, hence the [ENABLE] and [DISABLE] sections.
_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Six09
How do I cheat?
Reputation: 0

Joined: 26 Aug 2019
Posts: 6

PostPosted: Thu Aug 29, 2019 2:01 pm    Post subject: sorry Reply with quote

I'm so sorry but how do i do that? (i'm really dumb and clueless when it comes to this)
I was just looking for a script tha tchanges the speedhack feature
to speed up my game
i dont really know anything about all these "AA scripts"
or to manually set the ontimer event.
I feel so bad being this dumb
its probably easy
i'm just really clueless.
sorry to bother all of you :/
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Thu Aug 29, 2019 6:34 pm    Post subject: Reply with quote

Open the memory view from the main GUI (ctrl+m) and go to tools "Auto Assemble" (ctrl+a) and paste the code with the [enable]/[disable] script, then go to file->"assign to current table" (alt,f,a), close the editor window and enable the script (after attaching to the game).
_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Six09
How do I cheat?
Reputation: 0

Joined: 26 Aug 2019
Posts: 6

PostPosted: Thu Aug 29, 2019 8:34 pm    Post subject: tysm Reply with quote

tysm works perfectly!
Back to top
View user's profile Send private message
Lynxz Gaming
Expert Cheater
Reputation: 4

Joined: 01 Jul 2017
Posts: 208
Location: help

PostPosted: Thu Aug 29, 2019 8:38 pm    Post subject: Re: sorry Reply with quote

i updated this so u dont need to create timer manually

this is for lua script
Code:

a = 0
mode = 0
function CETimer1Timer(sender)
a = a+1
if mode == 0 then
 if a == 5 then
  speedhack_setSpeed(1.2)
  mode = 1
  a = 0
 end
end
if mode == 1 then
 if a == 2 then
  speedhack_setSpeed(1)
  mode = 0
  a = 0
 end
end
end
if timerxd == nil then
 timerxd = createTimer(nil)
 timerxd.interval = 1000
 timerxd.OnTimer = CETimer1Timer
 timerxd.enabled = true
else
 timerxd.destroy()
 timerxd = createTimer(nil)
 timerxd.interval = 1000
 timerxd.OnTimer = CETimer1Timer
 timerxd.enabled = true
end

_________________
my english is bad
discord : rynx#9828
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