06-02-24, 09:29 AM | #1 |
Timer problems
Hi all. Need help with code.
What is needed: During "local duration = 10" there should be an inscription "Time left: Expired" indicating the remaining time (in this example, 10 seconds). For example "Time left: Expired 10 seconds" What now: During "local duration = 10" the message ""Time left: 10 seconds" appears. Lua Code:
|
|
06-02-24, 11:50 AM | #2 |
In updateLocation you:
Lua Code:
Lua Code:
If it's the same a "spawning" then add: Lua Code:
Then instead of: Lua Code:
test for: Lua Code:
If it's something else, you'll have to figure that out.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 06-02-24 at 04:28 PM. |
|
06-02-24, 12:07 PM | #3 |
As an aside, you don't need to re-create the two tables every OnUpdate. It's a waste of time and resources.
Instead move them outside (somewhere above) the function where they're used: Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 06-02-24 at 12:11 PM. |
|
06-02-24, 09:23 PM | #4 |
Hello, I managed to do this. Thank you very much for the tips. But a new problem has appeared. The "OK" button stopped working (previously, when it was pressed, the window with the timer disappeared).
How to make it work (or how to remove it) - either option will work for me. Lua Code:
|
|
06-02-24, 09:27 PM | #5 |
I don't see an OK button in the code, only the addonTable.timerFrame.deleteButton which is a default close (red X) button
If that's the one you mean then you are running Code:
addonTable.timerFrame:Show()
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 06-02-24 at 09:35 PM. |
|
06-02-24, 09:55 PM | #6 | |
|
||
06-02-24, 10:08 PM | #7 |
I missed it, it's part of the template.
The problem is exactly the same. The user presses the OK (or red X) and if there is still time left on the next OnUpdate (timeLeft > 0) then the addonTable.timerFrame:Show() will re-display the frame. You want to use addonTable.timerFrame:Show() only once (like when the process changes from waiting to the next event actually starting). Then if you do that you may need a way for the user to manually show the frame if they want to (like a slash command etc.). Whatever you do, you need to make sure the code doesn't re-display the frame until it's wanted/needed.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
06-02-24, 10:19 PM | #8 |
I want to show/hide a timer using a slash command. Therefore, I don't need the "OK" button.
|
|
06-02-24, 11:22 PM | #9 |
I tried removing "addonTable.timerFrame:Show()" but in the end the timer started blinking when the location was changing.
|
|
06-03-24, 12:01 AM | #10 |
It really depends on how you want it to work. It Maybe something as simple as this (once shown click OK or red X hides the frame until you type /zz):
See the --Added/--Moved comments Lua Code:
Maybe you want something different. That's what you need to figure out.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 06-03-24 at 12:05 AM. |
|
06-03-24, 12:22 AM | #11 |
You have helped me a lot again. Thank you so much for this, this forum is the best.
|
|
06-24-24, 12:55 AM | #12 |
Lua Code:
Hi all. There's one last detail left that I can't do. Now: Event (location name is displayed) "Before changing location" (for example, this is Dragonblight) and everything is displayed correctly. But when the "Event in progress" condition occurs, the previous location is still displayed. Currently the event starts every 1.5 hours with a duration of 10 minutes. You need: Event (the name of the location is displayed) “Before changing location” (for example, this is Dragonblight), as soon as the condition “Event in progress” occurs, you need to change the location to the next one in the list. It is necessary to change the location when an event occurs. The timer cycle is as follows: 1 hour 20 minutes before the location change (location 1 is displayed), the start of the event (location 2 is displayed) time 10 minutes, before the location change 1 hour 20 minutes (location 2 is displayed). The highlighted one is not working correctly. As I understand it, this is in the line Lua Code:
|
|
06-24-24, 02:35 AM | #13 |
In other words. Now there is a change of location at the moment of “completion” of the event (function “local duration = 600”). And you need to change the location at the moment of the “start of the event” (function local interval = 5400). And at the moment of “completion”, leave the location unchanged.
|
|
06-24-24, 12:31 PM | #14 |
If I'm understanding correctly, instead of:
Lua Code:
Lua Code:
Then for the start location you could: Lua Code:
and for the end location, something like: Lua Code:
If I'm understanding correctly.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 06-24-24 at 12:35 PM. |
|
06-24-24, 10:43 PM | #15 |
Lua Code:
Many thanks for the help. I did it like this. But I like your version of the code more and it is better. |
|
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Timer problems |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|