View Full Version : Number string without decimal without "int as string"

04-10-2013, 06:24 PM
So how would I create an integer string, without the "int as string" function?

My school is still using 2.0, and it does not have the "int as string" function. All the tutorials I've found use that function.

I tried round and floor, but the string conversion seems to add the decimal after the fact (even if the number given does not have a decimal, it still gets added).

Thanks, Tim

EDIT: Figured out a way to do it. See next message.

04-10-2013, 10:04 PM
Well, I thought of one way of doing it. Make a string list of the digits 0-9 and use the list to build the number string.

In my current case I needed to make a timer for class with both minutes and seconds (count down timer). So I first separrated the time into minutes and seconds variables, then I converted those to strings by pulling characters from my integerStrings list.

For the 2 digit seconds counter I used:
secondsString set value to ( ( item ( floor ( ( timer.seconds / 10 ) ) ) from timer.integerStrings ) joined with ( item ( ( timer.seconds - ( ( ( floor ( ( timer.seconds / 10 ) ) ) * 10 ) ) ) ) from timer.integerStrings ) )

Same thing with different variables for minutes.

When minutes dropped to single digit I used:
minutesString set value to ( item timer.minutes from timer.integerStrings )

Then I just combine them with a colon in the middle.

Don't know if anyone else is still using v2.0 without the "int as string" function, but if you are, this is a way to get your number strings without decimals.

Of course it would be easier of my school would just upgrade to a newer version with the function. I'm using v2.3 at home, and was quite surprised when I got to class and found my code would not load. :eek: So far that's the only incompatibility I've found (other than a bug in 2.0 that's fixed in 2.3). All the other stuff I've written has worked in class.

04-22-2013, 03:30 PM
Not a bad solution.

If other uses encounter this problem with any frequency, I'll pin this.