Hi, I am working on a plugin which exports/ pastes gameinfo to a text file on signal (button press). I found lots of help from this thread >
http://forum.attractmode.org/index.php?topic=2420.0 (#4, raygun).
The code from raygun is:
fe.add_transition_callback( "gamename_transition" );
function gamename_transition( ttype, var, ttime )
{
if (( ttype == Transition.EndNavigation )
|| ( ttype == Transition.StartLayout ))
{
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;
}
Since I wanted the export to text on signal, I've tweaked raygun's code a bit. My code:
fe.add_signal_handler(this, "on_signal");
function on_signal( sig1 )
{
if ( sig1 == "custom3" )
{
system( "echo '" + fe.game_info( Info.Name ) + "' > ~/.attract/current_name.txt" );
return true;
}
return false;
}
I am facing following issues with the code and can use some help from more experienced members.
1) Whenever I press the signal button, cmd flashes for a second. Is it possible to do this in background with cmd completely hidden?
2) What I am aiming for is:
a) on signal press
b) search if "selected" exists in text file or not
c) if "selected" exists, do nothing.
d) if "selected" doesn't exist add it to the end of the list.
After searching thoroughly I can't figure out if the above mentioned code is even possible in AM. In the examples I've seen search functions are being called outside AM in batch or script, while the data (game info) is from AM and can't be accessed directly via batch/ script. So I am in a quandary how to select data from within AM and use batch/ script on it - or whether the above mentioned can be done from within AM directly. Can any one please guide me in this regard?