Thread Tools Display Modes
06/29/14, 11:13 PM   #1
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Chat Categories

Somebody once made a partial list wich Chat Category Number (from the API) related to wich Category in the chat.
I am unable to remember where I saw it. Anybody knowing this so I can work the data into the Wiki?
  Reply With Quote
06/30/14, 01:24 AM   #2
BadVolt
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 74
Originally Posted by zgrssd View Post
Somebody once made a partial list wich Chat Category Number (from the API) related to wich Category in the chat.
I am unable to remember where I saw it. Anybody knowing this so I can work the data into the Wiki?
You can do it by yourself.
Ie

Get zone channel ID
Lua Code:
  1. GetChatChannelId("zone")

Get Dynamic chat id:
Lua Code:
  1. local function GetChatId()
  2.     -- search for 100 channels
  3.     for i=1,100 do
  4.         local name=GetDynamicChatChannelName(i)
  5.         if name==GuildName then return i end
  6.     end
  7.     return false
  8. end

Or here's dump from 100007
Code:
CHAT_CHANNEL_EMOTE = 6
CHAT_CHANNEL_GUILD_1 = 12
CHAT_CHANNEL_GUILD_2 = 13
CHAT_CHANNEL_GUILD_3 = 14
CHAT_CHANNEL_GUILD_4 = 15
CHAT_CHANNEL_GUILD_5 = 16
CHAT_CHANNEL_MONSTER_EMOTE = 10
CHAT_CHANNEL_MONSTER_SAY = 7
CHAT_CHANNEL_MONSTER_WHISPER = 9
CHAT_CHANNEL_MONSTER_YELL = 8
CHAT_CHANNEL_OFFICER_1 = 17
CHAT_CHANNEL_OFFICER_2 = 18
CHAT_CHANNEL_OFFICER_3 = 19
CHAT_CHANNEL_OFFICER_4 = 20
CHAT_CHANNEL_OFFICER_5 = 21
CHAT_CHANNEL_PARTY = 3
CHAT_CHANNEL_SAY = 0
CHAT_CHANNEL_SYSTEM = 11
CHAT_CHANNEL_UNUSED_1 = 5
CHAT_CHANNEL_USER_CHANNEL_1 = 22
CHAT_CHANNEL_USER_CHANNEL_2 = 23
CHAT_CHANNEL_USER_CHANNEL_3 = 24
CHAT_CHANNEL_USER_CHANNEL_4 = 25
CHAT_CHANNEL_USER_CHANNEL_5 = 26
CHAT_CHANNEL_USER_CHANNEL_6 = 27
CHAT_CHANNEL_USER_CHANNEL_7 = 28
CHAT_CHANNEL_USER_CHANNEL_8 = 29
CHAT_CHANNEL_USER_CHANNEL_9 = 30
CHAT_CHANNEL_WHISPER = 2
CHAT_CHANNEL_WHISPER_SENT = 4
CHAT_CHANNEL_YELL = 1
CHAT_CHANNEL_ZONE = 31
CHAT_CHANNEL_ZONE_LANGUAGE_1 = 32
CHAT_CHANNEL_ZONE_LANGUAGE_2 = 33
CHAT_CHANNEL_ZONE_LANGUAGE_3 = 34

Last edited by BadVolt : 06/30/14 at 01:30 AM.
  Reply With Quote
06/30/14, 02:11 AM   #3
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by BadVolt View Post
You can do it by yourself.
Ie

Get zone channel ID
Lua Code:
  1. GetChatChannelId("zone")

Get Dynamic chat id:
Lua Code:
  1. local function GetChatId()
  2.     -- search for 100 channels
  3.     for i=1,100 do
  4.         local name=GetDynamicChatChannelName(i)
  5.         if name==GuildName then return i end
  6.     end
  7.     return false
  8. end
I get what you tried to do there. Only the order and the actuall code seems a bit odd.

I will try it with this code later, when I am at my client:
Code:
local function dumpCatageoryNames()
    local result = { }

    for i=1, GetNumChatCtagoeries(), 1 do
      result[i] = { ID = i, name= GetDynamicChatChannelName(i) }
    end

    return result
end
That also means I can now rework UTC to use those constats to save and assign the Categories instead of the numbers (wich could have caused issues if the Order changed between API versions).
  Reply With Quote
06/30/14, 03:45 AM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by zgrssd View Post
Somebody once made a partial list wich Chat Category Number (from the API) related to wich Category in the chat.
I am unable to remember where I saw it. Anybody knowing this so I can work the data into the Wiki?
If you want to get channel category, you can use:
Lua Code:
  1. local channelInfo = ZO_ChatSystem_GetChannelInfo()
  2. for channel in pairs(channelInfo) do
  3.    local category = GetChannelCategoryFromChannel(_G[channel])
  4.    d("Channel: "..channel..", category: "..category)
  5. end
  Reply With Quote
