View Full Version : Self repeating Event
04-28-2014, 04:26 PM
Is it possible to make an script thats repeat it self every 30 minutes?
Im planing to make a little Hunger Script via Eluna Lua, so i need the function that the Script repeat itself every 30 mins for another "hunger tick" but i dont even know how to do it.
Anyone can help?
04-28-2014, 04:41 PM
local function TimedFunction(eventId, delay, repeats)
CreateLuaEvent(TimedFunction, 30*60*1000, 0)
Here is the documentation for CreateLuaEvent:
CreateLuaEvent(function, delay, calls) - Creates a global timed event. Returns Event ID. Calls set to 0 calls infinitely.
Also look into WorldObject:RegisterEvent(function, delay, calls)
It works exactly the same way except it passes the world object and only runs if the world object is in world (player near it)
Also see the RemoveEventById and RemoveEvents
ps. the delay is in milliseconds so I just made some math there to convert 30 min to milliseconds
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.