GameSalad

Displaying Real Attribute

Pete79Pete79 Posts: 11Member, BASIC

Hi,
Anyone know how to show a real attribute to 2 decimal points only using display text i.e 00.00?. Its displaying really long numbers and I need to keep the size manageable.

Comments

  • tatiangtatiang Posts: 11,024Member, Sous Chef, PRO, Senior Sous-Chef

    prec(game.score,2)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Posts: 12,725Member

    @tatiang said:
    prec(game.score,2)

    I could be wrong here (correct me if I am) but I thought the use of 'prec' is no longer recommended as it's less efficient than something like roundTo(game.score,2) because 'precision' first needs to convert the attribute it is rounding to text, perform the operation, then convert it back to a number, whereas round/roundTo performs its operation directly on the number. Ultimately it's probably not a big deal, but worth knowing if your game is doing a lot of rounding.

  • tatiangtatiang Posts: 11,024Member, Sous Chef, PRO, Senior Sous-Chef

    No, you're probably right @Socks. I don't do a ton of rounding so I just checked the Cookbook and went with that.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Posts: 12,725Member
    edited October 30

    @tatiang said:
    No, you're probably right @Socks. I don't do a ton of rounding so I just checked the Cookbook and went with that.

    Ah ! The Cookbook, last updated in the late 1800s. :)

Sign In or Register to comment.