Author Topic: Magic Tokens UPPERCASE?  (Read 6658 times)

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Magic Tokens UPPERCASE?
« on: March 18, 2016, 07:16:46 PM »
Having a little trouble making magic tokens uppercase. Tried quite a few things. Anyone know how to achieve this?

http://attractmode.org/docs/Layouts.html#magic
http://attractmode.org/docs/Layouts.html#game_info
http://www.squirrel-lang.org/doc/squirrel3.html <- See section about toupper()

verion

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 861
    • View Profile
    • new projects
Re: Magic Tokens UPPERCASE?
« Reply #1 on: March 19, 2016, 02:10:23 AM »
As a workaround you can use a font that has ONLY uppercase letters - like a free BEBAS font.
It will automatically make all your texts uppercase.

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Magic Tokens UPPERCASE?
« Reply #2 on: March 19, 2016, 09:52:48 PM »
I resolved this by passing a function to the magic token. I wish the function can take params... or can it?

Working Example
Code: [Select]
function test(){
  local text = fe.game_info(Info.Year);
  return text.topper();
}
fe.add_text("[!test]", 0, 0)

chrisvg

  • Full Member
  • ***
  • Posts: 78
    • View Profile
Re: Magic Tokens UPPERCASE?
« Reply #3 on: March 20, 2016, 12:41:43 AM »
Quote
Magic tokens can also be used to run a function defined in your layout or plugin's squirrel script to obtain the desired text. These tokens are in the form [!<function_name>]. When used, Attract-Mode will run the corresponding function (defined in the squirrel "root table"). This function should then return the string value that you wish to have replace the magic token. The function defined in squirrel can optionally have up to two parameters passed to it. If it is defined with a first parameter, Attract-Mode will supply the appropriate index_offset in that parameter when it calls the function. If a second parameter is present as well, the appropriate filter_offset is supplied.

from https://github.com/mickelson/attract/blob/master/Layouts.md#magic-tokens

Josepzin

  • Jr. Member
  • **
  • Posts: 10
  • Habitacus!
    • View Profile
    • Blog
Re: Magic Tokens UPPERCASE?
« Reply #4 on: September 09, 2017, 11:02:34 PM »
Thanks!!