padInt/padReal

FerinFerin Member Posts: 32
edited January 2012 in Working with GS (Mac)
Hi peeps
Does any one has any clue what are those functions in expression editor?
I've noticed them after last update, but dunno how and what for use 'em.
I believe Int stands for Integer and real for real, but here my deduction skills
get exhausted :p.

Didn't find any thing on that matter in cookbook nor google.

Comments

  • adalpilscazaadalpilscaza Member Posts: 44
    http://www.mediafire.com/download.php?0kh7b1z9xazln78 Here is a little thing I threw together. Not completely sure of all the uses of the two expressions, but I explained (what I think) they do.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    padInt(x,y) means you take the attribute x, and return an integer value with a minimum of y digits. So for a real attribute(game.real) of 3.1415, if you store padInt(game.real,3) in another real attribute, the value stored is 003, but the nature of a numerical attribute, it will chop off leading 0's. So using the padInt would be best used in a Display Text behavior for things like a Score or Level so you can see the leading 0's.

    padReal(x,y,z) is similar to padInt, but it takes the attribute x, with a minimum number of characters(including the decimal) y, and z digits to the right of the decimal.
    e.g. Taking the game.real attribute from above, padReal(game.real,10,6) would yield 003.141500 in a Display Text behavior.
  • FerinFerin Member Posts: 32
    edited January 2012
    Thank You very much guys, that clears things enough for me :D
Sign In or Register to comment.