Game Development Community

Reloading an edited file

by Lance Hampton · in Torque Game Builder · 11/26/2006 (10:41 pm) · 5 replies

What is the simplest way to insure that a file is reloaded if it has been edited? Right now I'm just using the basic exec function when the game starts, but that isn't cutting it. I have to exit TGB and restart every time I make edits. Did I miss something along the way?

#1
11/26/2006 (11:10 pm)
This has been covered a few times lately. Most recently in this thread.
#2
11/26/2006 (11:12 pm)
It will be interesting to see if these threads dissapear once the next version is out. I had reload-itis when I started with TGB and specifically targetted that problem as something I wanted to fix in the new docs.

We shall see...
#3
11/26/2006 (11:45 pm)
Quick summary:
exec calls go in the game.cs file, in the startGame function.

Thanks for the quick answer.

The Scroller Demo has all the exec's in main.cs, which is unfortunately the last one I looked through before starting in on my game.

I keep hoping when I ask a question like this that someone will post a link to some mysterious documentation I've been overlooking.

Looking through the code it does look misleading, specifically in main.cs - InitializeProject():
"// Exec game scripts"

That's where I tacked on my scripts just like in the scrollerDemo. It looks like startGame is getting called from there, so if startGame is called every time the play button is pushed it would *seem* like it is getting called from initializeProject(). This startGame is not used while in the editor and the play button in the editor calls its own startGame, presumably.
#4
11/27/2006 (6:16 pm)
Yeah, main.cs is a good place to exec your scripts once you're done prototyping. I consider main.cs the "right" place to exec all my scripts. Exec'ing them in startGame is just a good workaround for when you're in the starting phases and have TGB running while you're editing script. I still recommend moving them all to main.cs once you're past that phase.
#5
11/28/2006 (1:28 pm)
Originally we had the tutorials exec gamescripts in main.cs like Ben is suggesting. Due to the need to re-exec the scripts each time you hit play we started putting them in startGame (or just in game.cs since game.cs is exec'd when you hit the play button) to ensure you didn't have to restart TGB.

main.cs is a great place to put the scripts in for a final release, or even keeping them in startGame is ok as long as you keep startGame() as the purpose the name means, to start the game, so in a final build it should only be called once not for every time you load a new level.