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 


Lua scripts

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Starter_But
Newbie cheater
Reputation: 0

Joined: 26 Oct 2021
Posts: 16

PostPosted: Tue Oct 26, 2021 11:56 am    Post subject: Lua scripts Reply with quote

how to loop a function for a certain number of times.I made a teleport by coordinates and I want it to pass an infinite number of times at these coordinates or at least 100 times
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater
Reputation: 4

Joined: 02 Sep 2011
Posts: 516
Location: 0x90

PostPosted: Tue Oct 26, 2021 12:54 pm    Post subject: Reply with quote

Use something called a 'for' loop.
Back to top
View user's profile Send private message
Starter_But
Newbie cheater
Reputation: 0

Joined: 26 Oct 2021
Posts: 16

PostPosted: Tue Oct 26, 2021 1:04 pm    Post subject: Reply with quote

Example:
WriteInteger("92838482",1000)
WriteInteger ("92838482",4000)
how to make a loop so that the program goes through this list over and over again
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater
Reputation: 4

Joined: 02 Sep 2011
Posts: 516
Location: 0x90

PostPosted: Tue Oct 26, 2021 1:08 pm    Post subject: Reply with quote

for loop

Search engines are your friend. I have told you what you need to do, all you have to do is put in the effort to learn.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 183

Joined: 25 Jan 2006
Posts: 8370
Location: 127.0.0.1

PostPosted: Tue Oct 26, 2021 2:10 pm    Post subject: Reply with quote

Please take the time to learn basic Lua. This is something that is part of the language itself.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
panraven
Grandmaster Cheater
Reputation: 40

Joined: 01 Oct 2008
Posts: 860

PostPosted: Tue Oct 26, 2021 2:55 pm    Post subject: Reply with quote

100 'for' loop writing a values will happened within 1ms, it may be a bit useful to do with a timer to keep writing the values for a duration, kind of 'freeze' with a duration.
eg.
Code:

{$lua}
local duration = 5000 -- in ms, so 5000ms is 5sec
local interval = 250 -- in ms, how often to write the value, 250ms is 1/4 sec
local timer = createTimer()
timer.Interval, timer.OnTimer = interval, function(tmr)
  if duration<0 then tmr.Destroy() else duration = duration - interval end -- writing done when duration go below 0
  -- do the address write --
end
timer.Enabled = true
{$asm}

_________________
- Retarded.
Back to top
View user's profile Send private message
Starter_But
Newbie cheater
Reputation: 0

Joined: 26 Oct 2021
Posts: 16

PostPosted: Tue Oct 26, 2021 3:07 pm    Post subject: Reply with quote

Это всё хуйня,я научился делать намного круче
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    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