I give up!!!
by Ian Dale · in Torque Game Engine · 01/11/2005 (7:08 am) · 6 replies
I'm trying to turn the guicrosshairhud on and off within the game. I know it has a member function setvisable(boolean). But how do I access it within the script.
I've tried guicrosshairhud.setvisable(false/true) but it don't work. I've tried playgui.guicrosshairhud.setvisable(false/true) but still don't work.
Any idea's?
Regards,
I've tried guicrosshairhud.setvisable(false/true) but it don't work. I've tried playgui.guicrosshairhud.setvisable(false/true) but still don't work.
Any idea's?
Regards,
About the author
#2
01/11/2005 (7:18 am)
But I need to do it within the script. I want the crosshair only to appear on certain objects.
#3
new GuiCrossHairHud(CrossHair) {
profile = "GuiDefaultProfile";
horizSizing = "center";
vertSizing = "center";
position = "304 224";
extent = "32 32";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./crossHair";
wrap = "0";
damageFillColor = "0.000000 1.000000 0.000000 1.000000";
damageFrameColor = "1.000000 0.600000 0.000000 1.000000";
damageRect = "50 4";
damageOffset = "0 10";
};
then simply use crosshair.setvisible(true/false). The problem I was having is that I misspelt setvisible (i had setvisable)
01/11/2005 (7:39 am)
I've fixed it. In playgui.cs define guicrosshairhud asnew GuiCrossHairHud(CrossHair) {
profile = "GuiDefaultProfile";
horizSizing = "center";
vertSizing = "center";
position = "304 224";
extent = "32 32";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./crossHair";
wrap = "0";
damageFillColor = "0.000000 1.000000 0.000000 1.000000";
damageFrameColor = "1.000000 0.600000 0.000000 1.000000";
damageRect = "50 4";
damageOffset = "0 10";
};
then simply use crosshair.setvisible(true/false). The problem I was having is that I misspelt setvisible (i had setvisable)
#4
So you have to give the control a name between the parenthesis; then you should be able to access the control using that name.
As an example, also in PlayGUI.gui you have:
and so you can access this control in script using the name "BottomPrintText". In PlayGUI.cs there is some code that manipulates this control:
So if you give the GuiCrosshairHUD a name you should be able to do the setvisible() in script.
Edit: ah well, posted a little late! Still good info, I guess.
01/11/2005 (7:42 am)
I think that in order to access a specific GUI element you have to give it a name. By default, the GUICrosshairHUD doesn't have a name. Looking in PlayGUI.gui you have something like:new GuiCrossHairHud( [PUT NAME HERE] ) {So you have to give the control a name between the parenthesis; then you should be able to access the control using that name.
As an example, also in PlayGUI.gui you have:
new GuiMLTextCtrl(BottomPrintText)
and so you can access this control in script using the name "BottomPrintText". In PlayGUI.cs there is some code that manipulates this control:
function refreshBottomTextCtrl()
{
BottomPrintText.position = "0 0";
}So if you give the GuiCrosshairHUD a name you should be able to do the setvisible() in script.
Edit: ah well, posted a little late! Still good info, I guess.
#5
01/11/2005 (7:49 am)
Thanks.
#6
01/11/2005 (7:49 am)
Yup, it was good info.
Torque 3D Owner Ted Southard