GUI/ChatHud
From TDN
Implementation
For implementation of chat GUI, see the sample.fps/client/ui/chatHud.gui and sample.fps/client/scripts/chatHud.cs.
Chat is driven by the function onServerMessage() or onChatMessage(), which contains chat data received from the server. This is in turn called by the functions clientCmdChatMessage() and clientCmdServerMessage() in common/client/message.cs.
The data is stored in the "message vector" class; the function of the chat GUI is to display that vector.
How to Remove Chat
Ok this is the first time that im contributing so i might have a few mistakes.
to get rid of the GUI Chatbox, i just simply changed the source .gui file chatHud.gui by copying a new file and replacing the old chathud file
note: it might be easier to just cut out the lines that are commented out
note: or, even better, remove the loading of the chat files entirely; search for the exec of the chat files in the script source and take them out
The Source
// Chat edit window
new GuiControl(MessageHud)
{
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "0";
noCursor = true;
new GuiControl(MessageHud_Frame) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "400 40";
minExtent = "8 8";
visible = "1";
new GuiBitmapCtrl() {
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "height";
position = "8 8";
extent = "384 24";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./hudfill.png";
wrap = "0";
};
new GuiTextCtrl(MessageHud_Text)
{
profile = "ChatHudTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "14 12";
extent = "10 22";
minExtent = "8 8";
visible = "1";
};
new GuiTextEditCtrl(MessageHud_Edit)
{
profile = "ChatHudEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 13";
extent = "10 22";
minExtent = "8 8";
visible = "1";
altCommand = "$ThisControl.eval();";
escapeCommand = "MessageHud_Edit.onEscape();";
historySize = "5";
maxLength = "120";
};
};
};
//--- OBJECT WRITE BEGIN ---
new GuiControl(MainChatHud) {
profile = "GuiModelessDialogProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
noCursor = "1";
// new GuiBitmapCtrl(chatport) {
// profile = "GuiDefaultProfile";
// horizSizing = "right";
// vertSizing = "top";
// position = "5 50";
// extent = "240 50";
// minExtent = "8 8";
// visible = "0";
// helpTag = "0";
// bitmap = "./hudfill";
// new GuiMLTextCtrl(chatname) {
//// profile = "NewChatHudMLProfile2";
// horizSizing = "right";
// vertSizing = "bottom";
// position = "0 45";
// extent = "112 28";
// minExtent = "8 8";
// visible = "1";
// helpTag = "0";
// lineSpacing = "1";
// allowColorChars = "1";
// maxChars = "-1";
// };
// new GuiBitmapCtrl(chatportrait) {
// profile = "GuiDefaultProfile";
// horizSizing = "right";
// vertSizing = "bottom";
// position = "5 5";
// extent = "40 40";
// minExtent = "8 8";
// visible = "1";
// helpTag = "0";
// bitmap = "./redelf.png";
// wrap = "0";
// };
// new GuiMLTextCtrl(chattext) {
// profile = "NewChatHudMLProfile";
// horizSizing = "right";
// vertSizing = "bottom";
// position = "50 5";
// extent = "190 40";
// minExtent = "8 8";
// visible = "1";
// helpTag = "0";
// lineSpacing = "1";
// allowColorChars = "1";
// maxChars = "-1";
// };
// };
new GuiControl() {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "top";
position = "0 235";
extent = "400 300";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiControl(OuterChatHud) {
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "0 0";
extent = "272 88";
minExtent = "8 8";
visible = "0";
helpTag = "0";
new GuiButtonCtrl(chatPageDown) {
profile = "GuiButtonProfile";
horizSizing = "left";
vertSizing = "top";
position = "220 58";
extent = "36 14";
minExtent = "8 8";
visible = "0";
helpTag = "0";
text = "Dwn";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiScrollCtrl(ChatScrollHud) {
profile = "ChatHudScrollProfile";
horizSizing = "width";
vertSizing = "height";
position = "8 8";
extent = "256 72";
minExtent = "8 8";
visible = "1";
helpTag = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "alwaysOff";
constantThumbHeight = "0";
childMargin = "0 0";
new GuiMessageVectorCtrl(ChatHud) {
profile = "NewChatHudMessageProfile";
horizSizing = "width";
vertSizing = "height";
position = "1 1";
extent = "252 16";
minExtent = "8 8";
visible = "1";
helpTag = "0";
lineSpacing = "0";
lineContinuedIndex = "10";
allowedMatches[0] = "http";
allowedMatches[1] = "tgeserver";
matchColor = "0 0 255 255";
maxColorIndex = "5";
};
};
};
};
};
//--- OBJECT WRITE END ---
$NUM_PORTRAITS = 5;
for (%i = 0; %i<$NUM_PORTRAITS; %i++)
{
%chatPos = "5 " @ (%i*55+40);
%chatPort = new GuiBitmapCtrl("chatport" @ %i) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = %chatPos;
extent = "280 45";
minExtent = "8 8";
visible = "0";
helpTag = "0";
bitmap = "./hudfill";
new GuiBitmapCtrl("chatportrait" @ %i) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 5";
extent = "35 35";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./redelf.png";
wrap = "0";
};
new GuiMLTextCtrl("chattext" @ %i) {
profile = "NewChatHudMLProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "45 5";
extent = "230 35";
minExtent = "8 8";
visible = "1";
helpTag = "0";
lineSpacing = "1";
allowColorChars = "1";
maxChars = "-1";
};
};
MainChatHud.add(%chatPort);
} //end for loop
Sorry its very messy, hopefully it will come in useful to someone.
Categories: TGE | GUI



