Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: JC10001 on April 01, 2017, 10:17:54 AM
-
I'm trying to uppercase the first letter of [DisplayName] and I keep getting all lower case letters. The issue seems to be when AttractMode is evaluating the magic token.
I found another thread about it here (http://forum.attractmode.org/index.php?topic=636.0) but I can't get the solution posted to work. I think because he is using fe.game_info and that's not a magic token.
I've tried fe.list.name - but it doesn't dynamically update and it always holds the same value.
As a workaround, I'm trying to see if there is there a way to get the currently selected display name WITHOUT using a magic token? Is this possible? If so, how?
-
In case you or others still need this:
function dname()
{
local current_display = fe.displays[fe.list.display_index];
return current_display.name;
}
You can use this function as a Magic Token so it will be updated like one:
local print_display = fe.add_text( "Display: [!dname]", x, y, w, h );
Mind the "!" before the function's name. It marks custom Magic Tokens.