03-04-24, 10:24 PM | #1 |
Timer with 2 variables
Lua Code:
1) Data. There is an event A and an event B. 2) Event A data is entered into the code (Start at 1709615040, interval 3600 and event time 240) 3) Event B (Start at 1709629200, interval 21600 (6 hours) and event time 7200 (2 hours)) Task: 1) The timer should fire every hour (this is in the code and it works). 2) The timer should increase the interval between events when event B occurs, for the duration of event B (by 2 hours). For example: 08:04 - event A has started - the timer shows 1 hour until the next event. 09:04 - event A has started - the timer shows 1 hour until the next event. 10:04 - event A has started - the timer shows 3 hours until the next event. Since at 11:00 there will be event B. 11:04 - event A has not started - the timer shows 2 hours until the next event. Since at 11:00 there was event B. 12:04 - event A has not started - the timer shows 1 hour until the next event. Since at 11:00 there was event B. 13:04 - event A has started - the timer shows 1 hour until the next event. Last edited by Hubb777 : 03-04-24 at 10:36 PM. |
|
03-05-24, 11:50 PM | #2 |
The following option is possible:
So that event A counts every hour. When event B occurred, event A was extended for the duration of event B. |
|
03-06-24, 11:55 AM | #3 |
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:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
03-07-24, 12:17 AM | #4 | |
Lua Code:
Did I do the right thing? Lua Code:
Last edited by Hubb777 : 03-07-24 at 12:29 AM. |
||
03-08-24, 10:32 PM | #5 |
The first time I missed a line.
Lua Code:
Lua Code:
|
|
03-10-24, 08:46 AM | #6 | |
There's some information missing from your OP
Event B Starts at 1709629200, lasts for 6 hours. During that 6 hours, the time between the events is 2 hours (instead of 1). and what's missing: Does event B occur once a day? If not what is the interval between repeats? 6 hours Event B followed by 6 hours Event A then repeat? Or something different (6 Hours B, 3 hours A, 6 Hours B...). Is the actual event time (the one this process is tracking) still the same duration during Event A and B (240 or whatever) and just the interval between is varied (1/2 hours)? The 3.93333333 hours between your start times would cause some strange timings to the actual event going into/out of these A/B sessions (like suddenly adding 2 hours to the start time just minutes before the countdown display said it was supposed to start etc.). Maybe figuring out ALL the actual mechanics (6 hours session B, 4.9333333 hours session A maybe?) before starting would help decide if the addon itself is "sensible" (no offence intended).
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 03-10-24 at 08:52 AM. |
||
03-10-24, 09:43 PM | #7 | |
I'll try to explain: There are 2 events (event A and event B) 2) Event А (Start at 1709615040, interval 3600 (1 hours) and event time 240 (4 minutes)) 3) Event B (Start at 1709629200, interval 21600 (6 hours) and event time 7200 (2 hours)) If event B occurs, event A does not start. Event B occurs every 6 hours and lasts 2 hours. Event B occurs every 6 hours (there can be several B events per day). It is necessary that the event timer A correctly counts down the time until the next event. Taking into account that while event B is happening, event A cannot happen. Last edited by Hubb777 : 03-10-24 at 09:47 PM. |
||
03-11-24, 12:53 PM | #8 |
1 possible method based on information given and no idea how the interaction between the start times might play into calculating session A/B start times day-to-day etc. etc.
The test times, if you want to un-comment them, should give a rough idea of what's going on as the test cycles over 12 minutes instead of 12 hours. The * should designate it's running special (session B ) times. Lua Code:
You're essentially asking 2 questions. 1. how do I create a frame to track the process of x event and 2. how does Blizzard calculate the timings of x event. This shows how 1 might work but as to 2, I have no idea so if this is not right (highly likely) then I'll leave it so maybe someone with more of an idea of what's going or might be able to figure it out.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 03-11-24 at 07:14 PM. |
|
03-12-24, 12:27 AM | #9 |
This timer works like the previous one (counting once per hour).
The start of event A and B is almost identical (event A starts five minutes at the beginning of the hour (for example, 09:05 or 10:05), and event B always starts at the beginning of the hour). You can ignore the start time of event A, and tie it to the time of event B (a difference of 5 minutes is not critical) We have an interval of 6 hours (it is after this time that event B begins). What if you specify the following data in the counter: event start - 1710223200 event interval 1 - 60 minutes event interval 2 - 60 minutes event interval 3 - 60 minutes event interval 4 - 60 minutes Skip event 1 - 120 minutes Repeat all events. This is possible in the counter based on “true” and “false”. The timer will take data from 5 lines, each time outputting data based on how many hours have passed since the start of the 6 hour cycle. Or won't that work either? Last edited by Hubb777 : 03-12-24 at 04:16 AM. |
|
03-12-24, 08:19 AM | #10 |
I managed to find an addon that makes the required timer. But how can I apply this code to my code?
Lua Code:
Event A - Trial of Elements (interval 1 hour, duration 4 minutes, if event B occurs, event A does not occur) Event B - Storm's Fury (interval 6 hours, duration 2 hours) Last edited by Hubb777 : 03-12-24 at 08:22 AM. |
|
03-12-24, 12:06 PM | #11 | |
No you didn't, because the code expects each "event" to run 24/7/365 lasting "duration" seconds repeating every interval seconds without "interuption" (same as your original request on this topic) and now you are asking for something different.
Possibly:
Lua Code:
Maybe that's not it, but knowing what you want and then clearly breaking it down in your own mind before looking for code or translating and asking for help is more likely to get you where you want. Maybe just, "I want to track game event "xxxxxx" with a waiting/running countdown timer. Does anyone know how the event works and how I might create the countdown for it?". (admittedly less likely to get you what you want because anyone here seriously interested in such a thing would most likely have created an addon for it already) Good luck.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 03-12-24 at 01:00 PM. |
||
03-12-24, 09:59 PM | #12 |
See:
1. There is event A and event B - they run 24//7/365 2. Event A has an interval of 1 hour and a duration of 4 minutes (Start at 1709615040, interval 3600 and event time 240). 3. Event B interval 6 hours, duration 2 hours. (Start at 1709629200, interval 21600 (6 hours) and event time 7200 (2 hours)) 4. If event B occurs, event A does not occur. 5. There is no need to take into account the time of different regions. Below I have outlined the rotation for 24 hours 00:05 - Event А 01:05 - Event А 02:05 - Event А 03:05 - Event А 04:00 - Event B 05:00 - Event B 06:05 - Event А 07:05 - Event А 08:05 - Event А 09:05 - Event А 10:00 - Event B 11:00 - Event B 12:05 - Event А 13:05 - Event А 14:05 - Event А 15:05 - Event А 16:00 - Event B 17:00 - Event B 18:05 - Event А 19:05 - Event А 20:05 - Event А 21:05 - Event А 22:00 - Event B 23:00 - Event B Last edited by Hubb777 : 03-12-24 at 10:43 PM. |
|
03-12-24, 11:15 PM | #13 |
In addon Events tracker, this function is implemented. When event B is in progress, event A has not started and its start time is increased (see picture)
The code below shows the entire code of addon Events tracker (the code shows the time of different regions, Europe, America, etc. but I only need 1 region - Europe) Where - Trial of Elements is event A Where - Storm's fury is event B The timer only needs to display event A As I understand it, this is done through the datablock function Lua Code:
Lua Code:
Last edited by Hubb777 : 03-12-24 at 11:23 PM. |
|
03-13-24, 10:24 AM | #14 | |
In the code listed, the datablock is just a list of what looks like map pin locations, nothing to do with time. Suspiciously cropped picture is suspicious, and not saying what you think it is... Maybe it's because of the difference between the way the addon works and the way the event you want track works is why it's not included in the addon. Just to finish up, another guess at what you are looking for (more actual processes being tracked with their own names and times). Still guessing you want to track the running/waiting periods of the same actual event. 1 Event, runs for 4 minutes. 1 Session, totaling 6 hours, repeating 2 Sub-Sessions (A and B) Sub-Session A: Event lasts 4 minutes and interval between Events is 1 hour (4 minutes + 56 minutes repeating 4 times). Sub-Session A runs for 4 hours total Sub-Session B: Event lasts 4 minutes and interval between Events is 2 hours (4 minutes + 1 hour 56 minutes no repeats). Sub-Session B runs for 2 hours total Code:
Session Start (6 hours): 00:05 - Sub-Session А -- Event for 4 minutes 01:05 - Sub-Session А -- Event for 4 minutes 02:05 - Sub-Session А -- Event for 4 minutes 03:05 - Sub-Session А -- Event for 4 minutes 04:00 - Sub-Session B -- Event for 4 minutes 05:00 - Sub-Session B -- extended wait time Session End: Repeat (6 hours): 06:05 - Sub-Session А -- Event for 4 minutes 07:05 - Sub-Session А -- Event for 4 minutes 08:05 - Sub-Session А -- Event for 4 minutes 09:05 - Sub-Session А -- Event for 4 minutes 10:00 - Sub-Session B -- Event for 4 minutes 11:00 - Sub-Session B -- extended wait time Repeat (6 hours): 12:05 - Sub-Session А -- Event for 4 minutes 13:05 - Sub-Session А -- Event for 4 minutes 14:05 - Sub-Session А -- Event for 4 minutes 15:05 - Sub-Session А -- Event for 4 minutes 16:00 - Sub-Session B -- Event for 4 minutes 17:00 - Sub-Session B -- extended wait time Repeat (6 hours): 18:05 - Sub-Session А -- Event for 4 minutes 19:05 - Sub-Session А -- Event for 4 minutes 20:05 - Sub-Session А -- Event for 4 minutes 21:05 - Sub-Session А -- Event for 4 minutes 22:00 - Sub-Session B -- Event for 4 minutes 23:00 - Sub-Session B -- extended wait time I've spent too much time on this and I'm sure you're sick of hearing from me. I will leave it to you and others to try and find a workable solution for whatever it is you are wanting to do. Have Fun!
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 03-13-24 at 01:09 PM. |
||
03-13-24, 10:54 PM | #15 |
I apologize for causing you any inconvenience. And took up your time.
I'll try to explain again. In details for convenience, I gave an example of a start at 00:00, and not at 00:05 as in the example above. Sorry again. Session Start (6 hours): (line 0) Time 06:00 - Sub-Session B -- + 60 min = 07:00 (120 minutes until next event) (line 1) Time 07:00 - Sub-Session B - + 60 min = 08:00 (60 minutes until next event) (line 2) Time 08:00 - Sub-Session А -- Event for 4 minutes. 08:00 + 4 min = 08:04 (56 minutes until next event) (line 3) Time 09:00 - Sub-Session А -- Event for 4 minutes. 09:00 + 4 min = 09:04 (56 minutes until next event) (line 4) Time 10:00 - Sub-Session А -- Event for 4 minutes. 10:00 + 4 min = 10:04 (176 minutes until next event) Session End: Repeat (6 hours): (line 0) Time 11:00 - Sub-Session B -- + 60 min = 12:00 (120 minutes until next event) (line 1) Time 12:00 - Sub-Session B - + 60 min = 13:00 (60 minutes until next event) (line 2) Time 13:00 - Sub-Session А -- Event for 4 minutes. 13:00 + 4 min = 13:04 (56 minutes until next event) (line 3) Time 14:00 - Sub-Session А -- Event for 4 minutes. 14:00 + 4 min = 14:04 (56 minutes until next event) (line 4) Time 15:00 - Sub-Session А -- Event for 4 minutes. 15:00 + 4 min = 15:04 (176 minutes until next event) It seems like we just can't understand each other. I'll try to explain everything. (line 0 and 1 will be both "false") (line 2,3 and 4 will be like "true") If we fail to understand each other, I will have to abandon this idea =( Last edited by Hubb777 : 03-13-24 at 11:30 PM. |
|
03-14-24, 10:39 AM | #16 |
Some questions:
1. What EXACTLY are you trying to monitor, an event that the game runs outside of your control ( what is it ) , or an event you have created yourself which you have total control over ( maybe you can make some adjustments to it to make the addon writing easier and expand on it as your addon writing skills improve) ? 2. What are you HOPING to achieve with this addon ? 3. What is working as expected ? 4. What isn't working as expected ? What were you wanting it to do ? What is it doing instead ? 5. Have you made sure you have something like bugrabber and bugsack active picking up any errors ? If you have errors the addon will stop at that point, so you would need to fix those errors before seeing how the code runs when it isn't bugging out. If you weren't aware, unfortunately programming can involve a lot of testing, fixing, testing, fixing time. Some less of them, some more of them. It all depends on the complexity of the project.
__________________
All Level 70 Characters: Demon Warlock Resto Druid Disc Priest Resto Shaman Survival Hunter Augment Evoker Frost Mage Vengence Demon Hunter Rogue ( was subtlety ) Brewmaster Monk (TR) Prot Paladin (TR) Blood Death Knight ( TR) As you can see I am missing a warrior And .. I don't have all the allied races covered. Time Runner time when it happens again |
|
03-14-24, 01:14 PM | #17 |
I wasn't going to but...
Your numbers still dont add up Code:
Session Start (6 hours): (line 0) Time 06:00 - Sub-Session B -- + 60 min = 07:00 (120 minutes until next event) (line 1) Time 07:00 - Sub-Session B - + 60 min = 08:00 (60 minutes until next event) (line 2) Time 08:00 - Sub-Session А -- Event for 4 minutes. 08:00 + 4 min = 08:04 (56 minutes until next event) (line 3) Time 09:00 - Sub-Session А -- Event for 4 minutes. 09:00 + 4 min = 09:04 (56 minutes until next event) (line 4) Time 10:00 - Sub-Session А -- Event for 4 minutes. 10:00 + 4 min = 10:04 (176 minutes until next event) Session End: But again using some guesswork (116 is instead of 176) the explanation seems to look like this (I'm starting to feel like ChatGPT, just keep saying something even if you don't understand the request ):
2:04 + 3:56 (Sub-session A + Sub-session B) make up each 6 hour session. Then repeat. (I've included some test times to run over 6 minutes instead of 6 hours. To use, remove the --[[ directly above the replacement times and remove the ]]-- directly below them. Put them back or delete the test times to use the 6 hour rotation. The * shows you are in the 3:56 waiting period. If this is it then you will have to find a startTime where the first of the 4 minute events starts on a day in your region and replace 1709615040 with that time. Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 03-14-24 at 04:33 PM. |
|
03-14-24, 10:01 PM | #18 | |
Hello. Thank you very much for your help. Today I will test this code. I wrote to the creator of addon Events tracker, below is the text of his response. Perhaps his answer will help us understand each other. Once again sorry for the inconvenience.
Last edited by Hubb777 : 03-14-24 at 10:03 PM. |
||
03-14-24, 11:02 PM | #19 |
If Trial of the Element is what you are wanting to track, then why not use the addon and remove the entries for all the other events (or disable them) instead of trying to re-invent the wheel?
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
03-15-24, 11:01 PM | #20 | |
“Reinventing the wheel” - in some ways you are right. But the Events tracker addon is quite technically complicated for me to understand. And if the author abandons it, then I will be left without the functionality I need. I'll tell you a little story. I've been using the ChatBar addon for a long time. But with the release of the Shadowlands update. The author of the addon stopped playing Warcraft and stopped updating the addon. And the addon broke. I have been supporting the addon for more than 2 years, updating it, fixing it. This was within my power because this addon is very simple. With the release of Dragonflight, the author returned and began updating the addon again. The addon was simple and I was able to fix it, if it had been folded like an Events tracker, I would have abandoned these attempts and ChatBar, like hundreds of other addons, would have remained in history. Therefore, I have to “reinvent the wheel” so as not to lose the functionality that I need. |
||
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Timer with 2 variables |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|