calling src functions
by James Reue · in Torque Game Engine · 08/29/2001 (9:26 pm) · 5 replies
from the scripts could i call a function in the engine src? like if i had a function that played a particular wav file could i call it run time in a script?
About the author
#2
08/29/2001 (9:36 pm)
cool, thanks
#3
and i can use that variable 'someVariable' in the scripts by calling it like:
%obj = new SampleObject(MySampleObject);
%obj.someVariable = 100;
echo("variable ",%obj.someVariable);
but i would like to be able to call a function in the SampleObject class
ie %obj.playWalk();
playWalk being a function that plays a wav
any ideas?
08/30/2001 (12:35 am)
well i have found how to use variables in the src, but i still can't figure out how to use a function is the function addField() supposed to be how you do it? i have used addField("someVariable", TypeS32, Offset(someVariable, SampleObject));and i can use that variable 'someVariable' in the scripts by calling it like:
%obj = new SampleObject(MySampleObject);
%obj.someVariable = 100;
echo("variable ",%obj.someVariable);
but i would like to be able to call a function in the SampleObject class
ie %obj.playWalk();
playWalk being a function that plays a wav
any ideas?
#4
08/30/2001 (6:12 am)
Check out the engine mehtod called Con::addCommand(). There are over 700 calls to that method in the engine to use as an example. This sounds like what you are looking for.
#5
quite get it to work to the point that i decided it was the wrong thing
to do .. i'll read up in the doxygen stuff see how i can make it work
thanks
08/30/2001 (11:26 am)
yeah i messed around with that for a little while...i never could quite get it to work to the point that i decided it was the wrong thing
to do .. i'll read up in the doxygen stuff see how i can make it work
thanks
Torque Owner Michael LaRue
An example:
Check out shapebase.cc, lines 277-319. This area defines src functions that can be called from the console.