Game Development Community

T3D 1.1 Beta 3 - GuiConsoleTextCtrl Problem - Not a bug

by Matt Huston · in Torque 3D Professional · 11/04/2010 (9:14 pm) · 5 replies

Not sure if I am using this correctly as I never actually used this particular control before but thought it was a good idea for showing velocity on screen.

new GuiConsoleTextCtrl() {
         canSaveDynamicFields = "0";
         Profile = "GuiDefaultProfile";
         HorizSizing = "right";
         VertSizing = "bottom";
         position = "0 0";
         Extent = "64 13";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         expression = "getControlObjectVelocity();";
      };

function getControlObjectVelocity()
{
   return 0;
}

This actually works but the console is spammed with
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error
syntax error

#1
11/05/2010 (6:06 am)
Hey Matt, I'm a little confused on what you wanted to do. Did you want to create a flash type effect of a gui control bouncing around? If so perhaps you should look into the resources about plastic gem's focused on GUI's. Those were really interesting. If you want more help we will need more information.
#2
11/05/2010 (11:34 am)
Umm, no. I just wanted to display a number variable on the screen. Obviously my real function is a little bit more in depth than just having a 'return 0;' but that is just for testing that. However, when I add this, the console is spammed with 'syntax error' even though the number (0) is displayed.
#3
11/06/2010 (8:49 am)
So, you want to change the text field of the control? Name the control something.

new GuiConsoleTextCtrl(hudNumber) {   
         canSaveDynamicFields = "0";   
         Profile = "GuiDefaultProfile";   
         HorizSizing = "right";   
         VertSizing = "bottom";   
         position = "0 0";   
         Extent = "64 13";   
         MinExtent = "8 2";   
         canSave = "1";   
         Visible = "1";   
         hovertime = "1000";   
};
Then you can make a method that does something with the number on some kind of an event.

function IMakeStuffHappen( %this )
{
   hudNumber.setText( $Number::Changing::Variable )

   schedule( 0, 1000, IMakeStuffHappen );
}
#4
11/06/2010 (6:51 pm)
I found that changing the line:

expression = "getControlObjectVelocity();";

to

expression = "getControlObjectVelocity()";

Removed the error, some reason GuiConsoleTextCtrl doesn't like ;'s in them. And just FYI Jesse, thanks for help but GuiConsoleTextCtrl uses that "expression" field to return a value to the control instead of the way just a straight GuiTextCtrl would be used. GuiConsoleTextCtrl doesn't have a setText consoleMethod
#5
11/06/2010 (11:44 pm)
Well, I'm glad you were able to figure it out. I was really having a hard time figuring out what you wanted to do. But if all you wanted to do was know you didn't need the ; I'm glad you figured it out!