View Single Post
02-17-24, 10:29 PM   #19
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 114
Originally Posted by Fizzlemizz View Post
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:
  1. local ticker = C_Timer.NewTicker(1, function()
  2.     if timeToRun > 0 then
  3.         timeToRun = timeToRun - 1
  4.         printTime(timeToRun, inEvent)
  5.         return
  6.     end
  7.     if inEvent then -- The event just finished
  8.         inEvent = false
  9.         timeToRun = waitTime - eventTime -- Reset ticker timer to 90 minutes wait time minus 15 mins event time
  10.     else  -- Waiting for the next event just expired
  11.         inEvent = true
  12.         timeToRun = eventTime -- And the event is running
  13.     end
  14.     printTime(timeToRun, inEvent)
  15. end)
  16. 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

Last edited by Hubb777 : 02-17-24 at 10:48 PM.
  Reply With Quote