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 


Randomized speedhack / timer script

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

Joined: 21 May 2019
Posts: 1

PostPosted: Mon Jul 22, 2019 12:53 pm    Post subject: Randomized speedhack / timer script Reply with quote

I need help with making a script.
Basically what i want the script to do is: Change the speedhack to 1.07 and then back to the normal value 1. Every 2 seconds. So 1.07 for 2 seconds then turn it back down to 1 for 2 seconds. Just to have that on a loop.
If anyone could help it would be greatly appreciated. Thanks for your time
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Jul 22, 2019 2:49 pm    Post subject: Reply with quote

make an AA script with something like
Code:

{$lua}
if syntaxcheck then return end -- do nothing on save/edit
[ENABLE]
-- make a timer to run code several times
local t = createTimer()
t.Interval = 2000 -- runs every 2 seconds, 2000 milliseconds
-- set the function for it to run
t.OnTimer = function(timer)
  local s = speedhack_getSpeed()
  if s == 1 then s = 1.07 else s = 1 end
  speedhack_setSpeed(s)
end

_G[memrec.Description .. '___' .. memrec.id] = t -- copy into the global table using the scripts name and id so it's unique
[DISABLE]
_G[memrec.Description .. '___' .. memrec.id].destroy() -- destroy the timer by referencing the global table, now it won't keep running

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
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