Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: PocketChange on February 17, 2020, 11:49:12 AM

Title: Displays menu - detect current selection
Post by: PocketChange on February 17, 2020, 11:49:12 AM
I am trying to create a displays theme and am having difficulty with finding the currently selected display name.  The best option so far appears to be   fe.game_info(Info.Name), but I can only seem to get this value on the initial startup of the theme.

Code: [Select]
local selectionname = fe.game_info(Info.Name);

function my_transition_check( ttype, var, ttime ) {
   switch ( ttype ) {
    case Transition.StartLayout:
    case Transition.ToNewSelection:
    case Transition.ToNewList:
    case Transition.EndNavigation:
        selectionname = fe.game_info(Info.Name);
        local textselectionname = fe.add_text(selectionname, flx*0.18, fly*0.905, flw*0.3, flh*0.035 );
       break;
  }
 return false;
}
fe.add_transition_callback("my_transition_check" );

This works on Transition.StartLayout, but not for any other transitions. Just never updates when selecting from the wheel. If I enter a display and return back then it is updated with the new value.

I need someone else's eyes to point out my mistake. Any help is appreciated.

Title: Re: Displays menu - detect current selection
Post by: keilmillerjr on February 17, 2020, 12:05:47 PM
fe.displays[fe.list.display_index].name ? Doing from memory. Correct if wrong.
Title: Re: Displays menu - detect current selection
Post by: PocketChange on February 17, 2020, 02:14:04 PM
fe.displays[fe.list.display_index].name ? Doing from memory. Correct if wrong.

From what I have researched this should work, but any usage of
Code: [Select]
local selectionname = fe.displays[fe.list.display_index].name; ends the script.  I'm not certain what is happening here yet.  It will not work to assign to a variable, or in a comparison.  I can see other examples of it's usage in these forums and in those examples the usage is no different.  Is there some extra context that is necessary? Maybe this property is not available when in the displays menu?

Update:
Testing has confirmed that while this works for normal themes, this will not work for the Displays menu.  Is there anything that can be used for the displays menu?  The current list selection has to be stored somewhere, right?