Timer with an interval of 1 hour and 30 minutes
Hi. I was able to make a timer. But I can't figure out how to make it with an interval of 1 hour and 30 minutes.
Code:
local frame_x = 0 |
There is a Timer system in wow.
https://warcraft.wiki.gg/wiki/API_C_Timer.After With 2 other options depending on requirements. There are some code examples in there so hopefully you will see how it can work for your task. |
Quote:
|
I've never used it myself. But I would have thought the example they gave was informative enough.
Lua Code:
This example is a timer of 1 second that calls itself making it a repeating timer. Inside that function you could have it do what you want so that every 1 second ( in this example ) it will redo them. This can even be another function where you do all the functionality. |
Quote:
I don't understand how to insert this code into mine so that the time is displayed. I've tried different ways, but the timer doesn't show up if I change the code. |
What exactly were you hoping to do ?
Maybe knowing what you wanted to happen when the timer triggers every 1 hr 30 minutes would let us know what part of your code is and isn't necessary with access to the timer functions. |
Quote:
Code:
if time() <= ZAMRO_release then |
At 2 minutes remaining it starts adding the seconds to the diplsayd text (local hideSeconds = timetotrun >= 120).
Lua Code:
|
Quote:
Code:
local communityFeastTime = { Code:
local feastTime = communityFeastTime[region] |
You could use time() in the ticker (or an OnUpdate) and once it reaches the assigned time change over to using the countdown.
You can cancel a ticker and start a new one if you want seperate processes |
Quote:
Code:
local communityFeastTime = { |
The math might be a bit sketchy and long winded to show the "what" of it so test it but something like:
I don't know the event so I'm assuming the event is runs every 1.5 hours of the day and the start time (21:00) is the "known" time one of the events happens each day in that region (EU). If it's something else like the event only runs from 21:00 to 24:00 then this is not what you're looking for. Lua Code:
|
Quote:
Another question is can I add another line to the variable? 1. So that after the start of the event, within 15 minutes (900 seconds), there is another message "the event is underway". I understand this can be done through, but how? Code:
eventDuration = 900 |
I'm not sure I understand the question. Does the "the event is underway" message last for 15 minutes after the event starts or does it appear 15 minutes after the event starts (seems a bit strange but...) and if so how long does it last? You need to be specific about what you want to happen when.
|
Quote:
01:00 02:30 04:00 05:30 07:00 08:30 10:00 11:30 13:00 14:30 16:00 17:30 19:00 20:30 22:00 23:30 2. The event always runs for 15 minutes. Here is the start and end cycle of the event. 01:15 02:45 04:15 05:45 07:15 08:45 10:15 11:45 13:15 14:45 16:15 17:45 19:15 20:45 22:15 23:45 Now the inscription is displayed all the time - Next update in, it is necessary that while the event is going on (these are the 15 minutes), instead of Next update in, there should be an an event in progress inscription. |
Try:
Lua Code:
|
Quote:
UPD: I edited the code and replaced 120 with 0. The problem is that after completing the 15 minute timer, it started counting down 1.5 hours to the next event. Although there should be 1 hour and 15 minutes left. The interval between events is 1 hour and 15 minutes. The event lasts for 15 minutes. For example: the event started at 10:00, ended at 10:15, after that the timer should show that the next event is at 11:30, and this code shows that the event will be at 11:45 (and it needs to be at 11:30) This is fixed by the command /reload - as I understand it, the timer time is not reset every time. Is that why you have to prescribe? Code:
local addonName, addon = ... |
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:
Also fixed in my previous post. |
Quote:
1708234200 Maybe these parts of the code will help Code:
eFrame.regionEventStartTime = v.regionEventStartTime[GetCurrentRegion()] Code:
local start_timestamp = GetServerTime() - self.regionEventStartTime Code:
regionEventStartTime = { |
Your regionEventStartTime table is broken so I made what I think it might be intended to look like.
EDIT: My math foo is broken. Fixed the calculation if you logged in while the event is in progress. As in (not very different): Lua Code:
|
All times are GMT -6. The time now is 01:49 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI