Display two digits

borabora Member, PRO Posts: 45
edited November 2012 in Working with GS (Mac)
Hi,

i have a countdown from 60 to 0 - it´s working fine - but unter 10 it show only one digit "0" i want to sho two digits "00" how do i make this.

Thanks!!! ;-)

Comments

  • MantoManto Member Posts: 796
    edited November 2012
    Create a game attribute countdown and make it come down from 60 to 0.

    Then create a rule:

    if game.countdown is smaller than 10
    Display text: "0"..game.countdown
    otherwise
    Display text: game.countdown
  • borabora Member, PRO Posts: 45
    Thank you very much!

    And can you help me to display more than 999999 points (1500000) in Highscore.

    Thank you!


  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012

    @bora, Hi, @MotherHoose has a neat solution to this:

    http://forums.gamesalad.com/discussion/43171/display-large-integer

    By the way, when the GSC engine is no longer Lua, this problem should no longer exist.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    edited November 2012
    padInt(game.countdown,2) the padInt() function will add leading zeros if the value has not met the prerequisite number of digits.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012
    padInt(game.countdown,2) the padInt() function will add leading zeros if the value has not met the prerequisite number of digits.
    @CodeMonkey That's cool, CM! (As always). Thanks from me there; useful to know.

  • borabora Member, PRO Posts: 45
    Hi CodeMonkey - hi gyroscope.

    Thank you very much!
  • OpenFlo_StudioOpenFlo_Studio PRO Posts: 32
    thanks for the two methods of doing this.
Sign In or Register to comment.