View Single Post
03-07-24, 12:17 AM   #4
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 113
Originally Posted by Fizzlemizz View Post
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:
  1. regionEventAdjustTime = { -- when the "adjustment" event occures
  2.     [1] = {
  3.         starttime = 1709615040, -- when the "adjustment" time starts
  4.         eventDuration = 21600, -- How long "adjustment" lasts [6 hours]
  5.         addIntervalInSeconds = 3600, -- Add seconds to event interval when in range, subtract when not
  6.         addSomethingElse = 2700, -- Add something else when in adjust period like the event duration?
  7.     },
  8. }
As I understand it, in order for this to work, I also need to make changes to this code?
Lua Code:
  1. local inEvent, timeToRun
  2. local eventTime = regionEventStartTime[1].eventDuration -- Time the event runs in seconds(15 mins)
  3. local waitTime = regionEventStartTime[1].eventIntervalInSeconds -- Time between events in seconds (90 mins)
  4. local startTime = regionEventStartTime[1].starttime -- Start time from the table
  5. local serverTime = GetServerTime()
  6. local timeToEvent = (startTime - serverTime) % waitTime -- Remaining time before next event starts
  7.  
  8. if timeToEvent > (waitTime - eventTime) then -- Is there between 1:15 and 1:30 to go? If so, we're in the event
  9.     inEvent = true
  10.     timeToRun = eventTime - (waitTime - timeToEvent)
  11. else                    -- Otherwise, set the ticker timer to time to next event
  12.     inEvent = false
  13.     timeToRun = timeToEvent
  14. end

Did I do the right thing?
Lua Code:
  1. local inEvent, timeToRun
  2. local eventTime = regionEventStartTime[1].eventDuration -- Time the event runs in seconds(15 mins)
  3. local waitTime = regionEventStartTime[1].eventIntervalInSeconds -- Time between events in seconds (60 mins)
  4. local startTime = regionEventStartTime[1].starttime -- Start time from the table
  5.  
  6. local eventTime = regionEventAdjustTime[1].eventDuration -- Time the event runs in seconds(6 hours)
  7. local waitTime = regionEventAdjustTime[1].addIntervalInSeconds -- Time between events in seconds (90 mins)
  8. local startTime = regionEventAdjustTime[1].starttime -- Start time from the table
  9.  
  10. local serverTime = GetServerTime()
  11. local timeToEvent = (startTime - serverTime) % waitTime -- Remaining time before next event starts
  12.  
  13. if timeToEvent > (waitTime - eventTime) then -- Is there between 1:15 and 1:30 to go? If so, we're in the event
  14.     inEvent = true
  15.     timeToRun = eventTime - (waitTime - timeToEvent)
  16. else                    -- Otherwise, set the ticker timer to time to next event
  17.     inEvent = false
  18.     timeToRun = timeToEvent
  19. end

Last edited by Hubb777 : 03-07-24 at 12:29 AM.
  Reply With Quote