GuiMessageVector Control Questions
by Chris Fitzgerald · in Torque Game Engine · 09/30/2007 (1:35 pm) · 4 replies
Greetings.
I've created my own chat system using a GuiMessageVector that works pretty well. I have two issues though. First, I can't seem to change the color of each line. I can do the following:
ChatMessageProfile.fontColor = "100 100 100"; (I've assigned it this profile)
But, when I change this dynamically, it changes all text. So, I looked through the code and noticed a couple things. First, I can set the allowedMatches0 field to "find" change the color of the line to matchColor (this only seems to work with "http" though). The only problem is that I can only change one color, even for multiple allowedMatches. So, this doesn't work.
I took a look at the chatHud fps example and noticed that in the profile it lists the following:
fontColor = "44 172 181";
fontColors[1] = "150 50 50";
fontColors[2] = "50 150 50";
I just can't seem to track down exactly what context fontColors[1] would be used. I thought it might be tied to the line tag in the messageVector but that doesn't seem to be the case. I've done the following:
$Client::MessageVector.pushBackLine(%message,0)
and
$Client::MessageVector.pushBackLine(%message,1)
and they both are formatted the same
Second, I noticed that when I set allowedMatches0 to "http" it underlines and formats the text like a typical link. But, there's no way to actually click on the link. I understand TorqueML quite well, so I don't have a problem using an ML control but the GuiMessageVector seems to be a bit deficient. How would I get this link to work?
I'd rather not have to merge messageVector.c and guiMLTextCtrl for something as simply as colored text in the message vector ...
Thanks for any help.
I've created my own chat system using a GuiMessageVector that works pretty well. I have two issues though. First, I can't seem to change the color of each line. I can do the following:
ChatMessageProfile.fontColor = "100 100 100"; (I've assigned it this profile)
But, when I change this dynamically, it changes all text. So, I looked through the code and noticed a couple things. First, I can set the allowedMatches0 field to "find" change the color of the line to matchColor (this only seems to work with "http" though). The only problem is that I can only change one color, even for multiple allowedMatches. So, this doesn't work.
I took a look at the chatHud fps example and noticed that in the profile it lists the following:
fontColor = "44 172 181";
fontColors[1] = "150 50 50";
fontColors[2] = "50 150 50";
I just can't seem to track down exactly what context fontColors[1] would be used. I thought it might be tied to the line tag in the messageVector but that doesn't seem to be the case. I've done the following:
$Client::MessageVector.pushBackLine(%message,0)
and
$Client::MessageVector.pushBackLine(%message,1)
and they both are formatted the same
Second, I noticed that when I set allowedMatches0 to "http" it underlines and formats the text like a typical link. But, there's no way to actually click on the link. I understand TorqueML quite well, so I don't have a problem using an ML control but the GuiMessageVector seems to be a bit deficient. How would I get this link to work?
I'd rather not have to merge messageVector.c and guiMLTextCtrl for something as simply as colored text in the message vector ...
Thanks for any help.
About the author
#2
I'd prefer to use ML text for chatting. I'll see if I can replace the messageVector with an MLText array -- hopefully that will scroll properly in a Scroll Control.
Thanks for the speedy response.
Edit: Other than some issues with scrolling to the bottom of the Scroll Control, MLText seems to be superior to a messageVector.
09/30/2007 (2:09 pm)
Yep, you're right. I traced back the starter.fps chat system and noticed they were using /c0-4 for colors. This seems to limit the ability for player's to modify the base colors. I'd prefer to use ML text for chatting. I'll see if I can replace the messageVector with an MLText array -- hopefully that will scroll properly in a Scroll Control.
Thanks for the speedy response.
Edit: Other than some issues with scrolling to the bottom of the Scroll Control, MLText seems to be superior to a messageVector.
#3
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10980
You can replace using a messageVector for chatting with a GuiMLTextCtrl which is a million times better than the messageVector.
Edit: It looks scrolling to the bottom like this is in 1.52 already with the scrollToBottom console method.
09/30/2007 (3:08 pm)
Used with this resource:http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10980
You can replace using a messageVector for chatting with a GuiMLTextCtrl which is a million times better than the messageVector.
Edit: It looks scrolling to the bottom like this is in 1.52 already with the scrollToBottom console method.
#4
09/30/2007 (4:58 pm)
I too have found that a GuiMLTextCtrl is about a million times better than GuiMessageVector.
Torque Owner Gary Preston
There are a limited number of fontColors available, off hand I can't remember how many, but if you go too far you will overwrite the highlight color. Check the source for the exact number, it's something like 8 (maybe less?).
If you're using an ML text control, then you can also embed font and colour changes using the various markup the control supports. Again reference the source for a list of the tags.