Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: 8bitsdeep on March 28, 2020, 09:10:57 PM
-
Normally when you hold down an arrow key, the key repeat triggers and AM will quickly start scrolling through your list. However, my current theme scrolls sideways instead of vertically, so I handled the signals accordingly in the script to keep things intuitive for the user without having to remap controls specifically for my theme. But doing this stops key repeat from working.
fe.add_signal_handler( this, "on_signal" );
function on_signal( sig ) {
if(sig == "left"){
fe.list.index--;
return true;
}
else if(sig == "right"){
fe.list.index++;
return true;
}
else return false;
}
Is there a way to fix this or perhaps a better way to handle a horizontal scroll input?
-
here you are. my friend
should work good.
function on_signal( sig )
{
switch ( sig )
{
case "up":
fe.signal( "" );
return true;
case "down":
fe.signal( "" );
return true
case "left":
fe.signal( "prev_game" );
return true;
case "right":
fe.signal( "next_game" );
return true;
case "select":
default:
}
return false;
}
fe.add_signal_handler(this, "on_signal");
-
Perfect, thank you!