Thread Tools Display Modes
07/09/21, 06:46 AM   #1
maximoz
AddOn Author - Click to view addons
Join Date: Sep 2019
Posts: 4
Get character name from whisper

Hi,

Is there a way to find out the character name for someone who whisper me? So far the EVENT_CHAT_MESSAGE_CHANNEL returns both @account name for the fromName and fromDisplayName even tho the wiki states fromName is suppose to be character name?

https://wiki.esoui.com/EVENT_CHAT_MESSAGE_CHANNEL

Thanks!
  Reply With Quote
07/09/21, 10:26 AM   #2
Shadowfen
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 83
Not really. The only way to get the character name from a whisper is if the whisperer is in a group or a guild with you. You can use the group or guild to find out the character name from the account name.
  Reply With Quote
07/09/21, 11:10 AM   #3
M0R
AddOn Author - Click to view addons
Join Date: Apr 2020
Posts: 4
If you wish to display it to the user, I believe you can pipe the @ name into ZO_LinkHandler_CreatePlayerLink and that will create a link to the player, which you then may be able to retrieve character name from? either that or maybe zo_strformat("<<1>>", player)

I have no idea if this works, this is just how I saw Kill counter do it, but they are calling from an event, so idk
  Reply With Quote
07/09/21, 11:39 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
zo_strformat("<<1>>", player) is just removing any special gender suffix ^f e.g. at the end of the character name.
And I guess the ZO_LinkHandler will just use the @displayName in the link and if you click it use the @displayName as well.
As you can see here:
https://github.com/esoui/esoui/blob/...ndler.lua#L100

Lua Code:
  1. function ZO_LinkHandler_CreatePlayerLink(displayOrCharacterName)
  2.     if(IsDecoratedDisplayName(displayOrCharacterName)) then
  3.         return ZO_LinkHandler_CreateDisplayNameLink(displayOrCharacterName)
  4.     else
  5.         return ZO_LinkHandler_CreateCharacterLink(displayOrCharacterName)
  6.     end
  7. end
It would be using ZO_LinkHandler_CreateDisplayNameLink then as the @ is given in the name.

Afai found out Shadowfen is completely correct here.
You would need any kind of "lookup" tables which are given if you are in the same group/guild.
Else you'd have to build and safe your own lookup tables for the server and enhance it each time someone writs with a charactername in chat.
And I would not recommand doing/building such a big table. It will grow your SavedVariables and make every loading screen slow after a short time already, as the filesize would grow constantly and would need a transfer to file/read from file on each reloadui/zone change/login/logout.

Last edited by Baertram : 07/09/21 at 11:43 AM.
  Reply With Quote
07/09/21, 10:10 PM   #5
maximoz
AddOn Author - Click to view addons
Join Date: Sep 2019
Posts: 4
Thnak you all for the insight.

Much appreciated!
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Get character name from whisper

Thread Tools
Display Modes

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