Thread Tools Display Modes
07-21-11, 03:40 PM   #1
sevenlist
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 5
How to find out the whisper-to name?

Hello everybody!

How can I find out the name of the player I reply to for usage in my macro? In this case, I want to left-klick a player in the chat to reply to him (I cannot press "r" because it's a player I haven't responded so far and I will not target him).

Last edited by sevenlist : 07-23-11 at 04:40 AM.
  Reply With Quote
07-22-11, 12:11 PM   #2
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
How do you reply to someone that has never messaged you?
  Reply With Quote
07-23-11, 04:37 AM   #3
sevenlist
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 5
You are right: It is not a reply but a whisper. So I meant following: I left-click on a player's name in the chat window to whisper to him. The chat window lets me enter a message. Instead of typing the message myself, I want to insert a personalized message with a macro, *containing the name of the player I left-clicked*. Is that possible with a macro or only with an addon? If I need to develop an addon, how do I get that player's name?

E.g.:
/run SendChatMessage("Hi <player's name>!", "WHISPER", nil, <player's name>);

Last edited by sevenlist : 07-23-11 at 04:44 AM.
  Reply With Quote
07-23-11, 05:02 AM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
/run SendChatMessage("Hi %t!", "WHISPER", nil, UnitName('target'));
  Reply With Quote
07-23-11, 05:21 AM   #5
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
You could use ChatFrame1EditBox:GetAttribute("tellTarget"), this will send a message to the current/last Whisper target.

Code:
/run SendChatMessage("My message here", "WHISPER", nil, ChatFrame1EditBox:GetAttribute("tellTarget"));

Last edited by Nibelheim : 07-23-11 at 05:23 AM.
  Reply With Quote
07-23-11, 05:56 AM   #6
sevenlist
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 5
Thank you very much for your answers!

@Nibelheim: Yippie, this was the answer I was looking for! Thanks for answering such a basic question .

@p3lim: As I wrote in my first post, I do not target the player .
  Reply With Quote
07-23-11, 06:30 AM   #7
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Suggestion, instead of:
ChatFrame1EditBox:GetAttribute("tellTarget")
You can also use:
ChatEdit_GetLastToldTarget()
^.^
  Reply With Quote
07-23-11, 06:43 AM   #8
sevenlist
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 5
Vladinator, thank you for the hint. Nomen est omen, so the function works only for the last told target.

ChatFrame1EditBox:GetAttribute("tellTarget") works also for a new whisper target which is what I need .
  Reply With Quote
07-23-11, 06:45 AM   #9
sevenlist
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 5
Nibelheim, how did you find out the name of the according attribute (tellTarget)? I was not able to find it in the API documentation. (I am taking my first steps in WoW-LUA-programming.)
  Reply With Quote
07-23-11, 12:24 PM   #10
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,324
It's managed by code in ChatFrame.lua
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to find out the reply-to-name?


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