-- Establish the duration of the timer
local timer_duration = 5

-- A variable to store how much time has passed
local timer_elapsed

-- The function which is called on each update
local function UpdateTimer(self, elapsed)
	timer_elapsed = timer_elapsed + elapsed	-- Increment our timer
	-- If we have waited for the duration, then do something and reset the timer.
	if timer_elapsed >= timer_duration then
		-- Insert code or function call to run
		timer_elapsed = 0	-- Reset timer, or...
		self:SetScript("OnUpdate", nil)	-- Turn timer off

local timer_frame = CreateFrame("Frame")	-- Create a frame for the timer.
timer_frame:SetScript("OnUpdate", UpdateTimer)	-- Start updating

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.