Game Development Community

GenericButtonBehavior calling Class Method

by Chad Kilgore · in Torque Game Builder · 09/23/2007 (8:18 pm) · 0 replies

I'm attempting to make GenericButtonBehavior a little bit more generic by allowing calls to the object's class and not just the object itself. I have added the following to do so:
if (!isObject(GenericButtonBehavior)) {
   ...
   %template.addBehaviorField(classMethod, "Function is method of the object's class", bool, 0);
   ...
function GenericButtonBehavior::onMouseUp(%this, %modifier, %worldPos)
   ...
   if (%this.classMethod) {
      if (%this.owner.class.isMethod(%this.method)
         %this.owner.class.call(%this.method);
   }
   else {
      if (%this.owner.isMethod(%this.method))
         %this.owner.call(%this.method);
   }
}
It works...for the most part. The method call to the class is made, but in compiling there is an parse error at
%this.owner.class.call(%this.method);
Can anybody help me resolve this error to make it work? Thanks.

---- Edit ----
It works in TGB 1.5 but not in TGB 1.5.1.