Game Development Community

GUI error: What am I doing wrong here?

by Rodney (OldRod) Burns · in Torque 3D Professional · 10/10/2009 (9:37 pm) · 3 replies

I have a GUI file that has a button defined as this:

new GuiButtonCtrl() {
         text = "Create Account";
         groupNum = "-1";
         buttonType = "PushButton";
         useMouseEvents = "0";
         isContainer = "0";
         Profile = "GuiButtonProfile";
         HorizSizing = "right";
         VertSizing = "top";
         position = "189 289";
         Extent = "90 23";
         MinExtent = "8 8";
         canSave = "1";
         Visible = "1";
         Command = "createAccountDlg.createAccount();";
         tooltipprofile = "GuiToolTipProfile";
         hovertime = "1000";
         canSaveDynamicFields = "0";
      };
   };

Then at the bottom of the same GUI file I have this:

function createAccountDlg.createAccount(%this)
{
	
}

When I run the code, I get "<input> (0): Unknown command createAccount."

I'm sure I'm missing something quite obvious, but I just can't see it. Can someone enlighten me, without making me feel too stupid? :)

#1
10/11/2009 (2:21 am)
function createAccountDlg::createAccount(%this)

. is replaced with ::

I take it you have a createAccountDlg setup.
#2
10/11/2009 (8:28 am)
LOL, I guess it had been too long a day...

The '.' and '::' was a copy/paste error when I made the post - I had that correct in the script. The problem turned out to be something else. I had some code inside the function createAccount() that wasn't fully commented out like I thought. That caused an error when the script compiled, so yeah, the game couldn't find it because it didn't compile properly. /facepalm

Woke up this morning and found it right away. Thanks for the help anyway, OmegaDog :)
#3
10/11/2009 (4:45 pm)
> That caused an error when the script compiled

unnoticed script errors are a pita.

i highly recommend writing something like the following and calling it either periodically or once your level is loaded:

$gLastScriptErrorHash = "";
function checkScriptError()
{
   if ($ScriptErrorHash == $gLastScriptErrorHash)
   {
      return;
   }
   
   MessageBoxOK("Script Error" SPC $ScriptErrorHash, $ScriptError, "");
   
   $gLastScriptErrorHash = $ScriptErrorHash;
}