Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: kent79 on September 25, 2017, 05:14:53 PM
-
I would like to add select click sound while selected system, so added code as below. But sound can't run it properly. I suspect the sound is cutting when the theme was changed to game menu. We need to add "holding" control - the sound must play completed and then goto game theme. Anyone can know how to do it? Attachment is sample code. Please try. Thanks. :)
Ideal:
Select & click system -> play click sound fully -> goto game menu
Current:
Select & click system -> play click sound not completed -> goto game menu
case "select":
local bgMusic1 = fe.add_sound("start.mp3")
bgMusic1.playing=true
break;
-
I’m exhausted, so only take a quick look at the menu. Keep in mind that I haven’t used menus. Y’all know I have my personal machine only running one system.
I am not sure how „goto game menu“ is selected as there is a break in your switch case, and maybe default holds that logic? Regardless, you need to add a tick to constantly check if sound has stopped playing, or a certain time (length of sound) has passed. Once this is true, then proceed to „goto game menu“.
Hopefully that is enough to get you started. If you still need help, walk me through and I can look at it tomorrow night.
-
you could just put a starting sound that is unique upon entrance to each theme..
this is what i have used.
function start_theme( ttype, var, ttime ) {
switch ( ttype ) {
case Transition.StartLayout:
local sound = fe.add_sound("intro.mp3");
sound.playing=true;
break;
}
return false;
}
fe.add_transition_callback( "start_theme" );
i know its not the answer you were looking for butt just another way of getting a similar effect.
-
on that added note...a selection is technically the end of the system menu
so this should work .EndLayout
function start_theme( ttype, var, ttime ) {
switch ( ttype ) {
case Transition..EndLayout:
local sound = fe.add_sound("intro.mp3");
sound.playing=true;
break;
}
return false;
}
fe.add_transition_callback( "start_theme" );
-
on that added note...a selection is technically the end of the system menu
so this should work .EndLayout
function start_theme( ttype, var, ttime ) {
switch ( ttype ) {
case Transition..EndLayout:
local sound = fe.add_sound("intro.mp3");
sound.playing=true;
break;
}
return false;
}
fe.add_transition_callback( "start_theme" );
Try. But not working
-
on that added note...a selection is technically the end of the system menu
so this should work .EndLayout
function start_theme( ttype, var, ttime ) {
switch ( ttype ) {
case Transition..EndLayout:
local sound = fe.add_sound("intro.mp3");
sound.playing=true;
break;
}
return false;
}
fe.add_transition_callback( "start_theme" );
Transition needs to return false, and return true if sound playing is complete.
-
well as it apears it is built in to AM allready,
all you need to do is go in to your am.config and add
this one line.
sound
sound_volume 40
ambient_volume 20
movie_volume 30
select intro.mp3
displays_menu 01 - Hey You.mp3
ie: intro.mp3 = your.mp3 in the layout
and it will play when you select your system or game.