Author Topic: Command Loop  (Read 4486 times)

malfacine

  • Full Member
  • ***
  • Posts: 33
  • fliper80s@me.com
    • View Profile
Command Loop
« on: May 31, 2016, 07:54:08 PM »
Need help for script

every 10 seconds for example the function execute command....

I had an idea for a new plugin

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Command Loop
« Reply #1 on: May 31, 2016, 09:42:20 PM »
you can use add_ticks_callback something like:

Code: [Select]
fe.add_ticks_callback( my_timer );
local timer = 0;

function my_timer(ticks) {
   timer += ticks;
   if ( timer >= 10000 ) {
      //do something
      timer = 0;
   }
}