Changing Levels?
by Simon Jensen · in Torque Game Builder · 08/03/2006 (1:51 pm) · 5 replies
Ok pardon me if this is incredibly stupid...
So I've got a Main Menu level which has a staticSprite button (called GoButton) that when you click is supposed to load the main level.
the function is being called correctly. but it crashes TGB about 2/3ds of the timeas it is.. Did I completely miss the boat on how to change levels?
So I've got a Main Menu level which has a staticSprite button (called GoButton) that when you click is supposed to load the main level.
function GoButton::onMouseDown(%this, %modifier, %worldPos, %mouseClicks)
{
sceneWindow2D.endLevel();
sceneWindow2D.loadLevel("BombBots/data/levels/mainMenu.t2d");
exec("BombBots/gameScripts/bombBots.cs");
InitBots(); // located in bombBots.cs
}the function is being called correctly. but it crashes TGB about 2/3ds of the timeas it is.. Did I completely miss the boat on how to change levels?
#2
I just tried that and it didn't seem to make a difference but at least i got to try scheduling :)
I Found the problem..
If I delete the persistent.cs.dso file between running TGB it works every time.
my persistent.cs only contains the following
also.. I deleted the .dso's in the gameScripts folder and the splash.cs (where the above functions are located) does not seem to be getting a new dso generated for it... is that normal?
08/03/2006 (2:47 pm)
Thanks for the quick response! I just tried that and it didn't seem to make a difference but at least i got to try scheduling :)
I Found the problem..
If I delete the persistent.cs.dso file between running TGB it works every time.
my persistent.cs only contains the following
$persistentObjectSet = new SimSet() {
canSaveDynamicFields = "1";
setType = "Persistent";
};Any idea what this is supposed to do?also.. I deleted the .dso's in the gameScripts folder and the splash.cs (where the above functions are located) does not seem to be getting a new dso generated for it... is that normal?
#3
No, I don't think that's normal. Do you get any compilation errors?
08/03/2006 (3:00 pm)
Quote:
also.. I deleted the .dso's in the gameScripts folder and the splash.cs (where the above functions are located) does not seem to be getting a new dso generated for it... is that normal?
No, I don't think that's normal. Do you get any compilation errors?
#4
Did a search of the TGB dir to see if it was being placed somewhere else but it isnt..
08/03/2006 (3:11 pm)
Nope, no compilation errors. And function calls to things in splash.cs seems to work just fine.Did a search of the TGB dir to see if it was being placed somewhere else but it isnt..
#5
08/03/2006 (3:24 pm)
I think there is an option prefs.cs that turns off dso creation but I've never looked into that. Maybe that is turned on. Don't know.
Torque Owner Michael Woerister
function startGameOrSomething() { sceneWindow2D.endLevel(); sceneWindow2D.loadLevel("BombBots/data/levels/mainMenu.t2d"); exec("BombBots/gameScripts/bombBots.cs"); InitBots(); // located in bombBots.cs } function GoButton::onMouseDown(%this, %modifier, %worldPos, %mouseClicks) { schedule(0, 0, startGameOrSomething ); }