Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: mahuti on May 30, 2017, 08:54:37 PM

Title: [SOLVED] Configure AM using script instead of Tab key
Post by: mahuti on May 30, 2017, 08:54:37 PM
I would like to be able to pick a menu item to launch the "tab" menu, rather than having to hit the tab key itself. Why? So I don't have to have a dedicated key just for "tab" or a keyboard, and I would only like setup to launch from the setup screen itself.

So I started poking around the internet... before I go off deep in the weeds testing a bunch of stuff out, I wondered if anyone had any input on this.

I was wondering if setting the "!! Press TAB to configure AM.sh" to be a bash script with some kind of xdotools or something similar would work. I haven't poked around in the code too much yet, just wondered if someone else had already done something like this.
Title: Re: Configure AM using script instead of Tab key
Post by: xbs on May 31, 2017, 02:11:08 AM
You don't have to have a dedicated key just for "tab"... you can use a combo ;)
Title: Re: Configure AM using script instead of Tab key
Post by: mahuti on May 31, 2017, 06:13:13 AM
Yes. I get that, thanks for the suggestion.. But I would still prefer just being able to make a selection.
Title: Re: Configure AM using script instead of Tab key
Post by: bjose2345 on May 31, 2017, 08:00:39 AM
fe.signal("configure") ¿maybe this?
Title: Re: Configure AM using script instead of Tab key
Post by: mahuti on June 02, 2017, 07:01:10 PM
I'll take a look. Taking any ideas right now :-)
Title: Re: Configure AM using script instead of Tab key
Post by: liquid8d on June 02, 2017, 10:36:18 PM
yep, fe.signal("configure") will launch settings just like pressing tab :)
Title: Re: Configure AM using script instead of Tab key
Post by: mahuti on June 02, 2017, 11:02:37 PM
I haven't investigated yet... I've been writing a screen saver tonight.

So... forgive my asking: how would one trigger fe.signal("configure") by clicking on a rom? I realize I could make a menu and do something that way, but it'd take a lot longer than leveraging the standard romlist. Maybe I'm not thinking about it right.
Title: Re: Configure AM using script instead of Tab key
Post by: mahuti on June 02, 2017, 11:12:30 PM
Maybe something like this:

Code: [Select]
fe.add_signal_handler("check_select");
function check_select( sig )
{
   if ( sig == "select" )
   {
       if ([insert rom stuff here] == [romname])
      {
            fe.signal("configure")
            return true;
       }
    }

   return false;
}
Title: Re: Configure AM using script instead of Tab key
Post by: mahuti on June 02, 2017, 11:36:28 PM
This worked:

Code: [Select]
fe.add_signal_handler("check_select");
function check_select( sig )
{
   if ( sig == "select" )
   {
       if (fe.game_info( Info.Title ) == "Press TAB to Configure")
      {
            fe.signal("configure")
            return true;
       }
    }

   return false;
}