Updates to scripts not recognized by TGB
by Christian Rousselle · in Torque Game Builder · 10/15/2006 (10:40 am) · 3 replies
TGB does not recognize that scripts files have changed. I need to restart TGB whenever I make a change. I also see that the .dso file is only updated when I restart. What am I doing wrong? It that some kind of setting? I am working with TGB 1.1.1 and T2D 1.1.2.
Thank you.
Thank you.
#2
10/17/2006 (4:19 pm)
I'd come across the same problem and I figured I had just misread the documentation... Interesting.
#3
Now that the script execution order was changed so that game.cs is executed on project initialization -and- every time the game is played from the level builder the best place for exec statements is in game.cs *outside of startGame* to ensure that your datablocks are being executed and updated without having to restart TGB and also that all your code is being updated every time you run your game.
There are still times when you will have to/want to restart TGB because once a function is defined it can be re-defined (basically 'overwritten', which is what happens when you re-execute a file in the same instance of TGB), but it can't be 'un-defined', so there can potentially be times where you will move a function to a parent namespace, but the child function is still being called, etc.
-Thomas
10/17/2006 (5:00 pm)
The tutorials were written this way to avoid later confusion caused by potential problems. It's safer to execute your scripts outside of startGame to avoid dependency issues - specifically with datablocks that the level builder needs to know about. If you load a level file with an object that has a datablock assigned to it *before* the file with that datablock definition has been executed, the level builder will clear the datablock field (because the datablock doesn't exist). If you then re-save your level file you will lose all the datablock info on your objects. Now that the script execution order was changed so that game.cs is executed on project initialization -and- every time the game is played from the level builder the best place for exec statements is in game.cs *outside of startGame* to ensure that your datablocks are being executed and updated without having to restart TGB and also that all your code is being updated every time you run your game.
There are still times when you will have to/want to restart TGB because once a function is defined it can be re-defined (basically 'overwritten', which is what happens when you re-execute a file in the same instance of TGB), but it can't be 'un-defined', so there can potentially be times where you will move a function to a parent namespace, but the child function is still being called, etc.
-Thomas
Torque Owner Christian Rousselle
Default Studio Name
exec("./player.cs"); from initializeProject() in main.cs to startGame() in game.cs