Originally Posted by Fizzlemizz
The time between the events is 90 minutes for the login test but once you've started the clock it's then reduced by 15 minutes (the time the event takes) which I didn't account for.
The ticker code would be:
Lua Code:
local ticker = C_Timer.NewTicker(1, function() if timeToRun > 0 then timeToRun = timeToRun - 1 printTime(timeToRun, inEvent) return end if inEvent then -- The event just finished inEvent = false timeToRun = waitTime - eventTime -- Reset ticker timer to 90 minutes wait time minus 15 mins event time else -- Waiting for the next event just expired inEvent = true timeToRun = eventTime -- And the event is running end printTime(timeToRun, inEvent) end) printTime(timeToRun, inEvent)
Also fixed in my previous post.
|
So the time is taken locally? And if the player's time is different, will there be a discrepancy? Is it possible to make the start of time not in seconds, but using Unix Timestamp?
https://www.unixtimestamp.com/
1708234200
Maybe these parts of the code will help
Code:
eFrame.regionEventStartTime = v.regionEventStartTime[GetCurrentRegion()]
Code:
local start_timestamp = GetServerTime() - self.regionEventStartTime
local next_event = self.eventIntervalInSeconds - start_timestamp % self.eventIntervalInSeconds
local spawning = self.eventIntervalInSeconds - next_event < self.eventDuration
local remaining = self.eventDuration - (self.eventIntervalInSeconds - next_event)
local showedTime = spawning and remaining or next_event
Code:
regionEventStartTime = {
[1] = 16862400102,}, -- eu
eventDuration = 900,
eventIntervalInSeconds = 5400,
enable = true,
datablock = {}
},
According to the example that I want, an addon has been made -
https://www.wowinterface.com/downloa...sionTimer.html