This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-07-15 00:33:08

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Decimals with Variables

How can I go multiple decimal places with variables? I am making a game that uses the variable to display money, but I need it to go down to the hundredths place to show ALL of your money. Is ther eany way to do this (and I tried when green flag clicked set Money to 3.00)


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#2 2008-07-15 00:37:49

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Decimals with Variables

Please, it's bugging me


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#3 2008-07-15 00:41:52

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Decimals with Variables

I don't think u can actually put it down to the hundreds unless ur really accurate

Offline

 

#4 2008-07-15 00:43:20

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Decimals with Variables

deatheater wrote:

I don't think u can actually put it down to the hundreds unless ur really accurate

What do you mean? I'm just trying to have it start at 3.00 dollars and make it easier to change you values


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#5 2008-07-15 00:46:14

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Decimals with Variables

well, if u upload it the decimal places go to the billions, but if ur exact u can make it so it only goes to the hundreds  smile

Offline

 

#6 2008-07-15 00:47:51

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Decimals with Variables

deatheater wrote:

well, if u upload it the decimal places go to the billions, but if ur exact u can make it so it only goes to the hundreds  smile

You mean I need an equation? Well, I guess I won't do this game than  sad  because of that lack of function


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#7 2008-07-15 14:12:16

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: Decimals with Variables

I tried multiple ways of achieving a hundredth's place but couldn't found a way. It doesn't seem like it shows it as it always rounds to the closest tenth.

Offline

 

#8 2008-07-15 14:14:05

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Decimals with Variables

Zelda123 wrote:

I tried multiple ways of achieving a hundredth's place but couldn't found a way. It doesn't seem like it shows it as it always rounds to the closest tenth.

If anyone can find a way, I'll continue the game. I know one time I tried to get it to equal Pi and I got it the like ……… Hundred Thousandths or something


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#9 2008-07-15 14:47:16

shadow_and_sonic
Scratcher
Registered: 2008-07-14
Posts: 36

Re: Decimals with Variables

ha ha (lol) u see these blocks <move( 20000000000 )steps> <say[ vote who you think will win ]for( 99999999999999999999999999999999999999999 )secs>

Offline

 

#10 2008-07-15 15:24:01

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Decimals with Variables

Bluestribute wrote:

Zelda123 wrote:

I tried multiple ways of achieving a hundredth's place but couldn't found a way. It doesn't seem like it shows it as it always rounds to the closest tenth.

If anyone can find a way, I'll continue the game. I know one time I tried to get it to equal Pi and I got it the like ……… Hundred Thousandths or something

It seems that variables will only display to the nearest tenth.  But the Say function will show lots of decimal places.  And, you can use one of Kevin_karplus routines, like this one,

http://scratch.mit.edu/projects/kevin_karplus/2951

that use the Stamp function to print out decimal numbers.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#11 2008-07-15 18:12:57

Rurigok
Scratcher
Registered: 2008-01-24
Posts: 93

Re: Decimals with Variables

You could have something to say the amount of money when clicked, using "
When (?) clicked, say "money" for (X) seconds.  It will display the decimals, even if you cant see it on the actual variable. (You insert the oval variable block into the say block)

Last edited by Rurigok (2008-07-15 18:14:22)


Creator of Imperion Online(a MMO)
ImperionOnline/Cyclone103's forums.

Offline

 

#12 2008-07-15 18:16:13

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Decimals with Variables

We really need single and double precision floating-point variables.


All your base are belong to us

Offline

 

#13 2008-07-15 18:24:04

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Decimals with Variables

Cyclone103 wrote:

We really need single and double precision floating-point variables.

I think we already have sufficiently accurate variables...what we don't have is any easy way to format them for output to the screen!


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#14 2008-07-15 18:25:13

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Decimals with Variables

Paddle2See wrote:

Cyclone103 wrote:

We really need single and double precision floating-point variables.

I think we already have sufficiently accurate variables...what we don't have is any easy way to format them for output to the screen!

That is true!


All your base are belong to us

Offline

 

#15 2008-07-15 18:31:03

joeyman
Scratcher
Registered: 2008-03-28
Posts: 1000+

Re: Decimals with Variables

just say set money to 2.99 |or| change money by 2.56

There was also a math block that used rounding...


Joeyman: On Scratch since March 28, 2008.
Over 142 projects! (And recently a Brony, and PROUD of it!)

Offline

 

Board footer