03-16-24, 11:05 PM | #1 |
2 questions on the timer
Hi all. Thanks again to Fizzlemizz, without him I couldn't do anything.
Data: There are 4 events (A, B, C and D) and they go cyclically and endlessly (example: A, B, C, D, A, B, C, D, A, B, C and D) The interval between all events is 1 hour (example Between event A and event B is 1 hour, between event B and event C is one hour, between event C and event D is 1 hour). Events always last 5 minutes. What is needed: For the event to be displayed correctly (where starttime = 1679572800, this is the start of event A). For example, if I enter the game 3 hours 30 minutes after the start of event A, it will show me that event D will begin soon. Source Lua Code:
I tried to do it myself based on the given code and WA Lua Code:
Here's what I got. But this option works with an error (For testing I used an interval of 1 minute). Lua Code:
Second question how can I make a button to hide the timer on command? Lua Code:
|
|
03-16-24, 11:19 PM | #2 |
Or is it two events repeating ie.
or is it
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 03-16-24 at 11:24 PM. |
|
03-16-24, 11:48 PM | #3 |
Hello. Yes, this is exactly the option.
|
|
03-17-24, 10:23 AM | #4 |
It's all variations on a theme (and math). Knowing the remainder of a session (session totalDuration of 1, 2, 4, 6 or 12 hours). This is based on the start time (startTime - serverTime) % totalDuration.
Then figuring out what to do with that remainder based on the breakdown of each sub-session eg. 4 sub-sessions of exactly 5 and 55 (like below) or x sub-sessions of "things" that add up to totalDuration. Test times are over 4 minutes instead of 4 hours. Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 03-17-24 at 01:31 PM. |
|
03-17-24, 10:47 AM | #5 | |
You want to hide/show the frame that you created and for that (in this case) you would use the frame name ZAMTimer777. If you are giving frames a name then each one should be completely unique (like using your addon name as a prefix eg. "ZAMTimer_No1" or "Hubb777_Addon_A" etc.) Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
||
03-17-24, 10:34 PM | #6 | |
If I want to remove one event that lasts 1 hour or add one event that lasts 1 hour, I will need to change this number 14400, right? And add or remove a letter. Lua Code:
How to add localization to other languages for lines A, B, C, D, etc. Lua Code:
and how to return a sound/color alert to the code Lua Code:
Last edited by Hubb777 : 03-19-24 at 09:45 PM. |
||
03-18-24, 11:07 AM | #7 | |
Lua Code:
Then replace Lua Code:
Lua Code:
As for colours and alarms, it would seem you just need to add a caclulation for x time before the end of a wait sub-session and sound the alarm/change the colour. You should have enough already to be able to work that out.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 03-18-24 at 09:43 PM. |
||
03-18-24, 11:03 PM | #8 |
Hello thank you very much for your help.
Lua Code:
Hello. I did the localization, but the translation only affects Waiting and Running, and the letters A, B, C, etc. remain without translation. For the sound/color singal I added this part of the code. Looks like more changes need to be made to make it work. Lua Code:
Last edited by Hubb777 : 03-19-24 at 09:20 AM. |
|
03-19-24, 06:20 AM | #9 |
That is because you didn't use the the localization version.
L.Running, MyRegion[id].name L.Running is using the localization version MyRegion[id].name is using the English version What you need to do is use that English version as a key to the localized version. Try L[MyRegion[id].name]
__________________
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-19-24, 09:23 AM | #10 | |
Lua Code:
yes it worked. The remaining question is how to attach a sound/color alert. (Just pasting a piece of code didn't work) Last edited by Hubb777 : 03-19-24 at 09:50 PM. |
||
03-19-24, 10:54 AM | #11 |
This has some examples and info on using it for sound
https://warcraft.wiki.gg/wiki/API_PlaySound As to a colour alert, it depends on what you mean. You could do something as simple as colourizing the text. This can be done using hex code colouring when you set the text eg |cAARRGGBBTextToDisplay|r or for clarity and flexibility where ColorOn can be set to a different colour before setting the text. Lua Code:
Or you could add a texture to the frame holding the text and colourise that according to your needs More Info : https://warcraft.wiki.gg/wiki/API_Te...etColorTexture Set the texture up at frame Creation time Lua Code:
Then, when you need to change it's color use this line Lua Code:
__________________
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-19-24, 09:46 PM | #12 | |
Hello. I have the code, but I don't understand how to use it. Lua Code:
The result should be something like this. Lua Code:
Last edited by Hubb777 : 03-19-24 at 09:51 PM. |
||
03-19-24, 11:04 PM | #13 |
The PrintTime function is not actually being used in this version so I removed it. Because we replaced the ticker, the calculating and display is all done in the OnUpdate function.
Added some test times for the alarm/colours at 10 and 3 seconds for use with the event test times. Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 03-20-24 at 11:56 AM. |
|
03-20-24, 10:24 PM | #14 |
Hello, thank you very much, you helped me a lot. I have already started creating my second addon.
|
|
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » 2 questions on the timer |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|