Thread Tools Display Modes
05/10/14, 05:06 PM   #1
morton.bia
Join Date: Apr 2014
Posts: 4
unitTag returning int

Im trying to test the unitTag to make sure its player so I have
Code:
function expReceived (unitTag, exp, maxExp, reason)
  if ( unitTag ~= 'player' ) then
    d(unitTag)
    return
  end
end

 EVENT_MANAGER:RegisterForEvent("test" , EVENT_EXPERIENCE_UPDATE, expReceived)
I have the d(unitTag) to see what im getting when its not player. Everytime i get exp im getting a number as the unittag and my check is returning true when it should return false. I even checked against other addons and the other ones work but mine doesnt want to return correctly.

This is my first addon so any help would be appreciated
  Reply With Quote
05/10/14, 05:08 PM   #2
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
in front of unit tag in the function header line put eventID. The first value in event functions is the ID of the event itself followed by its data.
  Reply With Quote
05/10/14, 05:25 PM   #3
morton.bia
Join Date: Apr 2014
Posts: 4
awesome, that did it!! thanks so much
  Reply With Quote
05/10/14, 05:29 PM   #4
morton.bia
Join Date: Apr 2014
Posts: 4
When testing I see group2 as the unittag now, I do have 2 pets with me, does that mean they got exp but i didnt? o0
  Reply With Quote
05/10/14, 05:32 PM   #5
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
Use GetUnitName(unitTag) to get the name of the unit and see what that says. It simply depends on who the unitTag belongs to. I didn't realise it put you in a group if you had a pet so that's interesting.

You can also use IsUnitPlayer(unitTag) to find out if the unit is the player.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » unitTag returning int


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off