Originally Posted by Fizzlemizz
Sounds like you would want to replace the ticker with an OnUdate script with a countdown that does essentially the same thing but with an added second countdown adjusting the resets etc. of the first when it runs into/outof range. And the added initial check when the code starts to see which settings to use on login.
A second table for adjustment times might be something like (not really required if the adjustment start times etc. are the same (offset (+/- xxx seconds from event start), interval/duration) in every region).
Lua Code:
regionEventAdjustTime = { -- when the "adjustment" event occures [1] = { starttime = 1709615040, -- when the "adjustment" time starts eventDuration = 21600, -- How long "adjustment" lasts [6 hours] addIntervalInSeconds = 3600, -- Add seconds to event interval when in range, subtract when not addSomethingElse = 2700, -- Add something else when in adjust period like the event duration? }, }
|
As I understand it, in order for this to work, I also need to make changes to this code?
Lua Code:
local inEvent, timeToRun
local eventTime = regionEventStartTime[1].eventDuration -- Time the event runs in seconds(15 mins)
local waitTime = regionEventStartTime[1].eventIntervalInSeconds -- Time between events in seconds (90 mins)
local startTime = regionEventStartTime[1].starttime -- Start time from the table
local serverTime = GetServerTime()
local timeToEvent = (startTime - serverTime) % waitTime -- Remaining time before next event starts
if timeToEvent > (waitTime - eventTime) then -- Is there between 1:15 and 1:30 to go? If so, we're in the event
inEvent = true
timeToRun = eventTime - (waitTime - timeToEvent)
else -- Otherwise, set the ticker timer to time to next event
inEvent = false
timeToRun = timeToEvent
end
Did I do the right thing?
Lua Code:
local inEvent, timeToRun
local eventTime = regionEventStartTime[1].eventDuration -- Time the event runs in seconds(15 mins)
local waitTime = regionEventStartTime[1].eventIntervalInSeconds -- Time between events in seconds (60 mins)
local startTime = regionEventStartTime[1].starttime -- Start time from the table
local eventTime = regionEventAdjustTime[1].eventDuration -- Time the event runs in seconds(6 hours)
local waitTime = regionEventAdjustTime[1].addIntervalInSeconds -- Time between events in seconds (90 mins)
local startTime = regionEventAdjustTime[1].starttime -- Start time from the table
local serverTime = GetServerTime()
local timeToEvent = (startTime - serverTime) % waitTime -- Remaining time before next event starts
if timeToEvent > (waitTime - eventTime) then -- Is there between 1:15 and 1:30 to go? If so, we're in the event
inEvent = true
timeToRun = eventTime - (waitTime - timeToEvent)
else -- Otherwise, set the ticker timer to time to next event
inEvent = false
timeToRun = timeToEvent
end