Author Topic: check if extra info empty for add animation  (Read 182 times)

beccobunsen

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
check if extra info empty for add animation
« 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 :

Code: [Select]
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 :

Code: [Select]
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
« Last Edit: April 30, 2020, 10:15:33 PM by beccobunsen »

beccobunsen

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: check if extra info empty for add animation
« Reply #1 on: May 03, 2020, 01:51:22 AM »
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  ;)

Code: [Select]
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" );


beccobunsen

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: check if extra info empty for add animation
« Reply #2 on: May 07, 2020, 01:59:23 PM »
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.. ::)



« Last Edit: May 07, 2020, 02:05:04 PM by beccobunsen »

beccobunsen

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: check if extra info empty for add animation
« Reply #3 on: May 09, 2020, 10:27:32 AM »
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"); )

Code: [Select]
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" );
« Last Edit: May 09, 2020, 10:30:50 AM by beccobunsen »