Alice Community  

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

Reply
 
Thread Tools Display Modes
Number being a little too exact?
Old
Delpenator
Guest
 
Status:
Posts: n/a
Default Number being a little too exact? - 03-02-2010, 10:02 PM

For one of the games i am making, a have a timer that counts up from zero and stops whenever a certai nevent happens etc. It works fine, but i wanted it to go to 2 decimal places, and i forgot about loss of precision. Is there anyway to get rid of all those zeros at the end or do i have to hide them off screen?
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 03-02-2010, 10:07 PM

There's a rounding function under the world's function list which allows you to round a number to the nearest integer.


(')>
   
Reply With Quote
Old
Delpenator
Guest
 
Status:
Posts: n/a
Default 03-02-2010, 10:20 PM

any way i can round it to the hundredth's place? Or tenth's place? that would be better.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 03-02-2010, 10:32 PM

Nope, but you can multiply it by 100, round it, then divide it by 100 again.


(')>
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 03-02-2010, 10:34 PM

It would look something like this:

(round(x*10))/10

so, if x was 2.6453, it would return 2.6.

Ninja'd by x2495iiii
   
Reply With Quote
Old
Delpenator
Guest
 
Status:
Posts: n/a
Default 03-02-2010, 10:37 PM

Thank you.
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 03-03-2010, 07:16 AM

Never thought of that. Dont know where those functions are yet, humph i never took Alice classes, i learn on my own thats why my games are not Frame rate Profesional


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
Humza
Guest
 
Status:
Posts: n/a
Default 03-23-2010, 04:00 PM

or if you want to round it to like 10, or 32, or 54 etc.
just use random number maxiumum world.score and minimum world.score, integeronly=TRUE.duration 0secs
   
Reply With Quote
Old
dubastot
Senior Member
 
dubastot's Avatar
 
Status: Offline
Posts: 661
Join Date: Apr 2009
Location: Two Steps From Hell
Default 03-24-2010, 10:05 PM

I am with you jedi because I never took alice lessons either. Anyways, I never thought of that method Humza. I don't understand it at all.
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 03-25-2010, 07:31 AM

YAh, learning with out a text book is funner. I need to male my games have less events. My A-tom project will be efficient!


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
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.