Game Development Community

Close event in torquescript

by vdlabs · in Torque Game Builder · 07/10/2012 (1:05 am) · 2 replies

Hello.
Sorry for my bad English. I work with TGB 1.7.6. Is any function(callback) in script that will be called when user close the game window (for example click on cross)? Thank you.

#1
07/10/2012 (10:23 am)
I can't be 100% sure since I don't use 1.7.6, but I can't imagine why they would have CHANGED this, so here's how it is in 1.7.4-ish.

The function is called onExit(), and it's in your main.cs file in your game directory.

In my build at least, it is called no matter what (click the red X, alt-f4, etc.). If that isn't the case out of the box, let me know... I'll dig up whatever I did to the source to make it happen. :)

-Tim
#2
07/11/2012 (12:16 am)
In TGB 1.7.6 this function called shutdownProject(). It works fine. Thank you very much Tim.