GUI - multiple splash screens - waitTime not working
by thud · in Torque Game Engine Advanced · 07/11/2007 (11:59 am) · 11 replies
I have three splash screen logos loading up before the main menu appears. Everything is working nicely, except for the waitTime associated with each one. It looks like the waitTime value entered for splash screen number one is being used for all three, instead of their unique values.
e.g.
splash 1 waitTime = 10000
splash 2 waitTime = 2000
splash 3 waitTime = 5000
When it runs, all three splash screens will remain on-screen for 10 seconds. The same thing happens in reverse. So if splash one is 1000 and other two are 9000, then all three will only show for 1 second.
Anyone else having this problem?
e.g.
splash 1 waitTime = 10000
splash 2 waitTime = 2000
splash 3 waitTime = 5000
When it runs, all three splash screens will remain on-screen for 10 seconds. The same thing happens in reverse. So if splash one is 1000 and other two are 9000, then all three will only show for 1 second.
Anyone else having this problem?
#2
07/12/2007 (6:07 am)
Yeah, I tried many variations of numbers betwixt the three splash screens, and they all still seem to adhere to whatever splash 1 is set at.
#3
Can you possible post the sources of the splash screens? That might help a lot.
In my first splash (the typcial GG splash) I have this GuiFadeinBitmapCtrl object with 4 secs:
and the second splash like this:
07/12/2007 (7:33 am)
Hmm, I have 2 splash screens in my game Supermaze and also in the FGE and in both the GG screen at first is shown for 4 seconds and the following splash screen is showed for 6 seconds. I'm pretty sure it works because I have on the second screen a sound beeing played that is exactly 6 seconds long to last until the 2. splash is faded out. So in general that works :-) Can you possible post the sources of the splash screens? That might help a lot.
In my first splash (the typcial GG splash) I have this GuiFadeinBitmapCtrl object with 4 secs:
new GuiFadeinBitmapCtrl(StartupGui) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./GarageGames";
wrap = "0";
fadeinTime = "125";
[b]waitTime = "4000";[/b]
fadeoutTime = "125";
};and the second splash like this:
new GuiFadeinBitmapCtrl(StartupGui2) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./decane";
wrap = "0";
fadeinTime = "125";
[b]waitTime = "6200";[/b]
fadeoutTime = "125";
};
#4
first
second
third
I also have music that lasts a specified time, but I've also just been counting out the time as it moves along. There should be a dramatic difference in amount of time each is on screen, but they all stay stubbornly at 12 seconds.
Any additional thoughts?
07/12/2007 (7:50 am)
I just tested these values to make sure that they still were misbehaving, and they are. All three splashes last for 12 seconds.first
new GuiFadeinBitmapCtrl(carSplash) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./carSplash";
wrap = "0";
fadeinTime = "125";
[b]waitTime = "12000";[/b]
fadeoutTime = "125";
};second
new GuiFadeinBitmapCtrl(boatSplash) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./boatSplash";
wrap = "0";
fadeinTime = "125";
[b]waitTime = "2000";[/b]
fadeoutTime = "125";
};third
new GuiFadeinBitmapCtrl(planeSplash) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./planeSplash";
wrap = "0";
fadeinTime = "125";
[b]waitTime = "6000";[/b]
fadeoutTime = "125";
};I also have music that lasts a specified time, but I've also just been counting out the time as it moves along. There should be a dramatic difference in amount of time each is on screen, but they all stay stubbornly at 12 seconds.
Any additional thoughts?
#5
from StartupGui.gui:
That's how it works for me. Ah, well, one moment, I post here both splash screen files so that you can see all of the code how it works for me:
StartupGui.gui
StartupGui2.gui
Does that help? If not, could you post the gui files here how you did it?
Martin
07/12/2007 (8:01 am)
Hmm, how did you include them in files? I mean, for my splash screens I copied the StartupGui.gui and made a second one called StartupGui2.gui. StartupGui 1 calls then in the code for the second screen ("loadStartup2"):from StartupGui.gui:
function checkStartupDone()
{
if (StartupGui.done)
{
//echo ("*** Load Main Menu");
//loadMainMenu();
echo ("*** Load Developer Screen");
[b]loadStartup2();[/b]
}
else
schedule(100, 0, checkStartupDone );
}That's how it works for me. Ah, well, one moment, I post here both splash screen files so that you can see all of the code how it works for me:
StartupGui.gui
//--- 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 = "./GarageGames";
wrap = "0";
fadeinTime = "125";
waitTime = "4000";
fadeoutTime = "125";
};
//--- OBJECT WRITE END ---
function loadStartup()
{
StartupGui.done = false;
Canvas.setContent( StartupGui );
schedule(125, 0, checkStartupDone );
StartupGui.audioHandle = alxPlay(AudioStartup);
}
//-------------------------------------
function StartupGui::click()
{
StartupGui.done = true;
alxStop(StartupGui.audioHandle);
}
function StartupGui::preLoad(%this)
{
//error("StartupGui:preload");
initMusicPlayer();
MusicPlayer.playTrack(MusicPlayer.getTrack(0)); // main menu music track 0
MusicPlayer.stop();
MusicPlayer.playTrack(MusicPlayer.getTrack(1)); // main menu music track 1
MusicPlayer.stop();
}
//-------------------------------------
function checkStartupDone()
{
if (StartupGui.done)
{
//echo ("*** Load Main Menu");
//loadMainMenu();
echo ("*** Load Developer Screen");
loadStartup2();
}
else
schedule(100, 0, checkStartupDone );
}StartupGui2.gui
//--- 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 = "./decane";
wrap = "0";
fadeinTime = "125";
waitTime = "6200";
fadeoutTime = "125";
};
//--- OBJECT WRITE END ---
function loadStartup2()
{
StartupGui2.done = false;
Canvas.setContent( StartupGui2 );
schedule(125, 0, checkStartupDone2 );
StartupGui2.audioHandle = alxPlay(AudioDecane);
}
//-------------------------------------
function StartupGui2::click()
{
StartupGui2.done = true;
alxStop(StartupGui2.audioHandle);
}
//-------------------------------------
function checkStartupDone2()
{
if (StartupGui2.done)
{
echo ("*** Load Main Menu");
loadMainMenu();
}
else
schedule(100, 0, checkStartupDone2 );
}Does that help? If not, could you post the gui files here how you did it?
Martin
#6
Here is the entire script, I hope it reveals a simple syntax error on my part.
(thanks for the continued help!)
07/12/2007 (8:15 am)
Hrmmmm... I kept all of the splash gui contained within the StartupGui.guiHere is the entire script, I hope it reveals a simple syntax error on my part.
(thanks for the continued help!)
//--- OBJECT WRITE BEGIN ---
new GuiFadeinBitmapCtrl(carSplash) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./carSplash";
wrap = "0";
fadeinTime = "125";
waitTime = "12000";
fadeoutTime = "125";
};
new GuiFadeinBitmapCtrl(boatSplash) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./boatSplash";
wrap = "0";
fadeinTime = "125";
waitTime = "2000";
fadeoutTime = "125";
};
new GuiFadeinBitmapCtrl(planeSplash) {
profile = "GuiInputCtrlProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
helpTag = "0";
bitmap = "./planeSplash";
wrap = "0";
fadeinTime = "125";
waitTime = "6000";
fadeoutTime = "125";
};
//--- OBJECT WRITE BEGIN ---
function loadSplashScreen()
{
$splashScreenIdx=0;
carSplash::next();
schedule(100, 0, checkSplashScreenDone );
$splashMusic = alxPlay(Music_splashMusic);
}
//-------------------------------------
function carSplash::click()
{
carSplash.done=true;
checkSplashScreenDone();
}
//-------------------------------------
function carSplash::next()
{
Canvas.setContent( BlankGui );
$splashScreenIdx++;
%bitmap[1] = "carSplash";
%bitmap[2] = "boatSplash";
%bitmap[3] = "planeSplash";
carSplash.setBitmap("game/client/ui/" @ %bitmap[$splashScreenIdx]);
carSplash.done=false;
Canvas.setContent( carSplash );
}
//-------------------------------------
function checkSplashScreenDone()
{
if (!isObject(carSplash))
return;
if (carSplash.done)
if ($splashScreenIdx==3)
{
carSplash.done=1;
carSplash.delete();
boatSplash.delete();
planeSplash.delete();
flushTextureCache(); // dont wanna keep the startup logos in vram
loadMainMenu();
alxStop($splashMusic);
$menuMusic = alxPlay(Music_MainMenu);
} else {
carSplash::next();
schedule(100, 0, checkSplashScreenDone );
}
else
schedule(100, 0, checkSplashScreenDone );
}
//--- OBJECT WRITE END ---
#7
So you could simply delete the boatSplash and planeSplash and use only the carSplash one and extend it by the wait time you want to have different. As example and without having tested it, you could add in carSplash::next() also
%bitmap[1] = "carSplash";
%bitmap[2] = "boatSplash";
%bitmap[3] = "planeSplash";
%time[1] = "2000"; // <- new!
%time[2] = "4000"; // <- new!
%time[3] = "6000"; // <- new!
and before the
carSplash.setBitmap... call
you put in a line like this:
carSplash.waitTime = %time[$splashScreenIdx];
to set the time for each splash correctly.
Might be a way to solve it.
07/12/2007 (8:22 am)
Ah, got the bug. You're using 3 GuiFadeinBitmapCtrl's (carSplash, boatSplash, planeSplash) but in the code you're always referencing *only* the carSplash bitmap ctrl ("carSplash.setBitmap..."). So you could simply delete the boatSplash and planeSplash and use only the carSplash one and extend it by the wait time you want to have different. As example and without having tested it, you could add in carSplash::next() also
%bitmap[1] = "carSplash";
%bitmap[2] = "boatSplash";
%bitmap[3] = "planeSplash";
%time[1] = "2000"; // <- new!
%time[2] = "4000"; // <- new!
%time[3] = "6000"; // <- new!
and before the
carSplash.setBitmap... call
you put in a line like this:
carSplash.waitTime = %time[$splashScreenIdx];
to set the time for each splash correctly.
Might be a way to solve it.
#8
Thank you very much for your help!
Oh... do the audio starts and stops seem correct? I wasn't sure if that was the cleanest way to put them in there.
07/12/2007 (8:35 am)
That seems to have done the trick! Too cool.Thank you very much for your help!
Oh... do the audio starts and stops seem correct? I wasn't sure if that was the cleanest way to put them in there.
#9
Yes, they seem correct so far. Does it work with the audio sounds as expected?
07/13/2007 (12:24 am)
Cool, glad it worked out, super.Yes, they seem correct so far. Does it work with the audio sounds as expected?
#10
07/13/2007 (6:13 am)
Yes, the audio is working as expected. I just wasn't sure if those were the cleanest ways to implement them. Thanks for taking a look, you've been a great help!
#11
07/13/2007 (6:16 am)
You're welcome :-)
Torque Owner Bobby Leighton
Imagn' Games