Game Development Community

Help needed with script

by Le Roi · in Torque Game Builder · 06/14/2006 (12:12 pm) · 2 replies

I have the following function :

function Controller::setMoveMap(%controller , %map)
{
if(isObject(%controller.Map))
{
%controller.Map.pop();
}
%controller.Map = %map;
%controller.Map.push();
}

Then I do this

$ActionMap1 = new ActionMap(moveMap);
moveMap.bindCmd(keyboard,"d","KeyDown($Controller1,right)","KeyUp($Controller1,right)");

$Controller1.setMoveMap($Controller1,$ActionMap1);

Why in the first function does the parameters not come through correctly ? I only refceive the $Controller value ?

Thanks
Le Roi

#1
06/14/2006 (12:28 pm)
Um, try adding a %this as the first parameter.

Edit: so your definition would look like this:

function Controller::setMoveMap(%this, %controller , %map)

but your call would still be

$Controller1.setMoveMap($Controller1,$ActionMap1);
#2
06/14/2006 (12:51 pm)
EDIT : Sorted it out - forgot a ';'

Thanks guys