Thread Tools Display Modes
04/23/14, 02:41 AM   #1
Asto
 
Asto's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
Chat Event with wrong parameters in api docs?

Hello,

i've developed a few smaller WoW AddOns years ago and now wanted to start with ESO again. While fooling around with the API, i guess i found a few mistakes:

EVENT_CHAT_MESSAGE_CHANNEL (integer messageType, string fromName, string text)
is wrong. I get more parameters in my event handler function, sth like

EVENT_CHAT_MESSAGE_CHANNEL (integer messageType, integer channelId, string fromName, string text)

Another thing i found out: The channelId values slightly differ from the wiki page Raw_globals_dump. While CHAT_CHANNEL_ZONE is correctly 31 in my handler, the guild chat channelIds seem to be different.
CHAT_CATEGORY_GUILD_1 is 12 instead of 10,
CHAT_CATEGORY_GUILD_2 is 13 instead of 11
(couldn't test more)

Can anyone confirm this?

Last edited by Asto : 04/23/14 at 03:11 AM.
  Reply With Quote
04/23/14, 02:52 AM   #2
archpoet
Cunning Linguist
 
archpoet's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 19
Afaik when you provide a callback to that event, *that* function gets the following args passed along:

(integer eventCode, integer messageType, string fromName, string text)

messageType *should* actually be the channelId
and eventCode is actually unique* for that specific channel (messageType)

...hence the discrepancy between 10 vs 12 for category vs. event.


Last edited by archpoet : 04/23/14 at 02:53 AM. Reason: omitted word.
  Reply With Quote
04/23/14, 03:00 AM   #3
Asto
 
Asto's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
ah i see... the eventCode confused me because it didn't show up in the api and i didn't know messageType should be the channelId - okay

thanks!
  Reply With Quote
04/23/14, 03:01 AM   #4
archpoet
Cunning Linguist
 
archpoet's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 19
My pleasure, happy to help!
  Reply With Quote
04/23/14, 01:25 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Let's compare methods between WoW and ESO so that you can get your bearings.

In WoW:
Lua Code:
  1. local f = CreateFrame("Frame", nil, UIParent)
  2. f:RegisterEvent("ADDON_LOADED")
  3. f:SetScript("OnEvent", function(self, event, addon)
  4.      if addon == "MyAddon" then
  5.           --do stuff
  6.      end
  7. end)

In ESO:
Lua Code:
  1. local f = CreateTopLevelWindow("MyAddonFrame")
  2. f:RegisterForEvent(EVENT_ADD_ON_LOADED, function(event, addon)
  3.      if addon == "MyFrame" then
  4.           --do stuff
  5.      end
  6. end)

or, you can do it this way in ESO (register your event through the game's EVENT_MANAGER instead of through a frame)
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("MyAddon", EVENT_ADD_ON_LOADED, function(event, addon)
  2.      if addon == "MyAddon" then
  3.           --do stuff
  4.      end
  5. end)

As you can see, both WoW and ESO pass the event name/code through the event handler before the args that come with the event.
  Reply With Quote
04/24/14, 12:00 AM   #6
Vuelhering
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 169
Originally Posted by Asto View Post
Another thing i found out: The channelId values slightly differ from the wiki page Raw_globals_dump. While CHAT_CHANNEL_ZONE is correctly 31 in my handler, the guild chat channelIds seem to be different.
CHAT_CATEGORY_GUILD_1 is 12 instead of 10,
CHAT_CATEGORY_GUILD_2 is 13 instead of 11
(couldn't test more)

Can anyone confirm this?
The raw globals dump will change (somewhat) every patch. Certainly, many functions will move, but it would make sense that some globals might change. This is why it's a good idea to future-proof by using the variables, and not hard-code it with magic numbers.
  Reply With Quote
04/24/14, 04:12 AM   #7
Asto
 
Asto's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
thank you seerah
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » API Docu mistakes?

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