View Single Post
03-27-09, 01:27 AM   #8
Freki
A Deviate Faerie Dragon
 
Freki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
Like you, I wasn't able to find an easy way to find this. Maybe it slipped past me and someone else could inform you. The only way I could figure how to it was quite messy and I'm not sure it works 100% of the time (especially with tooltip modifying addons), but from my limited testing it seems to work okay and it might give you a start.

Code:
/script faction = (GameTooltip:NumLines() > 2 and not UnitIsPlayer(select(2,GameTooltip:GetUnit()))) and getglobal("GameTooltipTextLeft"..GameTooltip:NumLines()-1):GetText() DEFAULT_CHAT_FRAME:AddMessage(faction or "NIL")
Edit: This reads straight from the GameTooltip, so it only works when you're mousing over a target. If you want unit to be "target", you'd probably have to set the GameTooltip to that unit then do this.

Last edited by Freki : 03-27-09 at 01:32 AM.
  Reply With Quote