Game Development Community

Unknown command getText

by Jeff Trier · in Torque Game Engine · 02/20/2005 (4:49 am) · 2 replies

Hi all,

I can't seem to figure out this error I am getting. Going throught the stock code and documentation, it seems I have both the syntax and symantics right for "getText", and all of the objects are there.

What's odd is that despite the Unknown Command error, the function is still working (haven't tested it on my network yet), it's just generating an error.

Below are the relative bits of information.


GuiRoom.gui:
...

   new GuiBitmapCtrl(player0_info) {
      profile = "GuiDefaultProfile";
      horizSizing = "relative";
      vertSizing = "relative";
      position = "7 64";
      extent = "357 73";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
      bitmap = "./playerinfo.png";
      wrap = "0";

      new GuiTextCtrl(Player0_NameText)
      {
         profile = "GameRoomInfoProfile";
         horizSizing = "relative";
         vertSizing = "relative";
         position = "16 0";
         extent = "24 14";
         minExtent = "8 2";
         visible = "1";
         text = "";
         maxLength = "16";
      };
   };
   new GuiBitmapCtrl(player1_info) {
      profile = "GuiDefaultProfile";
      horizSizing = "relative";
      vertSizing = "relative";
      position = "7 145";
      extent = "357 73";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
      bitmap = "./playerinfo.png";
      wrap = "0";

      new GuiTextCtrl(Player1_NameText)
      {
         profile = "GameRoomInfoProfile";
         horizSizing = "relative";
         vertSizing = "relative";
         position = "16 0";
         extent = "24 14";
         minExtent = "8 2";
         visible = "1";
         text = "";
         maxLength = "16";
      };
   };

...

GuiRoom.cs:
...

function serverCmdUpdateNameHud(%client){
   // assign client to a slot
	%count = ClientGroup.getCount();
   if(%count==1){
      %cl0 = ClientGroup.getObject(0);
      Player0_NameText.setText(%cl0.nameBase);
      Player1_NameText.setText("Computer");
      %name0 = Player0_NameText.getText();
      %name1 = Player1_NameText.getText();
      messageClient(%cl0,'passVar',%name0,%name1);

   }
   if(%count==2){
      %cl1 = ClientGroup.getObject(1);
      %name1 = Player1_NameText.setText(%cl1.nameBase);
      messageClient(%cl1,'passVar',%name0,%name1);
   }
}

...


Error:
Quote:
Mapping string: UpdateNameHud to index: 3
starter.fps/client/ui/tgeroom/GuiRoom.cs (62): Unknown command getText.
Object Player0_NameText(1311) Player0_NameText -> GuiTextCtrl -> GuiControl -> SimGroup -> SimSet -> SimObject
starter.fps/client/ui/tgeroom/GuiRoom.cs (63): Unknown command getText.
Object Player1_NameText(1313) Player1_NameText -> GuiTextCtrl -> GuiControl -> SimGroup -> SimSet -> SimObject

EDIT:
Lines 62 and 63 are...
Player0_NameText.setText(%cl0.nameBase);
Player1_NameText.setText("Computer");
... within GuiRoom.cs

END EDIT

As always, any help would be appreciated!

Thanks,
-Jeff

About the author

Originally a Classical/Metal musician, I've always been attracted to anything involving computers, including: Networking, PC Building and Repair, software design and coding. I've been involved with game design and development for over 10 years.


#1
02/20/2005 (6:48 am)
That's cause there is no getText() method for GuiTextCtrl. You have to use getValue().

An easy way to determine what methods a control has, once your script is running. open up the console and do a .dump(); In this case do a Player1_NameText.dump(); and you'll see all the methods that are associated with that control.
#2
02/20/2005 (7:15 am)
Doh! ... It's fixed and working now.

Thanks Steve.

It's funny, I knew about dump, but I was sooo sure it was getText I didn't bother checking. :p

That'll learn me (I hope)...


-Jeff