Game Development Community

Creating object functions

by Rarw Muffinz · in Torque 3D Beginner · 04/29/2014 (3:58 pm) · 1 replies

Hey guys, sorry for the noob question but I want to know how I can define a variable to be called on an object, such as "%client.myFunction();".
Can someone help?
Thanks,
Rarwmuffinz

#1
05/01/2014 (3:30 pm)
I'm a little confused by the context of the question, not to mention I have no idea if this is being doing in TS or C++.

If you're referring to object functions in torque-script in general the syntax is as follows:

function ClassName::functionName(%classObject, %args, ...) {

}
//Where %classObject is the object of the context

C++ is a little more tricky to accomplish and it's along the lines of:
DefineEngineMethod(ClassName, functionName, return_type, (argument list), (default arguments), "function description") {
   //code here.
}