Discuss Scratch
- Discussion Forums
- » Suggestions
- » New operator!
- Roblox888i
-
Scratcher
1000+ posts
New operator!
(round (89) to the nearest (10)::operators) // would result in a 90 because 5 or high give it a shove or 4 below go to the ground.
Not gonna replace the current round block
Last edited by Roblox888i (April 15, 2022 05:15:29)
- SomeoneOnThelnternet
-
Scratcher
1000+ posts
New operator!
yesPlease be constructive and explain why you agree.
- Conduit7
-
Scratcher
100+ posts
New operator!
yeah cuz then you could do a
(round (timer::variables) in the [tenths v] place::operators)i know this would be very helpful for people creating games 'cause then making a timer could be smthn like this:
define setTimethis could be very useful in my games when i want a timer cuz what i could do is
set [TIME v] to (join (join (minutes) [']) (round (%time) in the [tenths v] place::operators))
when green flag clickedto get an exact time
set [frame v] to (0)
forever
change [frame v] by (1)
set [%timer v] to ((frame)/(30))
setTime
end
Last edited by Conduit7 (April 15, 2022 22:36:44)
- OPagel
-
Scratcher
500+ posts
New operator!
Support! I can see how this could be helpful, though I wonder if the options would appear depending on the amount of digits.
- Steve0Greatness
-
Scratcher
1000+ posts
New operator!
There is technically a workaround. The script below is from @Scratch-Minion in Round to nearest (num)?(Help with Scripts).
(round ((#) / (Place Value))) * (Place Value)This isn't saying that this isn't useful, it's just so that you can have the same functionality encase the ST doesn't introduce this feature into Scratch.
Last edited by Steve0Greatness (April 13, 2022 00:38:25)
- k0d3rrr
-
Scratcher
1000+ posts
New operator!
Just being honest, but the mock-up had a flaw:
round [23,789] in the [tens v] place:: operators reporter // There should be an integer, not a string.Here's what the actual block should look like:
round (23789) in the [tens v] place:: operators reporter // As you can see, it now has an integer instead of a string.Edit: Also, I probably found a duplicate: https://scratch.mit.edu/discuss/topic/356544/
// Side note: The block above has no comma because it would register as a variable instead of an integer.
Last edited by k0d3rrr (April 13, 2022 01:42:31)
- Icefan13
-
Scratcher
100+ posts
New operator!
workaround:
((round((...::grey)/(10)))*(10))replace the 10 with the place you want to round to. The ST tends not to add blocks with easy workarounds
Last edited by Icefan13 (April 14, 2022 15:40:35)
- Conduit7
-
Scratcher
100+ posts
New operator!
yes even though there is an easy workaround, this could simplify code for some beginners. just like you could replace the
glide block with this:
glide block with this:
set [ending x v] to ()there is a workaround for a LOT of blocks out there, and this could just simplify it from this:
set [ending y v] to ()
set [time v] to ()
set [sx v] to (((ending x)-(x position))/(time))
set [sy v] to (((ending y)-(y position))/(time))
repeat until <<(round (x position))=(ending x)>and<(round (y position))=(y)>>
change x by (sx)
change y by (sy)
end
go to x (ending x) y (ending y)
((round((var)*([10^ v] of [places away from decimal]::operators)))/([10^ v] of [places away from decimal]::operators):: operators report //place values below 1
((round((var)/([10^ v] of [places away from decimal]::operators)))*([10^ v] of [places away from decimal]::operators):: operators report //place values above .1to this:
(round (var) to the [tenths v] place::operators)you'll have a hard time convincing me that this isn't a much easier thing to understand
Last edited by Conduit7 (April 15, 2022 23:50:35)
- SpinningCube
-
Scratcher
100+ posts
New operator!
Here's a more flexible design:
which would basically be defined as:
so for example:
Very useful but also pretty workaroundable
(round () to the nearest ()::operators)
which would basically be defined as:
define (round (A::custom) to the nearest (B::custom)::operators)
report ((round((A::custom) / (B::custom))) * (B::custom))::custom
so for example:
(round (4) to the nearest (10)::operators)//reports 0
(round (7) to the nearest (10)::operators)//reports 10
(round (15) to the nearest (10)::operators)//reports 20
(round (4) to the nearest (7)::operators)//reports 7
(round (23) to the nearest (7)::operators)//reports 21
(round (14) to the nearest (3.1415926536)::operators)//reports 12.5663706144
Very useful but also pretty workaroundable
- Roblox888i
-
Scratcher
1000+ posts
New operator!
Here's a more flexible design:fixed op!(round () to the nearest ()::operators)
which would basically be defined as:define (round (A::custom) to the nearest (B::custom)::operators)
report ((round((A::custom) / (B::custom))) * (B::custom))::custom
so for example:(round (4) to the nearest (10)::operators)//reports 0
(round (7) to the nearest (10)::operators)//reports 10
(round (15) to the nearest (10)::operators)//reports 20
(round (4) to the nearest (7)::operators)//reports 7
(round (23) to the nearest (7)::operators)//reports 21
(round (14) to the nearest (3.1415926536)::operators)//reports 12.5663706144
Very useful but also pretty workaroundable
- historical_supa
-
Scratcher
1000+ posts
New operator!
This is a dupe: https://scratch.mit.edu/discuss/topic/76238/
Last edited by historical_supa (April 16, 2022 00:13:18)
- k0d3rrr
-
Scratcher
1000+ posts
New operator!
This is a dupe: https://scratch.mit.edu/projects/493918300/Ah ha! You tricked me!
- Conduit7
-
Scratcher
100+ posts
New operator!
i would say support this would be a very helpful block
Last edited by Conduit7 (April 15, 2022 23:51:09)
- historical_supa
-
Scratcher
1000+ posts
New operator!
wait why is this that link bruhThis is a dupe: https://scratch.mit.edu/projects/493918300/Ah ha! You tricked me!
- historical_supa
-
Scratcher
1000+ posts
New operator!
This is a dupe: https://scratch.mit.edu/discuss/topic/76238/
- DarthVader4Life
-
Scratcher
1000+ posts
New operator!
This topic is still open thoThat's… not really how duplicates work.
If a newer topic suggests the same thing as an older one, then the newer is generally closed in favor of the older.
They aren't necessarily closed immediately.
- cosmosaura
-
Scratch Team
1000+ posts
New operator!
It looks like this is a duplicate topic of this one over here https://scratch.mit.edu/discuss/topic/76238/ so I'll close it to keep the conversation all in one place.
Please use the existing topic in the link above.
Please use the existing topic in the link above.
- Discussion Forums
- » Suggestions
-
» New operator!












