Chat gui that makes sense?
by Richard Preziosi · in Torque Game Engine · 11/06/2009 (12:52 am) · 5 replies
Does anyone have a chat gui that actually makes sense and is completely editable?
The way the current one is MainChatHud and MessageHud are one file, but load up as two files, which makes aligning them to a visual element almost impossible, not to mention if you want the element to be moveable this creates a whole new problem. You would think, ok no problem, i'll just combine them and have MessageHud, which is what is toggled with "u" and "y", be a child of ChatHud or a new GuiFile, but that's not going to work, because as soon as you press "u" or "y" it's going to dynamically seperate them again into two different guicontrols.
Also as it is the messageHud is immoveable, I can move it around all I want, but everytime i use it is slowly inches it's way back up to it's original position after about 2 or three uses.
So I guess the real question here is, does anyone know how to properly combine chathud and messagehud gui elements into one file and have them stay that way, so that I can actually make a gui for them.
The way the current one is MainChatHud and MessageHud are one file, but load up as two files, which makes aligning them to a visual element almost impossible, not to mention if you want the element to be moveable this creates a whole new problem. You would think, ok no problem, i'll just combine them and have MessageHud, which is what is toggled with "u" and "y", be a child of ChatHud or a new GuiFile, but that's not going to work, because as soon as you press "u" or "y" it's going to dynamically seperate them again into two different guicontrols.
Also as it is the messageHud is immoveable, I can move it around all I want, but everytime i use it is slowly inches it's way back up to it's original position after about 2 or three uses.
So I guess the real question here is, does anyone know how to properly combine chathud and messagehud gui elements into one file and have them stay that way, so that I can actually make a gui for them.
#2
11/06/2009 (1:26 am)
Hmm it seems to also be impossible to actually resize the ChatHud message vector, you can resize it, but it never becomes permanent, as soon as you f10 out it goes right back to the original size, even if you save it. Have tried resizing everything inside the control, to no avail.
#3
I'm not understanding, did some new guy write the chathud/messagehud code or something, cause it's behavior makes no damn sense.
I did find however in messagehud.cs a %windowPos and %windowExt, which means we are setting the pos and ext twice, what is the reasoning behind this?
Edit: Even if I delete the guiBitmapCtrl from the chathud.gui after i add it still leaves everything broken. How hard coded is this chathud/messagehud that comes with starter.fps into the engine that it scews with everything if you even look at it wrong?
Edit again: Even changing the bitmap control that is already there from hudfill.png to anything else breaks the nocursor. This is getting ridiculous.
11/06/2009 (7:13 pm)
Anyone know why adding a guiBitmapCtrl to the chathud.gui, causes it to break the mouse support and show the cursor no matter what I have set in playgui?I'm not understanding, did some new guy write the chathud/messagehud code or something, cause it's behavior makes no damn sense.
I did find however in messagehud.cs a %windowPos and %windowExt, which means we are setting the pos and ext twice, what is the reasoning behind this?
Edit: Even if I delete the guiBitmapCtrl from the chathud.gui after i add it still leaves everything broken. How hard coded is this chathud/messagehud that comes with starter.fps into the engine that it scews with everything if you even look at it wrong?
Edit again: Even changing the bitmap control that is already there from hudfill.png to anything else breaks the nocursor. This is getting ridiculous.
#4
11/06/2009 (11:34 pm)
So removing the %windowPos and %windowExt causes multiple MessageHuds to be added to chathud.gui, and also causes the MainChatHud in chathud.gui to be deleted. This just keeps getting better and better.
#5
Having done this I can then remove the %windows from the messagehud.cs. So the brunt of the woes are out of the way.
I can position things to line up correctly now. My last problem is, that in game i cannot let the player move the chat hud, because it has to be three seperate elements which I can't figure out how to tie together.
So I guess my last question now is, is there a way to tie elements that are in seperate guis together? Seems like I should be able to, in the position something like "position = "0 0" @ ( chathudbackground );" ofcourse that's not gonna work, maybe someone can help me.
Thanks
11/07/2009 (4:19 am)
ok I made a little progress. I seperated the messagehud code from the chatgud.gui and put into it's it's own seperate gui file, messagehud.gui, after 3 or 4 times it will duplicate itself because of the messagehud.cs, after this you can remove the duplication. After the first duplication it never does it again, tested it about 12 times after the first duplication.Having done this I can then remove the %windows from the messagehud.cs. So the brunt of the woes are out of the way.
I can position things to line up correctly now. My last problem is, that in game i cannot let the player move the chat hud, because it has to be three seperate elements which I can't figure out how to tie together.
So I guess my last question now is, is there a way to tie elements that are in seperate guis together? Seems like I should be able to, in the position something like "position = "0 0" @ ( chathudbackground );" ofcourse that's not gonna work, maybe someone can help me.
Thanks
Torque Owner Richard Preziosi
WinterLeaf Entertainment
//----------------------------------------------------------------------------- // Torque Game Engine // Copyright (C) GarageGames.com, Inc. //----------------------------------------------------------------------------- //---------------------------------------------------------------------------- // Enter Chat Message Hud //---------------------------------------------------------------------------- //------------------------------------------------------------------------------ function MessageHud::open(%this) { %offset = 6; if(%this.isVisible()) return; if(%this.isTeamMsg) %text = "TEAM:"; else %text = "GLOBAL:"; MessageHud_Text.setValue(%text); %windowPos = "0 " @ ( getWord( outerChatHud.position, 1 ) + getWord( outerChatHud.extent, 1 ) + 1 ); %windowExt = getWord( OuterChatHud.extent, 0 ) @ " " @ getWord( MessageHud_Frame.extent, 1 ); %textExtent = getWord(MessageHud_Text.extent, 0) + 14; %ctrlExtent = getWord(MessageHud_Frame.extent, 0); Canvas.pushDialog(%this); messageHud_Frame.position = %windowPos; messageHud_Frame.extent = %windowExt; MessageHud_Edit.position = setWord(MessageHud_Edit.position, 0, %textExtent + %offset); MessageHud_Edit.extent = setWord(MessageHud_Edit.extent, 0, %ctrlExtent - %textExtent - (2 * %offset)); %this.setVisible(true); deactivateKeyboard(); MessageHud_Edit.makeFirstResponder(true); } //------------------------------------------------------------------------------ function MessageHud::close(%this) { if(!%this.isVisible()) return; Canvas.popDialog(%this); %this.setVisible(false); if ( $enableDirectInput ) activateKeyboard(); MessageHud_Edit.setValue(""); } //------------------------------------------------------------------------------ function MessageHud::toggleState(%this) { if(%this.isVisible()) %this.close(); else %this.open(); } //------------------------------------------------------------------------------ function MessageHud_Edit::onEscape(%this) { MessageHud.close(); } //------------------------------------------------------------------------------ function MessageHud_Edit::eval(%this) { %text = trim(%this.getValue()); if(%text !$= "") { if(MessageHud.isTeamMsg) commandToServer('teamMessageSent', %text); else commandToServer('messageSent', %text); } MessageHud.close(); } //---------------------------------------------------------------------------- // MessageHud key handlers function toggleMessageHud(%make) { if(%make) { MessageHud.isTeamMsg = false; MessageHud.toggleState(); } } function teamMessageHud(%make) { if(%make) { MessageHud.isTeamMsg = true; MessageHud.toggleState(); } }