WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   UnitAura error (https://www.wowinterface.com/forums/showthread.php?t=56743)

cosmabgd 10-03-18 09:06 PM

UnitAura error
 
3 Attachment(s)
hello . i am new here and new on addon projects. I am trying to resurect an old addon tauntmaster 2 but i get some error and i dont understand where is the problem. i am searching for a little help . thank you

error :
Message: Interface\AddOns\TauntMaster2\Gui\TauntMasterGUI.lua:399: Usage: UnitAura("unit", [index][, "filter"])
Time: Thu Oct 4 12:03:49 2018
Count: 67
Stack: Interface\AddOns\TauntMaster2\Gui\TauntMasterGUI.lua:399: Usage: UnitAura("unit", [index][, "filter"])
[C]: in function `UnitAura'
Interface\AddOns\TauntMaster2\Gui\TauntMasterGUI.lua:399: in function <Interface\AddOns\TauntMaster2\Gui\TauntMasterGUI.lua:398>

Locals: (*temporary) = "player"
(*temporary) = nil
(*temporary) = nil
(*temporary) = "HELPFUL"

MuffinManKen 10-03-18 10:09 PM

This isn't an area I'm familiar with, but I do know they changed UnitAura in 8.0:
https://wow.gamepedia.com/API_UnitAura

It only has 3 parameters, and you can't look up auras by name just index. So UnitAura("player", 1, "HELPFUL") would give you the first helpful buff.

I think this exact issue has come up a few time recently so you might want to search the forum for more details on the new way to do this.

cosmabgd 10-03-18 11:56 PM

thank you for your reply .
Yes i read about the changes in BFA , but i still don't understand how the modification can be done .
I was thinking that for this addon i don't need a buff check or maybe i am wrong .
Maybe someone can look on the code and guide me to the right way.

Lyak 10-04-18 12:48 AM

Try to use AuraUtil.FindAuraByName instead of UnitAura.

Lua Code:
  1. AuraUtil.FindAuraByName(ResolveName, "player", "HELPFUL")

AuraUtil.FindAuraByName works exactly same as an old UnitAura function with querying by spell name.

I also learnt it from zork :D

-- EDIT #1

Well, I honestly can't say it works exactly same as I have not seen how UnitAura works internally, but at least it returns same outputs :rolleyes:

cosmabgd 10-04-18 01:27 AM

2 Attachment(s)
Thank you for your answer , but now i am getting more errors:




Message: Interface\AddOns\TauntMaster2\Gui\TauntMasterGUI.lua:397: Attempt to register unknown event "AuraUtil.FindAuraByName"
Time: Thu Oct 4 16:23:38 2018
Count: 1
Stack: Interface\AddOns\TauntMaster2\Gui\TauntMasterGUI.lua:397: Attempt to register unknown event "AuraUtil.FindAuraByName"
[C]: in function `RegisterEvent'
Interface\AddOns\TauntMaster2\Gui\TauntMasterGUI.lua:397: in function `resolveBar_SetSpec'
Interface\AddOns\TauntMaster2\Gui\TauntMasterGUI.lua:121: in function `TauntMasterGUI_ShowFrame'
Interface\AddOns\TauntMaster2\TauntMaster2.lua:58: in function <Interface\AddOns\TauntMaster2\TauntMaster2.lua:52>
(tail call): ?
[C]: ?
[string "safecall Dispatcher[1]"]:9: in function <[string "safecall Dispatcher[1]"]:5>
(tail call): ?
...xternal\Wildpants\libs\AceAddon-3.0\AceAddon-3.0.lua:558: in function `EnableAddon'
...xternal\Wildpants\libs\AceAddon-3.0\AceAddon-3.0.lua:651: in function <...xternal\Wildpants\libs\AceAddon-3.0\AceAddon-3.0.lua:636>
[C]: ?
[C]: in function `LoadAddOn'
Interface\FrameXML\UIParent.lua:446: in function `UIParentLoadAddOn'
Interface\FrameXML\UIParent.lua:565: in function `TimeManager_LoadUI'
Interface\FrameXML\UIParent.lua:1192: in function <Interface\FrameXML\UIParent.lua:1090>

Locals: <none>

Lyak 10-04-18 01:45 AM

Quote:

Originally Posted by cosmabgd (Post 330353)
Thank you for your answer , but now i am getting more errors:

You just registered an event called "AuraUtil.FindAuraByName" which, of course, does not exist.

You only have to change those UnitAura function calls, not UNIT_AURA event :p
(You might have done by accident.)

Lua Code:
  1. if (currentSpecName == 250) or (currentSpecName == 104) or (currentSpecName == 268) or (currentSpecName == 66) or (currentSpecName == 73) or (currentSpecName == 581) then
  2.     -- 250 - Blood(Death Knight),  104 - Guardian(Druid) , 268 - Brewmaster(Monk ), 66 - Protection(Paladin) ,  73 - Protection(Warrior)  , 581 - Vengeance(Demon Hunter)
  3.     resolveBar:SetMinMaxValues(0, 240)
  4.     resolveBar:SetValue(0)
  5.     resolveBar:RegisterEvent("UNIT_AURA") -- THIS
  6.     resolveBar:SetScript("OnEvent", function(resolveBar, event, ...)
  7.         if (AuraUtil.FindAuraByName(ResolveName, "player", "HELPFUL")) then

myrroddin 10-04-18 02:15 PM

Just so you know in future, events are entirely capitalized, like UNIT_AURA, whereas API instructions are camel-cased, like AuraUtil.FindAuraByName.

cosmabgd 10-04-18 07:05 PM

3 Attachment(s)
Thank you all for the answer , yes right now i don't have more errors . i know i am a not good on coding but i try to learn .
Now if i can bother you with one more problem:
what they change in 8.0 because configuration menu is not clickable anymore (i have uploaded a screenshot )


All times are GMT -6. The time now is 01:58 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI