Discuss Scratch

tank_man94
Scratcher
6 posts

i need help with the 1000000 into m

i got 1000000 into m but when i did that and the number was something like 1222222 it showed up as 1.222222M how can i fix this
gor-dee
Scratcher
1000+ posts

i need help with the 1000000 into m

What would you want it to show as?
D-ScratchNinja
Scratcher
1000+ posts

i need help with the 1000000 into m

You'll have to round it off. If you want to round to two decimals, you can first multiply by 100, then round, then divide by 100.
set [coins display v] to (join((round ((coins) * (100))) / (100))[M])
The round operator essentially ends up cutting off anything past the decimal point and multiplying by 100 moves the decimal point 2 digits to the right.

And if you want to show more digits, you just add zeros to the formula.

Last edited by D-ScratchNinja (Feb. 9, 2022 02:08:15)

tank_man94
Scratcher
6 posts

i need help with the 1000000 into m

it doesnt work
tank_man94
Scratcher
6 posts

i need help with the 1000000 into m

i have a system so that if the number is more than 99 and less than 1000000 it will add a k to the number that shows and divide it by 1k so if the number is 100000 it becomes 100k but if its 123456 it becomes 123.456k but i want it to round so its 123.46k how can i do this and the other method didnt work i also need this to happen every single time the number changes.

If you could help it would be amazing

Last edited by tank_man94 (Feb. 9, 2022 19:31:20)

gor-dee
Scratcher
1000+ posts

i need help with the 1000000 into m

@D-ScratchNinja's script should work but it is assuming ‘coins’ is already displaying millions. So really you need to replace
(coins)
with
((coins) / (1000000))

Edit: as the next step is to multiply by 100 you could actually replace
((coins) * (100))
with
((coins) / (10000))

Last edited by gor-dee (Feb. 9, 2022 22:38:20)

tank_man94
Scratcher
6 posts

i need help with the 1000000 into m

thankyou for the help

Powered by DjangoBB