Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: beccobunsen on April 28, 2020, 03:08:28 AM
-
I there, after hours of try and errors (all errors), this is my problem:
I have an text animation (slider) :
var = fe.game_info(Info.Extra, 0);
When var is not empty, fire the animation, else no slider.
This is very easyfor someone..., but i cant figure out properly.
this is my code
this work :
local move_trans_back_text = {
when = Transition.EndNavigation,
tween = Tween.Bounce,
property = "x",
start = flx*0,
end = flx*0.280,
time = 500,
delay = 5000
}
local move_trans_back_hide = {
when = Transition.ToNewSelection,
property = "x",
start = flx*0.280,
end = flx*0,
time = 0
}
local move_trans_back_text_start= {
when = Transition.StartLayout,
tween = Tween.Bounce,
property = "x",
start = flx*0,
end = flx*0.280,
time = 500,
delay = 5000
}
animation.add( PropertyAnimation( sysview, move_trans_back_text) );
animation.add( PropertyAnimation( sysview, move_trans_back_text_start) );
//hide
animation.add( PropertyAnimation( sysview, move_trans_back_hide ) );
this give me true or false, but i cant use that for an if else cicle :
function check_text( index_offset, var ) {
local text = fe.game_info(Info.Extra, 0);
if (text != "") return true;
else return false;
}
if (var == false) {
animation.add(PropertyAnimation( sysview, move_trans_back_hide) );
}else
{ animation.add( PropertyAnimation( sysview, move_trans_back_text) );
animation.add( PropertyAnimation( sysview, move_trans_back_text_start) );
}
Anyone?
Thanks.. :o
-
well, I found a solution, it is not elegant but it works.
I can't stop the animation, I hide the background of the text ;)
function hidenoextra( ttype, var, ttime )
{
if ( ttype == Transition.StartLayout || ttype == Transition.FromOldSelection )
{
local var = fe.game_info(Info.Extra, 0);
if (var == "") sysview.bg_alpha = 0;
else sysview.bg_alpha = 190;
}
}
fe.add_transition_callback( "hidenoextra" );
-
This work for Extra, but is not working for Overview! , anyone Know how ovierview is hard coded and the variable disponible for if cicle?
I post an image for my pinball theme in beta.
Sorry for my Chunky English, I am an Italian living in Sud America....Answers in Italian and Spanish are welcome.. ::)
-
Well, well ... I solved this...., in this cathartic (solitaire) post.
If anyone needs it in the future.
this very bruteforce code, first check if there are game.txt files in scraper / emulator / scraper, if yes, the alpha of the text background animation is 190, i'm not checking if the txt is empty.
( need : fe.load_module("file"); )
function hidenoextra( ttype, var, ttime )
{
function overview_exist(fullpathfilename)
{
try {file(fullpathfilename, "r" );return true;}catch(e){return false;}
}
local OVEX = overview_exist("../Attract/scraper/" + fe.game_info( Info.Emulator ) + "/overview/" + fe.game_info(Info.Name) + ".txt");
if ( ttype == Transition.StartLayout || ttype == Transition.FromOldSelection )
{
if (OVEX == false) sysview.bg_alpha = 0;
else sysview.bg_alpha = 190;
}
}
fe.add_transition_callback( "hidenoextra" );