ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Chat Categories (https://www.esoui.com/forums/showthread.php?t=1878)

zgrssd 06/29/14 11:13 PM

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?

BadVolt 06/30/14 01:24 AM

Quote:

Originally Posted by zgrssd (Post 10002)
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


zgrssd 06/30/14 02:11 AM

Quote:

Originally Posted by BadVolt (Post 10004)
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).

Garkin 06/30/14 03:45 AM

Quote:

Originally Posted by zgrssd (Post 10002)
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

zgrssd 07/08/14 03:37 AM

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).

zgrssd 07/08/14 04:51 AM

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.

Garkin 07/08/14 05:51 AM

Quote:

Originally Posted by zgrssd (Post 10315)
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

zgrssd 07/08/14 06:12 AM

Quote:

Originally Posted by Garkin (Post 10321)
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.

merlight 07/08/14 07:05 AM

Quote:

Originally Posted by zgrssd (Post 10324)
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 :D (like they did with ITEMTYPE_SCROLL for example)

Quote:

Originally Posted by zgrssd (Post 10315)
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


All times are GMT -6. The time now is 05:52 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI