Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: iOtero on June 02, 2018, 02:37:59 AM
-
In my layout this code works perfectly:
// Hand Held
local artwork = fe.add_image("hh/[Emulator].png", flx*0.52, fly*0.4, flw*0.260, flh*0.462);
artwork.preserve_aspect_ratio = true;
// Boxart
local box = FadeArt("boxart", flx*0.52, fly*0.6, flw*0.130, flh*0.231);
box.preserve_aspect_ratio = true;
box.trigger = Transition.EndNavigation;
But if I add these modifications ("Watch & Game" is an emulator), it does not work:
local myboxart = "[Emulator]";
if (myboxart == "Watch & Game")
{
// Boxart
local box = FadeArt("boxart", flx*0.52, fly*0.6, flw*0.130, flh*0.231);
box.preserve_aspect_ratio = true;
box.trigger = Transition.EndNavigation;
}
else
{
// Hand Held
local artwork = fe.add_image("hh/[Emulator].png", flx*0.52, fly*0.4, flw*0.260, flh*0.462);
artwork.preserve_aspect_ratio = true;
}
Could someone tell me what I'm doing wrong?
Thanks in advance.
-
Not tested, I think you need a function with transition callbacks.
I made this for system info
http://forum.attractmode.org/index.php?topic=2258.0
//box_system
function box_system(ttype, var, ttime)
{
switch ( ttype )
{
case Transition.ToNewList:
case Transition.StartLayout:
//case Transition.ToNewSelection:
//case Transition.FromOldSelection:
switch ( fe.list.name )
{
case "Watch & Game":
local artwork_image = fe.add_image("hh/[Emulator].png", flx*0.52, fly*0.4, flw*0.260, flh*0.462);
artwork_image.preserve_aspect_ratio = true;
break;
}
}
}
fe.add_transition_callback("box_system" );
-
"Watch & Game"
It may be invalid character, try to use another one
-
I've writted two "" , but maybe this will work even with "&"
ocal a = "I'm a wonderful string\n"
// has a newline at the end of the string
local x = @"I'm a verbatim string\n"
// the \n is copied in the string same as \\n in a regular string "I'm a verbatim string\n"
So:
//box_system
local x = @"Watch & Game"
function box_system(ttype, var, ttime)
{
switch ( ttype )
{
case Transition.ToNewList:
case Transition.StartLayout:
//case Transition.ToNewSelection:
//case Transition.FromOldSelection:
switch ( fe.list.name )
{
case "x":
local artwork_image = fe.add_image("hh/[Emulator].png", flx*0.52, fly*0.4, flw*0.260, flh*0.462);
artwork_image.preserve_aspect_ratio = true;
break;
}
}
}
fe.add_transition_callback("box_system" );
-
Thanks for your help... ;D
-
This should be another solution
http://forum.attractmode.org/index.php?topic=192.0