PDA

View Full Version : Number


Zack Strife
03-12-2010, 04:02 PM
I need to know, is there a way to set a string as a number variable (such as time or health) without having the .0 at the end?

Veryuhbull
03-12-2010, 05:47 PM
Hmm... i remember doing that once before but after trying for more than 15 minute i cannot replicate the process. I normally just cheat and place the number to the side of the screen and program it to stay in a place so that one can never see the stupid .0 hanging off. I bet someone else knows.

rankhornjp
03-12-2010, 08:17 PM
Create Variable: world.number
Create 3d text: "0"

Create new method:
3d text: set text to "0" as a string.
replace "0" with random number function
click more: interger only==true; min ==world.number; max==world.number

You can place it in a loop. Or create an event (While the world is running do: During: "method")

Zack Strife
03-17-2010, 02:24 PM
not what I meant. I wanted it to show the number without even the .0 so it just shows 1 instead of 1.0

rankhornjp
03-17-2010, 04:02 PM
Yea, that's what that line of code does:)

Zack Strife
03-26-2010, 03:56 PM
It didn't work for me this is how it looks on mine. what kind of computer do you have

rankhornjp
03-26-2010, 08:07 PM
I'm using a PC with Alice 2.0

Zack Strife
03-26-2010, 09:00 PM
I have 2.2 that must be the difference

jediaction
03-26-2010, 09:04 PM
Alice 2.2 makes a big difference in variables. If you are using variables (which you did) its gonna make a difference everytime just to tell you

Zack Strife
03-26-2010, 09:18 PM
Ah, ok

dragnet
03-27-2010, 12:09 AM
I'm running 2.2 and the random function works fine for casting to an int (no .0 at the end)

You can do it this way as well.

Create a world function called castInt.

Have it accept a parameter called inValue as a number

for the functions return value set it to random number minimum=inValue, integerOnly=true, maximum=inValue

This will return a number with no decimal place for any number you pass to it.