Game Development Community

Events after onTileScript has been processed? [solved]

by Max Kielland · in Torque Game Builder · 01/29/2013 (8:06 am) · 2 replies

Hi,

I need to run some initialisation after all the tiles have called the onTileScript.
I have single stepped through the whole project and the onTileScript is called after initializeProject() in main.cs There seems to be no code or events after the onTileScript has been processed and the game actually starts (I guess onTileScript is called when the game has started).

Is there any event I can hook up to to get called after the tileMap has called all the tile layer's onTileScript?

#1
02/01/2013 (8:46 pm)
From what I can tell by looking at the source code, it looks like "onTileScript" is called right before the tile itself is rendered. From what I can tell, this means it will be called every time the screen is rendered.

If you just need to be generally correct, you could implement t2dSceneGraph's "onUpdateScene" callback.

If you need to be exactly right, you'll need to add a callback at the end of t2dTileLayer::renderObject:
if( isMethod( "onRenderComplete" ) )
  Con::executef( this, 1, "onRenderComplete" );

Now the t2dTileLayer will have an "onRenderComplete" callback which is also after the last "onTileScript" has been called.
#2
02/02/2013 (6:22 am)
t2dSceneGraph::onUpdateScene(%this) is called on every single frame and it feels a bit odd to put in logic to only fire once on the first frame.

So the short answer is: No there is no callback available for this purpose.
Okay It seems like I have to recompile the source. I have severe problems with reading the mouse buttons anyway so it seems like a good idea to do some changes and recompile.

Thank you.