Game Development Community

schedule

by rennie moffat · in Torque Game Builder · 09/23/2009 (4:06 pm) · 4 replies

Hi, I am sorry for posting this, i ws looking everywhere, library, forums, books and could not find a clear explanation of schedule. I know it is a time function and you can link to spawn lifes on a timer. ANy timer related thing really. But I am wondering it's set components or even if it (or any command for that matter) has set components.


IE.
%this.schedule(%this, %timer)

or one that I found in the library.
%this.schedule(%i, "createAfterImageClone", %stillFrames, %increment, %speed, %goal);


these "innards" like onMouseUp(%this, %clicks, %mousePos, %modifier), are there set ones which I should know about or is it ind of a plug and play thing regarding "schedule"?



About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
09/23/2009 (6:15 pm)
It appears that what you're asking is the innate and required parameters of the method version of schedule is. The definition of schedule() is found in the offline docs, Component Tutorials>Scripting>Scheduling Events.

To give you the short answer, the parameters of the method schedule are the time to wait, proceeded by the function to call. Any further parameters are to pass additional information to the function and are not required.
#2
09/23/2009 (6:30 pm)
So would this make sense.


%this.player.schedule(30, %this.beginToFire);



:?
#3
09/24/2009 (6:53 am)
Nope.

You can you either schedule FUNCTION or schedule METHOD - for reasons I can not figure out those behave differently then other TGB's interfaces.

Function schedule takes arguments: time (in ms), object (set to zero if it should call function, method to be called in object or function if second argument is zero, arguments to method/function)
Ex. 1 schedule(300, 0, callSomeFunction, "arg1", "arg2");
Ex. 2 schedule(300, %this, callSomeMethod, "arg1", "arg2");
Method schedule:
Ex. 3 %this.schedule(300, callSomeMethod, "arg1", "arg2");

So in your case it would be:
%this.player.schedule(30, beginToFire);

Note that secend argument here do NOT have "%this" but only method name. Also think twice when switching between function schedule and method schedule due to arguments inconsistency.

#4
09/24/2009 (1:23 pm)
great, thanks,
a little confused by this tho.


"object (set to zero if it should call function, method to be called in object or function if second argument is zero, arguments to method/function)"

I understand setting an object to 0, I am guessing this means the object is "off". Where I am really unclear tho and I will be studying this more, but if you could give me a quick heads up between method and function? In my C++ for Dummies book it says under Method to look at Function.



:?