Game Development Community

A funny problem with StartupGui.gui

by Tasty Green Pees :-, · in Torque Game Engine · 02/17/2006 (1:44 am) · 17 replies

I've beat my self to death trying to figure why this won't work... I can't crack it!

I'd appriciate some help.

I want a simple splashscreen to appear and then fade into the main menu

however when I run my game, the splash appears and then everything simply fades to black... no main menu or nothing.

this is the StartupGui.gui (as far as i can see it's flawless)...


//--- OBJECT WRITE BEGIN ---
new GuiFadeinBitmapCtrl(StartupGui) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./background";
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)
{
echo ("*** Load Main Menu");
loadMainMenu();
}
else
schedule(100, 0, checkStartupDone );
}

#1
02/17/2006 (2:40 am)
Could this have anything to do with when the StartupGui script is called
#2
02/17/2006 (10:26 am)
Help please!
#3
02/17/2006 (11:52 am)
I believe that you need a % in front of StartupGui.done (in all occurrences)
#4
02/18/2006 (12:20 am)
Hi Andy, I've put a % before each StartupGui.done but it seems to have no effect at all the splashcreen fades in... 3 seconds... fades to black... stays black... it's torture! I'm running out of hair to pull!

this is how my code looks now:

//--- OBJECT WRITE BEGIN ---
new GuiFadeinBitmapCtrl(StartupGui) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./background";
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==true)
{
echo ("*** Load Main Menu");
loadMainMenu();
}
else
schedule(100, 0, checkStartupDone );
}
#5
02/18/2006 (12:42 am)
If you click before it fades out, do you get to your main menu?

You should and thats how that is setup above, although you don't need the % symbols on the StartupGui.done if statements. *Your first script post looks fine*.

What you may need to do is copy the schedule(100, 0, checkStartupDone); and put in another one for as long as you need to compensate for fade out and have it automatically call click() or some other function..

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

Obviously, adjusting the 300 to a value that fits for what you need better

Jeremiah
#6
02/18/2006 (12:57 am)
Did you copy and paste this code? because you are missing a curly brace { before your else statement in checkStartupDone()
#7
02/18/2006 (1:11 am)
Actually he isn't.. The closing bracket is for the function, and the if part of the statement - the Else doesn't need one since it is single line
#8
02/18/2006 (2:05 am)
Ah yeah. you're right. My bad.
#9
02/18/2006 (7:21 am)
Guys, thanks for the help. I think i found the problem:

i haven't got any function called loadMainMenu();

because when i replaced it with loadMyMission();

it took me straight into the game after the splashscreen.

oh. and the function loadStartup was never being called so I added the line loadStartup();

so now what I got to figure out is which is the right function to call the main menu.

any ideas?
#10
02/18/2006 (7:30 am)
Guess what guys? I did it!

i replaced the loadMyMission(); line with Canvas.setContent(mainMenuGui);

this was the bit I had to change:
=============================

function checkStartupDone()
{
if (StartupGui.done==true)
{
echo ("*** Load Main Menu");
Canvas.setContent(mainMenuGui);
}
else
schedule(100, 0, checkStartupDone);
}

loadStartup();


so the next question... i think this one is easier... how do I get more than one splashscreen to fade in and out?

I'm sure someone must have racked this one already. pls advise
#11
02/18/2006 (1:43 pm)
Good that you figured it out. Sorry i was NO help whatsoever.

As for multiple splash screens... i don't know off the top of my head, but i know that the game Legends is all open scripts, so you could have a look at that. I think that all you need to do is what you already have, just multiple times. Instead of calling the main menu, call the next splash screen, then the next, so on and so forth. When all that's done, THEN call the main menu.
#12
02/18/2006 (5:11 pm)
I have this done currently and will paste what you need in a few minutes
#13
02/18/2006 (8:04 pm)
Okay, it was a bit longer than a few minutes :) but here is the whole file, just for reference -

//--- OBJECT WRITE BEGIN ---
new GuiFadeinBitmapCtrl(StartupGui) {
   profile = "GuiInputCtrlProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 8";
   visible = "1";
   helpTag = "0";
   bitmap = "~/data/objects/_gui/splashscreen/TgeLogo.jpg";
   wrap = "0";
   fadeinTime = "1500";
   waitTime   = "1000";
   fadeoutTime = "1500";
};
//--- OBJECT WRITE END ---

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

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

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

//--- OBJECT WRITE BEGIN ---
new GuiFadeinBitmapCtrl(StartupGui2) {
   profile = "GuiInputCtrlProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 8";
   visible = "1";
   helpTag = "0";
   bitmap = "~/data/objects/_gui/splashscreen/starburstlogo2";
   wrap = "0";
   fadeinTime = "1500";
   waitTime   = "1000";
   fadeoutTime = "1500";
};
//--- OBJECT WRITE END ---

function loadStartup2()
{
   StartupGui2.done = false;
   Canvas.setContent( StartupGui2 );
   schedule(100, 0, checkStartupDone2 );
}

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

//-------------------------------------
function checkStartupDone2()
{
   if (StartupGui2.done)
   {
     echo ("*** Load Main Menu");
      loadMainMenu();
   }
   else
      schedule(100, 0, checkStartupDone2 );
}

Thats basically it.. I removed the alxPlay and other things, as thats already in what you have and you can copy it around if you need it. Otherwise, this is fairly straight forward.
#14
02/19/2006 (6:40 am)
PREFECT! Done some programing before but I'm new to Torque so I'm estatic! Thanks Andy and Byte!
#15
02/20/2006 (12:23 am)
By the way, where can I get hold (download) the open script game Legends?

Thanks
#17
04/19/2009 (4:48 pm)
Gracias a todos los que participaron en este post, tambien agradezco ya que sin sus comentarios no hubiera aprendido como se realizan diferentes pantallas en el starup. Y gracias a Jeremiah por su código, me ayudo muchisimo.