Discuss Scratch

CyclonesPlayer28
Scratcher
10 posts

1000 to 1k 1250 to 1.25k

I need help with a game im making. Im trying to make a counter where it shows, for example, 1k instead of 1000 or 1B instead of 1000000000 but also 1.25k instead of 1250.
Woodfur
Scratcher
100+ posts

1000 to 1k 1250 to 1.25k

This will be a lot simpler if you have a second variable that just stores the actual number. Then you can just
if <(number) < [1000]> then 
set [display v] to (number)
else
if <(number) < (1000000)> then
set [display v] to (join ((number) / (1000)) [k])
else
if <(number) < (1000000000)> then
set [display v] to (join ((number) / (1000000)) [m])
else
etc.
end
end
end

say (something dumb)
switch costume to [dabbing v]
Woodfur
Scratcher
100+ posts

1000 to 1k 1250 to 1.25k

Actually I guess if you really want to streamline it you can
set (i) to (0)
repeat (number of levels you're accounting for)
if <(number) < ([10^ v] of ((3) * ((i)+(1))) :: operators )> then
set [display v] to (join ((number)/([10^ v] of ((3) * (i))::operators)) (letter (i) of [kmbt...]))
stop [this script v]
end
change [i v] by (1)
end
where “kmbt…” is just all your suffixes in a string right there in the text box.

Last edited by Woodfur (May 9, 2024 02:43:42)


say (something dumb)
switch costume to [dabbing v]
CyclonesPlayer28
Scratcher
10 posts

1000 to 1k 1250 to 1.25k

Woodfur wrote:

This will be a lot simpler if you have a second variable that just stores the actual number. Then you can just
if <(number) < [1000]> then 
set [display v] to (number)
else
if <(number) < (1000000)> then
set [display v] to (join ((number) / (1000)) [k])
else
if <(number) < (1000000000)> then
set [display v] to (join ((number) / (1000000)) [m])
else
etc.
end
end
end


It worked but there is a problem i want it to only go to the hundredths for example variable number is 1251111 i want it to display 1.25m instead it says 1.25111m. Is there maybe a fix for that
Woodfur
Scratcher
100+ posts

1000 to 1k 1250 to 1.25k

Ah, right. A few ways to do that, but before I get into it, do you always want hundredths or do you want, say, three significant figures, so it goes 123 -> 1.23k -> 12.3k -> 123k -> 1.23m, or something else?

say (something dumb)
switch costume to [dabbing v]
CyclonesPlayer28
Scratcher
10 posts

1000 to 1k 1250 to 1.25k

Woodfur wrote:

Ah, right. A few ways to do that, but before I get into it, do you always want hundredths or do you want, say, three significant figures, so it goes 123 -> 1.23k -> 12.3k -> 123k -> 1.23m, or something else?


I want it to go up to the hundreths so 1000 would be 1k 1200 would be 1.2k and 1250 would be 1.25k but 1251 would be 1.25k and 1255 would be 1.26k

Last edited by CyclonesPlayer28 (May 9, 2024 13:36:26)

CyclonesPlayer28
Scratcher
10 posts

1000 to 1k 1250 to 1.25k

is there any possible way to do that?
yadayadayadagoodbye
Scratcher
1000+ posts

1000 to 1k 1250 to 1.25k

CyclonesPlayer28 wrote:

Woodfur wrote:

Ah, right. A few ways to do that, but before I get into it, do you always want hundredths or do you want, say, three significant figures, so it goes 123 -> 1.23k -> 12.3k -> 123k -> 1.23m, or something else?


I want it to go up to the hundreths so 1000 would be 1k 1200 would be 1.2k and 1250 would be 1.25k but 1251 would be 1.25k and 1255 would be 1.26k
instead of doing
(join ((number) / (1000)) [k])
do
(join ((round ((number) / (10))) / (100)) [k])

Last edited by yadayadayadagoodbye (May 10, 2024 03:37:42)


Scratchers that I've cati-fied
CyclonesPlayer28
Scratcher
10 posts

1000 to 1k 1250 to 1.25k

yadayadayadagoodbye wrote:

CyclonesPlayer28 wrote:

Woodfur wrote:

Ah, right. A few ways to do that, but before I get into it, do you always want hundredths or do you want, say, three significant figures, so it goes 123 -> 1.23k -> 12.3k -> 123k -> 1.23m, or something else?


I want it to go up to the hundreths so 1000 would be 1k 1200 would be 1.2k and 1250 would be 1.25k but 1251 would be 1.25k and 1255 would be 1.26k
instead of doing
(join ((number) / (1000)) [k])
do
(join ((round ((number) / (10))) / (100)) [k])

What about for millions. When its in the millions or higher it doesn't round. I tried messing with the division but I couldn't get it to work. any fixes???

Last edited by CyclonesPlayer28 (May 10, 2024 19:59:54)

CyclonesPlayer28
Scratcher
10 posts

1000 to 1k 1250 to 1.25k

is there a Way to fix it. or is it impossible???

Last edited by CyclonesPlayer28 (May 10, 2024 19:59:39)

CyclonesPlayer28
Scratcher
10 posts

1000 to 1k 1250 to 1.25k

Plz respond
Jlerpy
Scratcher
500+ posts

1000 to 1k 1250 to 1.25k

Remember you should only be bumping a max of once per day.

https://scratch.mit.edu/projects/690496889/

Have a look in here for how I handled this.
CyclonesPlayer28
Scratcher
10 posts

1000 to 1k 1250 to 1.25k

Jlerpy wrote:

Remember you should only be bumping a max of once per day.

https://scratch.mit.edu/projects/690496889/

Have a look in here for how I handled this.




No one ever told me i coulnt bump twice a day. (or i just forgot)
CyclonesPlayer28
Scratcher
10 posts

1000 to 1k 1250 to 1.25k

Jlerpy wrote:

Remember you should only be bumping a max of once per day.

https://scratch.mit.edu/projects/690496889/

Have a look in here for how I handled this.


THANK YOU SO MUCH!!!!
Stegie1234
Scratcher
100+ posts

1000 to 1k 1250 to 1.25k

This project may help: https://scratch.mit.edu/projects/912700423/ .

Gerald is spying on you.

Powered by DjangoBB