Thread Tools Display Modes
07/07/14, 09:37 PM   #1
Faustus
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
SetChatCategoryColor Problem

So I'm developing my first Addon that changes all of the chat colors found under Settings -> Social

I saw in the API theres a command called SetChatCategoryColor (integer category, number red, number green, number blue) that enables you to do this.

The problem I'm having is that the RGB values seem to not work. For every category, it either sets it as black or white in the Social settings. However, when I actually chat, it semi-works.

Example:

SetChatCategoryColor(2, 255, 64, 64); - Should change the yell chat color to slightly different shade of red

When I look at the social settings, the color appears as white. However, if I test the yell command it shows up as white while typing, but after entering, it appears red with the code c03fc0 infront of my text:


Is the API bugged, or is my Addon just setup wrong? My .lua file is just a series of SetChatCategoryColor calls. Also, I have my .txt file with the addon information.

Edit: According to GetChatCategoryColor() the RGB value is properly saved.

Thanks for any help

Last edited by Faustus : 07/07/14 at 10:01 PM.
  Reply With Quote
07/07/14, 10:10 PM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Functions that take separate r, g, b arguments (as oposed to hex string) work with floating-point values between 0.0 and 1.0. For example (1.0, 0.6, 0.1) is orange, (0.8, 0.8, 1.0) is soft blue (or something like it, I made the numbers up now ) Simply divide your values / 255.
  Reply With Quote
07/07/14, 10:18 PM   #3
Faustus
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
Originally Posted by merlight View Post
Functions that take separate r, g, b arguments (as oposed to hex string) work with floating-point values between 0.0 and 1.0. For example (1.0, 0.6, 0.1) is orange, (0.8, 0.8, 1.0) is soft blue (or something like it, I made the numbers up now ) Simply divide your values / 255.
That was it, thanks. Figured it out when I tried printing the default values and was getting decimals and was "wut?"
  Reply With Quote
07/07/14, 11:13 PM   #4
Faustus
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
Ok.. I think I found a legitimate API bug

Category 1 and 5 are both assigned to /say. As a result, there doesn't seem to be a way to to change the "NPC" color.
  Reply With Quote
07/08/14, 02:09 AM   #5
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by Faustus View Post
Ok.. I think I found a legitimate API bug

Category 1 and 5 are both assigned to /say. As a result, there doesn't seem to be a way to to change the "NPC" color.
As I pointed out on the original Forum, I tested it and it does not appear true on the EU server/client. And I jsut checked it on the NA server and there too UCT was fully capable to synch chat colors for the NPC chat and SAY alike.

You are a bit too fast to asume mistakes on Zenimax side. First check if you aren't making themistake yourself. It is best to show us your code so we can take a look at it.

Last edited by zgrssd : 07/08/14 at 02:12 AM.
  Reply With Quote
07/08/14, 02:45 AM   #6
Faustus
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
Originally Posted by zgrssd View Post
As I pointed out on the original Forum, I tested it and it does not appear true on the EU server/client. And I jsut checked it on the NA server and there too UCT was fully capable to synch chat colors for the NPC chat and SAY alike.

You are a bit too fast to asume mistakes on Zenimax side. First check if you aren't making themistake yourself. It is best to show us your code so we can take a look at it.
Thanks for that GetNumChatCategories(), I didn't know that was a command.

With it, I figured out "NPC" is category 41 for some reason, so this fixes my original issue.

I'm not even sure what category 5 is. I think it doesn't exist, so it defaults to 1

Ex:

SetChatCategoryColor(1,0,0,0) - say is black
SetChatCategoryColor(5, .05, .05 , .05) - category 5 doesn't exist? So it defaults to chat?

You're right it's not a bug with the API, but it's not very user friendly designed. The categories are in order of the GUI up to a certain point, then deviate, then one hugely deviates.
  Reply With Quote
07/08/14, 02:50 AM   #7
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
On a side note, storing them by thier INT index is not a good idea. If the order changes between patches this could break the assignment.
However there is a way to get internal constant names instead that allow proper mapping of Category Number and Saved Values if the order should change:
http://www.esoui.com/forums/showthread.php?t=1878

I just need to finally work that into UCT. Still using old int-based storage.
  Reply With Quote
07/08/14, 03:32 AM   #8
Faustus
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
Originally Posted by zgrssd View Post
On a side note, storing them by thier INT index is not a good idea. If the order changes between patches this could break the assignment.
However there is a way to get internal constant names instead that allow proper mapping of Category Number and Saved Values if the order should change:
http://www.esoui.com/forums/showthread.php?t=1878

I just need to finally work that into UCT. Still using old int-based storage.
Like you said in your post, The channel id from GetChatChannelId() appears to be different from the category number. For example, GetChatChannelId("zone") returns 31, but the category number for zone is 6.

Not sure how to directly get the category number.

Also, I updated the wiki with all the category numbers I determined by manually testing:
http://wiki.esoui.com/SetChatCategoryColor

Last edited by Faustus : 07/08/14 at 04:07 AM.
  Reply With Quote
07/08/14, 06:00 AM   #9
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Faustus View Post
Like you said in your post, The channel id from GetChatChannelId() appears to be different from the category number. For example, GetChatChannelId("zone") returns 31, but the category number for zone is 6.

Not sure how to directly get the category number.

Also, I updated the wiki with all the category numbers I determined by manually testing:
http://wiki.esoui.com/SetChatCategoryColor
As zgrssd said it is not a good idea to use numbers instead of global constants.

You should use for example:
Lua Code:
  1. SetChatCategoryColor(CHAT_CATEGORY_SAY, 0.5, 0.5, 0.5)

Categories are listed here:
http://wiki.esoui.com/Globals#ChatChannelCategories
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » SetChatCategoryColor Problem

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