Alice Community  

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

Reply
 
Thread Tools Display Modes
Lose the zero?
Old
dragnet
Member
 
Status: Offline
Posts: 38
Join Date: Jan 2010
Default Lose the zero? - 03-22-2010, 03:10 AM

Is there anyway to lose the zero at the end of a number when it is being displayed as a string. I assume it is due to the fact that Alice seems to use doubles for everything. I know you can not cast it to an integer, but has anyone figured out how to lose the zero without having to put something in front of it to hide it?

Thanks.
   
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-22-2010, 05:22 AM

Unfortunately, no.


(')>
   
Reply With Quote
Old
rankhornjp
Guest
 
Status:
Posts: n/a
Default 03-22-2010, 12:32 PM



Like this?
Attached Images
File Type: jpg screenShot.jpg (92.1 KB, 21 views)

Last edited by rankhornjp; 03-22-2010 at 12:40 PM.
   
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-22-2010, 03:41 PM

I tried that and it didn't work for me. It may work for him, though, I suppose.

Out of curiosity, are you using 2.0, rankhornjp?


(')>
   
Reply With Quote
Old
dragnet
Member
 
Status: Offline
Posts: 38
Join Date: Jan 2010
Default 03-22-2010, 04:02 PM

It works with the random function, but not with the round function.

Oh well!
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 578
Join Date: Nov 2008
Location: In the interwebs
Default 03-22-2010, 04:45 PM

THe random function works, or you could define this function in python:
PHP Code:
def int(num):
world.out int(num


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
dragnet
Member
 
Status: Offline
Posts: 38
Join Date: Jan 2010
Default 03-22-2010, 04:53 PM

I'm relatively new to Alice, but know Java, PLSQL, PHP, C#, C etc pretty well as well as some Python. How do you define a Python function and call it within Alice?
   
Reply With Quote
Old
dragnet
Member
 
Status: Offline
Posts: 38
Join Date: Jan 2010
Default 03-22-2010, 05:20 PM

Are the built in functions found in the Required/jython-2.1/Lib folder? If so how do I place a function into the /Lib folder and have it included into the Alice world?
   
Reply With Quote
Old
rankhornjp
Guest
 
Status:
Posts: n/a
Default 03-22-2010, 08:47 PM

Quote:
Originally Posted by x2495iiii View Post
I tried that and it didn't work for me. It may work for him, though, I suppose.

Out of curiosity, are you using 2.0, rankhornjp?

Yea, 2.04
   
Reply With Quote
Old
rankhornjp
Guest
 
Status:
Posts: n/a
Default 03-22-2010, 09:04 PM

Is this what you need?
Attached Images
File Type: jpg screenShot.jpg (87.8 KB, 14 views)
File Type: jpg screenShot2.jpg (92.0 KB, 14 views)
   
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.