Thread Tools Display Modes
10-09-08, 05:01 PM   #1
Mukura
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 4
How to create a hyperlink on a player?

Hi there!

Does anyone know how i can create a clickable hyperlink on a player just like they are in chat messages?

Thanks for your help.
  Reply With Quote
10-10-08, 06:14 PM   #2
Cirk
A Cobalt Mageweaver
 
Cirk's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 226
Format for player links is:
Code:
|Hplayer:<playername>:<chatlinenumber>|h[<playername>|h
(Yep, no trailing |r).

If you hook the SetItemRef function and "replace" its normal player link handling code, you'd probably be able to paste a player name as a hotlink in chat/etc. BUT, I don't know if the server will carry this information (it may strip it like it does for links in chat channels, or it may DC you!)

-- Cirk
__________________
Cirk's Addons
  Reply With Quote
10-11-08, 10:23 AM   #3
Mukura
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 4
Thanks a lot!

I use it in displaying a string using DEFAULT_CHAT_FRAME:AddMessage("string"). What I actually want to do, is creating "fake" guild and party messages, that appear to the user just like real ones but are not actually sent into the guild channel so that only addon users will receive the message.

In this case
Code:
local playerlink = "|Hplayer:"..<player>.."|h["..<player>.."]|h";
worked fine for me.
  Reply With Quote
10-11-08, 12:46 PM   #4
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
Originally Posted by Cirk View Post
Format for player links is:
[code]If you hook the SetItemRef function and "replace" its normal player link handling code, you'd probably be able to paste a player name as a hotlink in chat/etc. BUT, I don't know if the server will carry this information (it may strip it like it does for links in chat channels, or it may DC you!)
Be very careful in doing this, as, while hooking SetItemRef is useful (I know several addons that do it), it also causes a taint which makes it impossible to shift-click a user's name into a GM ticket and send it.

A minor thing, but just warning you in case you get bug reports in the near future that are difficult to track down.
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to create a hyperlink on a player?


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