Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Solution: Use integers as string without decimal
Old
TroyFrostwind
Guest
 
Status:
Posts: n/a
Talking Solution: Use integers as string without decimal - 05-20-2008, 04:34 PM

Well, I was looking around, trying to find the solution, and I wasn't getting any response, so I spent some time trying to look for different methods to use an integer in a string (I used mine in a 3D text) without the decimals.

It took me some time, but I finally found a way to accomplish this:
I'll show you something from my health bar.

Also a part of this, I created a number variable (realize, in my health bar example) within the method to help me with the printing. You could actually go around using this variable, but I like having the entire code in sight.

Heres how I did it:
[world.health] set value to (world.health - world.damaging)
[realize] set value to [random number [integer only=true][minimum=world.health][maximum=world.health]]
[health meter] set text to [[HP:] joined with [[realize as a string] joined with [100]]]


Hope thats not too confusing =D
   
Reply With Quote
Also works for a clock
Old
stephenmgj
Guest
 
Status:
Posts: n/a
Thumbs up Also works for a clock - 07-16-2008, 12:10 AM

Thanks for putting the missing cog into my clock! I had made the connection with the random number to make an integer but not using the max and min values - very cunning. I will post the clock when I am done.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.