Game Development Community

Another schedule problem

by CodingChris · in Torque Game Engine Advanced · 02/03/2008 (9:54 am) · 1 replies

Hi,
sorry, but I always have problems with schedule... What I want to do:
Create an item. And set the transform of this item 5 seconds afer the creation time.
My code:
%car = %client.getControlObject();

   if (%car.getClassName() $= "WheeledVehicle")
   {
      %carPos = %car.getTransform();
	  %item = new Item() {
      canSaveDynamicFields = "1";
      position = "3.45383 -162.637 154.084";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      dataBlock = "HealthKit";
      collidable = "0";
      static = "1";
      rotate = "1";
      rotate2 = "0";
   };
 %item.schedule(5000,'setTransform',%carpos);
	  logos.add(%item);
     
   }
What's wrong with my schedule function???

#1
02/04/2008 (3:04 am)
%item.schedule(5000,'setTransform',%carpos);
should be corrected to:
%item.schedule(5000,"setTransform",%carpos);
single-quotes used for tagged strings, while normal strings are using doubles.
And, as TorqueScript is very flexible you can even use:
%item.schedule(5000, setTransform, %carpos);
This should work.