NPC ID macro issues

Forum rules
Treat others with respect. Report, don't respond. Read the complete forum rules.
User avatar
Wain
The Insane
The Insane
Posts: 13515
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

NPC ID macro issues

Unread post by Wain »

As you may already know, the macro we've traditionally used for determining the NPC ID of beasts isn't working in the beta.

Since we'll really need this for cataloging beasts, I've posted here:
http://us.battle.net/wow/en/forum/topic/13348184978#1

Hopefully someone has some insight into macros and can help. But maybe we just have to wait.
Shaman avatar by Spiritbinder.
Xota
 Community Resource
 Community Resource
Posts: 1084
Joined: Sat Sep 18, 2010 3:08 pm
Realm: Ner'zhul (US)

Re: NPC ID macro issues

Unread post by Xota »

Without being able to make a lua call, I can't think of any way for a macro to look up the GUID. I doubt it will work, if all all scripting is disabled, but you could try:

Code: Select all

/dump tonumber((UnitGUID("target")):sub(-13, -9), 16)
The combat log probably doesn't have GUID info, but it's worth looking at.
Finally, you might have to rely on name and then looking it up on a 3rd party site like wowhead.
User avatar
Wain
The Insane
The Insane
Posts: 13515
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: NPC ID macro issues

Unread post by Wain »

OK thank you :) I'll try that tonight!
Shaman avatar by Spiritbinder.
User avatar
Wain
The Insane
The Insane
Posts: 13515
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: NPC ID macro issues

Unread post by Wain »

Sadly /dump doesn't seem to be doing anything on the beta, but it was a good thought. Thanks again :)
Shaman avatar by Spiritbinder.
Xota
 Community Resource
 Community Resource
Posts: 1084
Joined: Sat Sep 18, 2010 3:08 pm
Realm: Ner'zhul (US)

Re: NPC ID macro issues

Unread post by Xota »

Addons are supposedly enabled, which means scripting probably is too. /run and /dump should both now work, either in macro or manually typed in.
User avatar
Wain
The Insane
The Insane
Posts: 13515
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: NPC ID macro issues

Unread post by Wain »

Oh that's great to know! Thanks :)
Shaman avatar by Spiritbinder.
User avatar
Wain
The Insane
The Insane
Posts: 13515
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: NPC ID macro issues

Unread post by Wain »

The existing MoP macro: /run print("Target NPC ID:", tonumber((UnitGUID("target")):sub(-13, -9), 16))

...is returning 'nil' for all NPC IDs currently, but at least it runs.

Unfortunately the beta seems too unstable to bother experimenting at the moment. I experience it crashing in less than two mins of login, on multiple toons :/
Shaman avatar by Spiritbinder.
Xota
 Community Resource
 Community Resource
Posts: 1084
Joined: Sat Sep 18, 2010 3:08 pm
Realm: Ner'zhul (US)

Re: NPC ID macro issues

Unread post by Xota »

I suggest /dump UnitGUID("target") on a (non-tamed) npc you know the ID of, to see if the formatting of GUIDs have changed.
User avatar
Wain
The Insane
The Insane
Posts: 13515
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: NPC ID macro issues

Unread post by Wain »

Thanks :) Yeah, that's what I had to do when it changed in MoP. But the beta was so unstable today I just gave up trying to get anything out of it :/
Shaman avatar by Spiritbinder.
User avatar
Xella
Artisan Hunter
Artisan Hunter
Posts: 681
Joined: Mon Mar 14, 2011 11:53 pm
Realm: Skywall-US
Gender: Female
Contact:

Re: NPC ID macro issues

Unread post by Xella »

Not sure that it'll help since I can't pull the matching live data (live servers just went down for 12h maintenance) but dumping Matron Vi Vinh in Shrine of Seven Stars (ID 64149) on beta results in the following:

Code: Select all

Dump: value=UnitGUID("target")
[1]="Creature:0:971:870:3:64149:00004DE8C4"
So at least the UID _is_ still in there, haha.
Current main: Xella-Skywall | Art Stuffs | Brains.
User avatar
Wain
The Insane
The Insane
Posts: 13515
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: NPC ID macro issues

Unread post by Wain »

OK this seems to work now:

/run print("Target NPC ID:", tonumber(UnitGUID("target"):sub(-16, -12)))
Shaman avatar by Spiritbinder.
Xota
 Community Resource
 Community Resource
Posts: 1084
Joined: Sat Sep 18, 2010 3:08 pm
Realm: Ner'zhul (US)

Re: NPC ID macro issues

Unread post by Xota »

Wain wrote:OK this seems to work now:

/run print("Target NPC ID:", tonumber(UnitGUID("target"):sub(-16, -12)))
That may not work, especially if it doesn't show leading zeros in the new GUID format.

/run print("Target NPC ID:", strmatch(UnitGUID("target"),":(%d*):%x*$"))
This will return the digits between the penultimate and last colon (assuming the characters trailing the last colon are hexdecimal). It will work even for NPCs with an ID 9999 or lower and 100000 and higher.
User avatar
Wain
The Insane
The Insane
Posts: 13515
Joined: Tue Jul 27, 2010 1:54 am
Gender: Male

Re: NPC ID macro issues

Unread post by Wain »

Damn, I missed this. You are completely right, the GUID format isn't composed of consistent string lengths. Thanks for the improved version!
Shaman avatar by Spiritbinder.
Locked