Attract-Mode Support > Scripting
Q: a bought, adding favorites
(1/1)
jedione:
looking for some direction, on the easiest way to add "favorites " into a theme
i have never had them in a theme before... where say like selecting and un-selecting
with an icon that shows up,,, thanks anyone..
ok i see their is an "add/remove favorite" under controls to assign to key or button
but how is this linked to an image to show or hide?
jedione:
well till, some one can show an simpler method, im going to be borring this code from
arcadebliss cab
--- Code: ---</ label="Favorite Icon Type", help="Show which favorite icon should be should on non favorite filters", options="NONE,SOLID,WIREFRAME", order=10 />
favicon="SOLID";
local favIconType="images/favorites/favorite-solid.png";
switch (my_config["favicon"])
{
case "NONE":
favIconType="images/favorites/favorite-none.png";
break;
case "SOLID":
favIconType="images/favorites/favorite-solid.png"
break;
case "WIREFRAME":
favIconType="images/favorites/favorite-wireframe.png"
break;
}
local fav = sur.add_image(favIconType,fi[0],fi[1],fi[2],fi[3]);
//local fav = sur.add_image(favIconType,GAMEITEMWIDTH-19,GAMEITEMHEIGHT-20,16,16);
fav.visible = false;
--- End code ---
keilmillerjr:
Favorites is like a tag that can be used in/as a filter.
You can use a magic token or magic token custom function to change a text object’s msg. You can also use a magic token custom function to change an image’s name. Empty string will show no image.
You can also use a callback for crazier stuff.
jedione:
for anyone who wants, this is the easiest code i could find,,,, tested and working ;D
taken from, theme "Dal1980 v1.0 Hello-Nintendo" thanks
--- Code: ---local favHolder = fe.add_image("parts/favourite-off.png", 430, 28, 60, 56);
function getFavs(index_offset) {
if(fe.game_info( Info.Favourite, 0 ) == "1") return "parts/favourite-on.png";
else return "parts/favourite-off.png";
}
fe.add_transition_callback( "update_my_list" );
function update_my_list( ttype, var, ttime ) {
favHolder.file_name = getFavs(0);
if(ttype == Transition.StartLayout){
drawNextPage(0);
favHolder.file_name = getFavs(0);
}
else if(ttype == Transition.EndNavigation){
if(resetDrawGrid) drawNextPage(0);
favHolder.file_name = getFavs(0);
}
return false;
}
--- End code ---
Navigation
[0] Message Index
Go to full version