Author Topic: Insert game information into a file on removing a game from favourites.  (Read 614 times)


  • Full Member
  • ***
  • Posts: 40
    • View Profile
I've got a plugin as follows.

Code: [Select]
// This plugin regenerates the "Favourites.txt" romlist when a game is selected as a favourite or deselected as a favourite
fe.add_transition_callback( "favourites" );
function favourites( ttype, var, ttime )
 switch ( ttype )
  case Transition.ChangedTag:
                system( "sudo /bin/bash /opt/retropie/configs/all/" ); // Starts the Favourites bash script to update the Favourites romlist whenever a game is tagged or untagged
        return false;

The above code works well for every layout/display by invoking the bash script.

However, I'd also like to include some "Transition.ChangedTag" code in one layout only. 

I've got the following code in one of my layouts/displays, but it does not work.  I'm not sure why:

Code: [Select]
fe.add_transition_callback( "remove_favourite" );
function remove_favourite( ttype, var, ttime )
{ if ( ttype == Transition.EndNavigation || ttype == Transition.ChangedTag )
                system( "echo '" + fe.game_info( Info.Name ) + "' > ~/.attract/current_name.txt" );
                system( "echo '" + fe.game_info( Info.Title ) + "' > ~/.attract/current_title.txt" );
                system( "echo '" + fe.game_info( Info.System ) + "' > ~/.attract/current_system.txt" );
        return false;

Basically, on removing a game as a favourite from a particular romlist, I'd like to record some information about the game that has been removed.  However, the above code doesn't produce the current_name.txt file or the other files. 

Could I please ask for some help?  Thanks.