-
Posted by skyskewz on Sun, 05 Dec 2010 12:53:52
I don't know if the GUID format has changed or if it was just a typo but
in
function GUIDToType(guid) local typeMask = 0x00F local upper = tonumber(guid:sub(1, 5)) local type = bit.band(upper, typeMask) if type == 0 then print("GUID "..guid.." is a player") elseif type == 3 then print("GUID "..guid.." is an NPC") elseif type == 4 then print("GUID "..guid.." is an NPC") end end GUIDToType(UnitGUID("target"))
the player has not been identified correctly.
instead i used
if type == 8 then print("GUID"..guid.." is a player")
this worked.
-
Posted by jnwhiteh on Sun, 05 Dec 2010 12:58:41
It's possible that the GUID format and decoding have changed, thanks for the report.
-
Posted by jnwhiteh on Sun, 05 Dec 2010 13:02:54
Actually this code works properly for me, I can't reproduce your issue. What are you unable to identify?
-
Posted by skyskewz on Sun, 05 Dec 2010 16:39:47
Actually when i ran it in WoWLua, targeted a player or used UnitGUID("player") it did not print anything when i put 0, when i put 8 it returned "... is a player" when targeting a player. Not sure how it can work for you but not for me hmz.
-
Posted by jnwhiteh on Sun, 05 Dec 2010 17:05:44
Actually when i ran it in WoWLua, targeted a player or used UnitGUID("player") it did not print anything when i put 0, when i put 8 it returned "... is a player" when targeting a player. Not sure how it can work for you but not for me hmz.
I copied the code as you put above exactly, and it worked properly. Perhaps you could post the GUID of your player, which seems to not be working with this function?
/dump UnitGUID("player")
-
Posted by skyskewz on Sun, 05 Dec 2010 17:24:45
/dump UnitGUID("player") says :
Dump: value=UnitGUID("player") [1]="0x048000000315C320"
-
Posted by jnwhiteh on Sun, 05 Dec 2010 17:31:46
I believe the typeMask actually needs to be 0x007, not 0x00F. I will update the errata, thanks.
-
Posted by skyskewz on Sun, 05 Dec 2010 17:52:18
i thank you for your responses