Lua get Buff duration
Hi,
i want to return how much time left on my buff. i startet with: Code:
function() Can somebody give a hint? |
Lua Code:
Take a look at the 2nd example http://wowpedia.org/API_UnitBuff |
Ok but i still get lua errors and a strange behaviour of my bar:
Code:
function() to have a bar which shows when the buff will expire. With the above code i just get lua errors. Quote:
Quote:
|
Re-read the documentation. The 8th return value is a string identifying the unit that cast the buff; the expiration time is arg7. Also, there's really no reason to use select here; it's just slowing things down for no reason.
Code:
function() Code:
function() |
Quote:
Quote:
Quote:
Quote:
Im working with WeakAuras 2 And i have a bar to observe my Blood Shield of my DK. This is the function i use to show how much damage my shield can block: Code:
function () Code:
function() Code:
function() shows how much time is left until my shield expires. If i use one of your codes posted above i get the posted lua errors and the bar starts randomly in the middle of the bar and decreases. |
You're (probably) getting those errors because you don't currently have the buff active. I guess WeakAuras can't handle nil values itself (I don't actually use it) so just return a zero if UnitAura didn't return anything:
Code:
function() Code:
function() |
Quote:
This time ill post the whole error output: Quote:
i want to show because if i delete it everything just works fine. |
Quote:
|
Quote:
Code:
function() Code:
function() |
If you're still getting that error, then it's not coming from the code snippets I posted, as it's literally not possible for either of those snippets to return a nil value, and the error you posted is being caused by a nil value.
|
WeakAuras probably wants multiple return values and I have no idea what they're supposed to be (start or expiration time and duration, maybe).
I'm also pretty sure WA can show you how much time is left on a buff without creating a custom function for it. Judging by other WA scripts I've seen, and the error above, it appears to want "duration, expirationTime" for the return values. |
Quote:
For that i need custom lua codes. But as i said, if i keep the code for the duration empty everything works without lua errors (and ofcourse the duration is not shown). When i put in the code postet above lua complains about the nil value. |
Presumably it should be something like this, but as far as I can tell there isn't any documentation for WeakAuras.
Lua Code:
|
Quote:
The only thing wrong is that if the buff is not up it shows the bar fully filled instead of empty. But for now this is great. I dont need more today :D |
All times are GMT -6. The time now is 02:28 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI