How do you escape brackets when using SpriteFont?

0 favourites
  • 8 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Can you escape brackets when inputting SpriteFont text, without disabling BBCode?

  • Backslash \

    You need it only if you have open and closed brackets like: \[] or \[hello]

  • Backslash \

    You need it only if you have open and closed brackets like: \[] or \[hello]

    This doesn't seem to be a universal escaping the character itself though, because it doesn't seem like it works within an already opened BBCode tag.

    Is there any way to escape bracket characters regardless of whether it's inside a BBCode tag or not?

  • It should be working inside the tags. This "[scale=2]Hello \[scale] [/scale]" gives me "Hello [scale]"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Say, how about this. I need to print something like: "[ OR 3" But, I need the OR to have its own color.

    • This: \[ [color=#FFFF00] OR [/color] 3
    • Will print: [ [color=#FFFF00] OR 3
    • This: \[ [] [color=#FFFF00] OR [/color] 3
    • Will print: [ [] OR 3

    So, it seems like it it wants to escape a complete tag before its done escaping.

    This is a Spritefont.. I'm contemplating adding a fake character for the [. Any other thoughts?

  • It looks like '[' is possibly a reserved character. -> SpriteFont: Set text to "\[]" & "[color=#FFFF00] OR [/color] 3"

    Will print :

    [] OR (in yellow) 3

    In between quotes, at the beginning of the sentence "[]" does display : []

    Only having "[" does not do the job.

    Ashley would you have more information on the subject ?

  • It's a bug. "\[ [color=#FFFF00] OR [/color] 3" should still apply the color tag.

    In general things like this should be reported to the issue tracker. But I could reproduce this and adjusted the parser so it should be fixed in the next release.

  • Thanks, Ashley!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)