Game Development Community

Splash screen

by Richard Preziosi · in Torque Game Engine · 02/15/2007 (10:26 pm) · 12 replies

Ok I was trying to refrain from asking another question, by simply figuring it out myself, but 3 hours is my limit. My splash screen simply will not load, it just skips completely to the main menu, here is the code that I have:

startup.gui
//--- OBJECT WRITE BEGIN ---
new GuiFadeinBitmapCtrl(StartupGui) {
   profile = "GuiInputCtrlProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "1024 768";
   minExtent = "8 8";
   visible = "1";
   helpTag = "0";
   bitmap = "./prezentsplash";
   wrap = "0";
   fadeinTime = "125";
   waitTime   = "3000";
   fadeoutTime = "125";
};
//--- OBJECT WRITE END ---

function loadStartup()
{
   StartupGui.done = false;
   Canvas.setContent( StartupGui );
   schedule(100, 0, checkStartupDone );
   alxPlay(AudioStartup);
}
   

//-------------------------------------
function StartupGui::click()
{
   StartupGui.done = true;
}


//-------------------------------------
function checkStartupDone()
{
   if (StartupGui.done)
      loadMainMenu();
   else
      schedule(100, 0, checkStartupDone );
}


Init.cs

// Load up the shell GUIs
   exec("./ui/overlayDlg.gui");
   exec("./ui/StartupGui.gui");
   exec("./ui/mainMenuGui.gui");


then also in init.cs

if ($JoinGameAddress !$= "") {
      // If we are instantly connecting to an address, load the
      // main menu then attempt the connect.
      loadMainMenu();
      connect($JoinGameAddress, "", $Pref::Player::Name);
   }
   else {
      // Otherwise go to the splash screen.
      Canvas.setCursor("DefaultCursor");
      loadStartup();
   }
}


//-----------------------------------------------------------------------------

function loadStartup()
{
   // Startup the client with the ...
   Canvas.setContent( StartupGui );
   checkAudioInit();

   Canvas.setCursor("DefaultCursor");
}


function loadMainMenu()
{
   // Startup the client with the Main menu...
   Canvas.setContent( MainMenuGui );
   checkAudioInit();

   Canvas.setCursor("DefaultCursor");
}

#1
02/15/2007 (11:08 pm)
That all looks fine at a quick glance.

Are you sure "prezentsplash" is a valid bitmap, does it exist and is it in the right spot?

Do you see a black screen for 3 seconds then the menu loads or does the menu load immediately?

Any console errors / warnings?

You do realize that a keyboard press or mouse click will cancel the startup screen.
#2
02/16/2007 (4:56 am)
You have two loadStartup() functions...

Once you figure out the problem with displaying your startup gui, your main gui won't load.

Also, check your console.log file for script errors.
#3
02/16/2007 (5:13 am)
Oh thanks for pointing that out Tony, i'll try deleting each, but if you read this before i get the splash to load, does it matter which one I delete? thanks.
#4
02/16/2007 (5:21 am)
Also, I have absolutely no errors in my console.log. Is there any other file that could be conflicting with the splash or making it be splash.done=true? I've been able to do most other gui things, main menu, player gui, etc, but I'll be damned if I can make the splash show up.
#5
02/16/2007 (6:21 am)
You need to delete the one in init.cs
It is "disabling" the one in your gui which is exec-ed first.

so the "done = true" check will never happen as the whole gui functions are not tested at all.
#6
02/16/2007 (6:13 pm)
Ok I deleted
function loadStartup(){   // Startup the client with the ...   Canvas.setContent( StartupGui );   checkAudioInit();   Canvas.setCursor("DefaultCursor");
out of the init.cs, still did nothing, this is begining to suck because I have an indie license and I have to display the GG splash and it's not working.
#7
02/16/2007 (7:03 pm)
Have you deleted your dso's? Torque may be reading the old dso and not compiling it again.
What you have now, (after removing the above) is the same as I have.
#8
02/17/2007 (1:30 pm)
Mike, I did not know I had to delete dso's, there is still so much I do not know, and I never would have guessed that. Would it be safe practice to always delete all dso's when I make major changes? Thanks I will try this when I get off of work.
#9
02/17/2007 (2:45 pm)
DSO's are the compiled scripts, so every single time you do a script change, delete them. If the engine finds a dso of a specific script it won't bother to compile it, even if it has changed in the cs file.
Personally, I've grown the habit the always run the deldso's batch file before I start the exe.
#10
02/17/2007 (7:28 pm)
Well, is there a way to incorporate the game running deldso before it starts the engine, like a way to add it to something where that will be the first thing it runs before it initializes or execs any scripts? That would save a lot of hassle.
#11
02/17/2007 (7:55 pm)
It's really simple to make a bat file to delete dso files.

open notepad and put the following: del /s *.dso
Save it as delDso.bat and make sure to change from txt to all files then save. Put the bat file in the folder with your exe and click it. It will delete all the dso files in your game folders. There is no harm becouse as Johan said, they are just the compiled version of your cs files.
If you own tge 1.5, there is a delete dso bat file in the example folder.
#12
02/17/2007 (9:41 pm)
Ok thanks, what i was really meaning though is, and I am going to play around with it, want to figure it out myself, but is it possible to script in the running of that bat file, so that you can click on the game exe file or shortcut and before it does anything with the engine, or loads any other scripts, you can make it delete them for you, thereby eleminating having to delete the dso files. Not that I am lazy, just think it would be a good resource, could save someone lots of time and trouble in the future, as i spent 3 hours trying to make it work and all i had to do was delete a bat file and I didnt' know.