07/08/14, 03:37 AM   #5
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
The constant names can be found in the global table under "zz OTHER CONSTS". Unfortunatley they are jsut put there right next to groups of cosntants (no seperation by constant types).
Going over every entry in the global table and only extracting those that start with "CHAT_CATEGORY_" might be an option.
And I also need to make sure to get the Cateogry numbers, not the Channel Numbers (different things).
  Reply With Quote
07/08/14, 04:51 AM   #6
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Perhaps to make my problem better undersood. What I have right now is:
(Name in the constants table) = (ChatCategoryID)
CHAT_CATEGORY_SAY = 1
CHAT_CATEGORY_YELL = 2
CHAT_CATEGORY_WHISPER_INCOMING = 3
CHAT_CATEGORY_WHISPER_OUTGOING = 4
With the names being constants I would have to change on API version change.

What I need is:
(ChatCategoryID) = (Name used in the constants table)
1 = CHAT_CATEGORY_SAY
2 = CHAT_CATEGORY_YELL
3 = CHAT_CATEGORY_WHISPER_INCOMING
4 = CHAT_CATEGORY_WHISPER_OUTGOING
With the values being read out at each launch of the UI.

With the added issue that apparently the 3 "CHAT_CATEGORY_HEADER" entries use the same numbers as one other category (I asume those are deprecated/not interesting for my cocerns).
So I must now include all values that start with "CHAT_CATEGORY_" but must exclude all that start with "CHAT_CATEGORY_HEADER_".
It's just like the whole Leap Year calculation all over again, just with strings.
  Reply With Quote
07/08/14, 05:51 AM   #7
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by zgrssd View Post
Perhaps to make my problem better undersood. What I have right now is:
(Name in the constants table) = (ChatCategoryID)
CHAT_CATEGORY_SAY = 1
CHAT_CATEGORY_YELL = 2
CHAT_CATEGORY_WHISPER_INCOMING = 3
CHAT_CATEGORY_WHISPER_OUTGOING = 4
With the names being constants I would have to change on API version change.

What I need is:
(ChatCategoryID) = (Name used in the constants table)
1 = CHAT_CATEGORY_SAY
2 = CHAT_CATEGORY_YELL
3 = CHAT_CATEGORY_WHISPER_INCOMING
4 = CHAT_CATEGORY_WHISPER_OUTGOING
With the values being read out at each launch of the UI.

With the added issue that apparently the 3 "CHAT_CATEGORY_HEADER" entries use the same numbers as one other category (I asume those are deprecated/not interesting for my cocerns).
So I must now include all values that start with "CHAT_CATEGORY_" but must exclude all that start with "CHAT_CATEGORY_HEADER_".
It's just like the whole Leap Year calculation all over again, just with strings.
So you probably want something like:
Lua Code:
  1. local channelTable = {}
  2.  
  3. for key, value in zo_insecurePairs(_G) do
  4.    if (key):find("^CHAT_CATEGORY_") and not (key):find("HEADER") then
  5.       channelTable[value] = key
  6.    end
  7. end
  Reply With Quote
07/08/14, 06:12 AM   #8
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by Garkin View Post
So you probably want something like:
Lua Code:
  1. local channelTable = {}
  2.  
  3. for key, value in zo_insecurePairs(_G) do
  4.    if (kepy):find("^CHAT_CATEGORY_") and not (key):find("HEADER") then
  5.       channelTable[value] = key
  6.    end
  7. end
Looks like actually going over the entire global table is the only way to get those.
Found the documentation for find/attern:
http://lua-users.org/wiki/PatternsTutorial

The ^ makes certain only the start of the string is checked (improoving performance). Have to test that code when I am home again.
  Reply With Quote
07/08/14, 07:05 AM   #9
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by zgrssd View Post
The ^ makes certain only the start of the string is checked (improoving performance). Have to test that code when I am home again.
Improved performance is a side-effect, the important thing about ^ is that it anchors the match at the start of the string; without it, "MY_CUSTOM_CHAT_CATEGORY_WOULD_MATCH_TOO".
Now you only need to worry about them changing constant names (like they did with ITEMTYPE_SCROLL for example)

Originally Posted by zgrssd View Post
With the added issue that apparently the 3 "CHAT_CATEGORY_HEADER" entries use the same numbers as one other category (I asume those are deprecated/not interesting for my cocerns).
So I must now include all values that start with "CHAT_CATEGORY_" but must exclude all that start with "CHAT_CATEGORY_HEADER_".
Indeed they're not interesting for you, they're only references to chat categories, points where chat options UI inserts headers.
Lua Code:
  1. [SI_CHATCHANNELCATEGORYHEADERS1] = "Channels",
  2. [SI_CHATCHANNELCATEGORYHEADERS10] = "Guilds",
  3. [SI_CHATCHANNELCATEGORYHEADERS45] = "Combat", -- options end before this one
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Chat Categories


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