Author Topic: Simple if statement not working  (Read 2273 times)

Guywiththegun

  • Newbie
  • *
  • Posts: 8
    • View Profile
Simple if statement not working
« on: November 01, 2016, 11:10:44 AM »
I'm new at learning squirrel and I'm trying to edit a layout. I simply want to have this happen:

"If Current emulator is 'Mame', show marquee" "If not, don't show marquee"

I can get this to work where upon loading Attract Mode, it works. However cycling through displays will not "update" the code. Does anyone have any tips?

Guywiththegun

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Simple if statement not working
« Reply #1 on: November 02, 2016, 09:01:05 AM »
I figured out that I'm supposed to use transition callbacks. I could get it working by changing marquee.alpha depending on what the layout is. That's a nice workaround but I want to learn how to have the marquee not be drawn at all. My code here is not working:

local show_marquee = "No";

fe.add_transition_callback("selection_transition");
function selection_transition( ttype, var, ttime ) {
   if ( ttype == Transition.ToNewList) {
      local layout_name = fe.list.name;
    
     if (layout_name == "Arcade") {
      show_marquee = "Yes";
     }
   }
   return false;
}

if (show_marquee == "Yes"){
local marquee = fe.add_artwork("marquee", flx*0.172, fly*0.035, flw*0.30, flh*0.175 );
marquee.trigger = Transition.EndNavigation;
marquee.skew_x = -fly*-0.005;
marquee.skew_y = flx*0.023;
marquee.pinch_y = 15;
marquee.pinch_x = 0;
marquee.rotation = 0;
}

Anyone have any input?