Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: qqplayer on June 16, 2018, 12:18:51 PM
-
Tried to show a "favorite" icon on my layout.
::OBJECTS <- {
fav = fe.add_image( "favorite.png", 5, 55, 60, 60 ),
}
OBJECTS.fav.visible = false;
function show_favorite( ttype, var, ttime ) {
switch ( ttype ) {
case Transition.ToNewList:
case Transition.ToNewSelection:
local inf_fav=fe.game_info(Info.Favourite);
if (inf_fav=="1")
OBJECTS.fav.visible = true;
else
OBJECTS.fav.visible = false;
break;
}
return false;
}
fe.add_transition_callback( "show_favorite" );
The thing is the icon only shows "on layout start" and if I change the selected game , shows if I have the previous or the next game selected.
I mean . if I have three games, 1, 2, 3
2 is tag as favourite
If I move to 3 , the favourite icon is showed , same with 1 , but not with 2 :(
Only if I start the f.e. with the 2 game previously selected.
-
If all you want to do is toggle an image, use a magic function and case not favorite return an empty string for image url.
-
If all you want to do is toggle an image, use a magic function and case not favorite return an empty string for image url.
Example please :)
I`ve tried this but doesnt work for me
http://forum.attractmode.org/index.php?topic=670.0