SendWho and SetWhoToUI Questions - WoWInterface
Thread Tools Display Modes
06-07-20, 12:56 PM   #1
A Defias Bandit
Join Date: Aug 2018
Posts: 3
Question SendWho and SetWhoToUI Questions

I'm currently working on an addon that uses Who searching. I'm looking to have this done without opening the who result window. Currently I have the following code:

GuildLeader:RegisterEvent("WHO_LIST_UPDATE", "GRAfterWho")
Perhaps I'm not fully understanding the register and unregister events. My code works and the Who search runs and I'm able to parse and manipulate the data but I've found that afterwards if I try to use /who ingame like normal it doesn't show the result or Who window.

I'm able to resolve it by opening the who window manually (pressing O) and after that my ingame /who commands work.

Is anyone able to point me in the right direction as to what I'm doing wrong? I can post more of the code if necessary or speak on Discord if that's any easier.

Thanks for any help you can provide!
  Reply With Quote
06-07-20, 01:55 PM   #2
A Pyroguard Emberseer
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,991
You need to set the frame's event handler.

Lua Code:
  1. GuildLeader:SetScript("OnEvent",function(self,event)
  2.     if event=="WHO_LIST_UPDATE" then
  3.         for i=1,C_FriendList.GetNumWhoResults() do
  4.             local info=C_FriendList.GetWhoInfo(i);
  5. --          Do something with character data in table "info"
  6.         end
  8. --      Be nice and re-register the event so "/who" still works
  9.         FriendsFrame:RegisterEvent("WHO_LIST_UPDATE")
  10.     end
  11. end);
See C_FriendList.GetWhoInfo() for the structure of the table returned containing character data.

As a side note, there are a couple misconceptions.
C_FriendList.SetWhoToUI() expects a boolean value, you're giving it a number.
GuildLeader:RegisterEvent() only takes one argument, the event you're registering.
ESOUI AddOns | 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)

Last edited by SDPhantom : 06-07-20 at 02:05 PM.
  Reply With Quote
06-07-20, 02:12 PM   #3
A Defias Bandit
Join Date: Aug 2018
Posts: 3
Thanks this was a big help, I had to tweak some other stuff but eventually got it all working. Thanks again!

Last edited by Impurity : 06-07-20 at 07:09 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SendWho and SetWhoToUI Questions

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