Game Development Community

noob alert, trouble with splash screens and tgb 1.7.4

by Cheryl Gress · in Torque Game Builder · 02/16/2009 (11:04 am) · 14 replies

I'm trying to learn tgb, I like the engine and the community and resources available seem to be pretty good though some of the documentation seems to be obsolete.

I've been trying to use the following tutorial:

http://www.thisismyurl.com/tutorials/torque/creating-a-splash-screen-in-torque-game-builder/

It looks pretty straight forward but I'm assuming it's obsolete?

I'm basically trying to throw a splashscreen onto my fish tutorial

When I run the game I don't see the splash screen and if i delete the dso files I get 'initializeProject' function could not be found

this is my edited portion of the main.cs
function initializeProject()
{
// Load up the in game gui.
exec("~/gui/mainScreen.gui");
exec(”~/gui/ggSplash.gui”);
// Exec game scripts.
exec("./gameScripts/game.cs");

// This is where the game starts. Right now, we are just starting the first level. You will
// want to expand this to load up a splash screen followed by a main menu depending on the
// specific needs of your game. Most likely, a menu button will start the actual game, which
// is where startGame should be called from.
loadSplashScreen();
}
function loadSplashScreen()

{
canvas.setContent(ggSplash);
schedule(100,0,checkSplashTime);
}

function checkSplashTime()
{
if (ggSplash.done)
startGame(expandFilename($Game::DefaultScene));
else
loadSplashScreen();
}



Any pointers would be helpful. Thanks.

#1
02/16/2009 (11:14 am)
@Cheryl - I'm looking into this, but the first thing you should check is your console log for any errors. Look for syntax, missing variables, or bad function calls.

#2
02/16/2009 (11:18 am)
The console log doesn't have anything that sticks out to me here's the last few lines when the splash screen doesn't happen

game/gameScripts/mine.cs (0): Unable to find object: '' attempting to call function 'schedule'
Activating DirectInput...
DirectInput joystick failed to enable!
Loading compiled script C:/Users/Cheryl/Documents/MyGames/FishGame/game/data/levels/myfishlevel.t2d.
DirectInput deactivated.
Shutting down the OpenGL display device...
Making the GL rendering context not current...
Deleting the GL rendering context...
Releasing the device context...
#3
02/16/2009 (11:22 am)
I think I see the error, compare the following lines very carefully:

exec(”~/gui/ggSplash.gui”);
exec("~/gui/ggSplash.gui");

If you are copying and pasting exactly what you have, look at the quotes that contain the path of the GUI.

The quotes used in the first line are going throw a syntax error, which will not only stop your GUI from loading, but will prevent your entire initializeProject() from working.
#4
02/16/2009 (11:22 am)
Here is my code, copied exactly:
function initializeProject()
{
   // Load up the in game gui.
   exec("~/gui/mainScreen.gui");
   
   exec("~/gui/ggSplash.gui");
   
   // Exec game scripts.
   exec("./gameScripts/game.cs");

   // This is where the game starts. Right now, we are just starting the first level. You will
   // want to expand this to load up a splash screen followed by a main menu depending on the
   // specific needs of your game. Most likely, a menu button will start the actual game, which
   // is where startGame should be called from.
   //startGame( expandFilename($Game::DefaultScene) );
   loadSplashScreen();
}

function loadSplashScreen()
{
   canvas.setContent(ggSplash);
   schedule(100,0,checkSplashTime);
}

function checkSplashTime()
{
   if (ggSplash.done)
      startGame(expandFilename($Game::DefaultScene));
   else
      loadSplashScreen();

}
#5
02/16/2009 (11:23 am)
Whenever you copy and paste from another tutorial, especially a website, special characters tag along and can bork your TorqueScript code.
#6
02/16/2009 (11:31 am)
oh my goodness I would have never have caught that!!! thanks!
#7
02/16/2009 (11:37 am)
Welcome =)
#8
02/16/2009 (11:39 am)
now I gotta figure out why I just get a blank screen after, the gui. Thanks for the help
#9
02/16/2009 (11:40 am)
First thing that comes to mind is $Game::DefaultScene not containing the level you want. I'd debug that variable to see what it is, or just manually type the path to your level.
#10
02/16/2009 (11:48 am)
this the end of my error log now:

Torque Game Builder (v1.7.4) initialized...
Loading compiled script C:/Users/Cheryl/Documents/MyGames/FishGame/game/managed/datablocks.cs.
Loading compiled script C:/Users/Cheryl/Documents/MyGames/FishGame/game/managed/persistent.cs.
Compiling C:/Users/Cheryl/Documents/MyGames/FishGame/game/managed/brushes.cs...
Loading compiled script C:/Users/Cheryl/Documents/MyGames/FishGame/game/managed/brushes.cs.
Loading compiled script C:/Users/Cheryl/Documents/MyGames/FishGame/game/gameScripts/datablocks.cs.
Loading compiled script C:/Users/Cheryl/Documents/MyGames/FishGame/game/gameScripts/guiProfiles.cs.
Loading compiled script C:/Users/Cheryl/Documents/MyGames/FishGame/game/gui/mainScreen.gui.
Loading compiled script C:/Users/Cheryl/Documents/MyGames/FishGame/game/gui/ggSplash.gui.
Compiling C:/Users/Cheryl/Documents/MyGames/FishGame/game/gameScripts/game.cs...
Loading compiled script C:/Users/Cheryl/Documents/MyGames/FishGame/game/gameScripts/game.cs.
Shutting down the OpenGL display device...
Making the GL rendering context not current...
Deleting the GL rendering context...
Releasing the device context...

So I'm assuming it's stopping in my game.cs file and probably
in here

Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);
moveMap.push();
if( isFile( %level ) || isFile( %level @ ".dso"))
sceneWindow2D.loadLevel(%level);
#11
02/17/2009 (3:05 pm)
I try ggSplash and works perfectly for me thanks. But I have another related question.

How can i put two ore more gui to splash screens? And how can I put these screens in a infinite loop before an a click mouse(interrupt) and after an a end of game.

Sorry my bad english :)

Thanks.
#12
02/27/2009 (8:43 am)
I'm still new to TGB, but I don't understand why you wouldn't just use the splash screen Behavior unless you're looking to become a scripting ace?

http://tdn.garagegames.com/wiki/TGB/Behaviors/SplashScreen

1) You just download the file
2) Drop it in your TGB game's behaviors folder
3) Add it to the image you want to be the splash screen
4) Enter in the fade in/duration/fade out time
5) Enter the next level that the screen jumps to e.g.:
~data/level/level1.t2d

Anyone know the script to call a .gui file onLevelLoaded for specific levels and where to put the code(main.cs, datablock.cs, etc.)?

I can load a StartUp.gui with an .ogg cut scene in it at game initialization, but I can't figure out how to call the .gui only for levels 2 & 4.
#13
02/27/2009 (11:08 am)
thanks for the link Path!
#14
05/30/2009 (7:31 pm)
Cheryl,

I used the same tutorial. I too had the black screen.

I did two things but am not sure what one fixed it.

1) I added my splash screen image to: ...\MyGames\NameofProject\game\data\images

2) When editing the ggSplash screen (F10) I selected the GuiFadeInBitmapCTRL and then under the General tab I uncheck the box for 'Done'.