onStartUp() and other on functions
by Brian Pickrell · in Torque Game Builder · 12/02/2009 (3:20 pm) · 3 replies
I keep seeing mentions in the tutorials of functions like onStartUp(), onLevelLoaded(), etc...these seem to be event-driven, i.e. you don't explicitly call them; they just happen at the right time if you write the function. But the tutorials don't give too much background explanation; they just tell you to put the functions in. Is there a good discussion of this somewhere and a reference as to what all the built-in events and handlers are? Also, which ones are game global and which ones are tied to particular classes.
TIA
#2
OK...now that I know where to look them up, it's great.
It appears that callbacks and event handlers are synonymous in TorqueScript. And that the events and the names of the callback functions are preset and static; you have to use the correct name but you can write your own function.
In some languages, you can define your own events and write handlers for them. Does TorqueScript have that capacity (not that I'm planning to do it; just wondering)?
12/02/2009 (5:11 pm)
OK...now that I know where to look them up, it's great.
It appears that callbacks and event handlers are synonymous in TorqueScript. And that the events and the names of the callback functions are preset and static; you have to use the correct name but you can write your own function.
In some languages, you can define your own events and write handlers for them. Does TorqueScript have that capacity (not that I'm planning to do it; just wondering)?
#3
You could also dig into the source code and add new stuff.
12/02/2009 (5:16 pm)
Well, there's nothing stopping you from consistently adding a method to your custom objects and calling them, either in onUpdate() or as certain things are triggered elsewhere. It's all about being creative there :)You could also dig into the source code and add new stuff.
Associate Mike Lilligreen
Retired T2Der
tdn.garagegames.com/wiki/TGB/Reference:_t2dSceneObject_Callbacks