Game Development Community

Help: stuck trying to make a new console object...

by Jason Cahill · in Torque Game Builder · 11/26/2005 (1:40 am) · 2 replies

This isn't really a bug... it's more of a gap in my understanding...

I'm trying to create a new object like a t2dStaticSprite. It took the t2dStaticSprite.h and .cc files and made copies of them as t2dText.h and .cc. I went through and made the necessary renames and eliminated the datablock portion. I just want a dynamically createable console object based off of t2dSceneObject. At this point, everything compiles and still works. Now's when things get a little wonky:

I start messing with the parameters to ConsoleMethods... like I get rid of the ConsoleMethod for setFrame and getFrame, and change the signature of setImageMap from being:

ConsoleMethod(t2dText, setImageMap, bool, 3, 3, "(imageMapName$, frame) - Sets imageMap and frame.")

to
ConsoleMethod(t2dText, setImageMap, bool, 2, 2, "(imageMapName$) - Sets imageMap.")

I went through this function and eliminated all references to frame. Now when I run my code, I can never get voltage across this console method. Instead, I just get an error in the Console window that says:

t2dText::setImageMap - wrong number of arguments.
usage - t2dText::setImageMap - (imageMapName$) - Sets imageMap.

Is there something magical I should know about creating or tweaking a ConsoleMethod? Here's the source code to my current version of the method:
ConsoleMethod(t2dText, setImageMap, bool, 2, 2, "(imageMapName$) - Sets imageMap.")
{
   // Set ImageMap.
   return object->setImageMap( argv[1] );
}

#1
11/26/2005 (1:55 am)
I figured it out. I've only ever used ConsoleFunction before. ConsoleMethod has one more "required" parameter for "this." Which means, having a single "real" parameter means you need 3, 3, not 2, 2 for min/max arguments. I've submitted a request to delete this thread.
#2
11/27/2005 (8:39 pm)
Thanks for the request Jason, but I'll leave it stand, if that's cool with you? Maybe someone else will have a similar gap in understanding. I'd just move this to a move forum area, but our system doesn't allow that... and I'd rather not totally delete the thread since you pretty clearly explain the solution to a commonly misunderstood subject here.