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

#1 2012-10-15 12:14:29

dave1998
New Scratcher
Registered: 2011-04-27
Posts: 56

Variables Point numbers

When a variable goes into points i.e 192 into 192.3
how do i script-
if variable has .3 in it
change variable by -0.3
any help
big_smile

Offline

 

#2 2012-10-15 12:21:24

dave1998
New Scratcher
Registered: 2011-04-27
Posts: 56

Re: Variables Point numbers

SOMEONE REPLY!!!!
...plz...

Offline

 

#3 2012-10-15 12:25:19

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: Variables Point numbers

this is a bug,and it's is quite common


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#4 2012-10-15 12:46:15

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: Variables Point numbers

You can use

change [variable v] by ((-1) * ((variable) mod (1)))
smile

Offline

 

#5 2012-10-15 12:53:05

dave1998
New Scratcher
Registered: 2011-04-27
Posts: 56

Re: Variables Point numbers

Gravitation wrote:

You can use

change [variable v] by ((-1) * ((variable) mod (1)))
smile

I would say thanks... If I had any idea what you were talking about...
well..i kinda get it... but how does it work?

Offline

 

#6 2012-10-16 16:11:55

northmeister
Scratcher
Registered: 2011-07-12
Posts: 1000+

Re: Variables Point numbers

Use the 'round' block.


http://i48.tinypic.com/5a25g5.png

Offline

 

#7 2012-10-17 15:31:20

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Variables Point numbers

Do you want to simply remove the decimal? Round off to the nearest whole number? If a) you can use:

set [variable v] to (round ((variable) - (0.5)))
If b) it's simply:
set [variable v] to (round (variable))

Offline

 

Board footer