Discuss Scratch

Mylaws
Scratcher
24 posts

Number System

Hey, so I have no clue on how to make a number system that display short numbers such as 1k, 1M, 1B, 1T, etc. instead of displaying 1000, 100,000,000, etc.. I understand it's probably very difficult, but help would be very appreciated!
PGBear73
Scratcher
100+ posts

Number System

If variable1 > 1000 and < 1000000, divide by 1000. Same for each interval. And then broadcast “message telling you that it's in the thousands.” When that message is received, add join (variable1)(K)
Oumuamua
Scratcher
1000+ posts

Number System

I made a project capable of showing from units to billions, I think it can display up to trillions easily, you try it…
https://scratch.mit.edu/projects/372209240/
Mylaws
Scratcher
24 posts

Number System

Oumuamua wrote:

I made a project capable of showing from units to billions, I think it can display up to trillions easily, you try it…
https://scratch.mit.edu/projects/372209240/
wow dude, thanks a lot. I'll credit you lol

Last edited by Mylaws (April 17, 2021 00:44:38)

Mylaws
Scratcher
24 posts

Number System

PGBear73 wrote:

If variable1 > 1000 and < 1000000, divide by 1000. Same for each interval. And then broadcast “message telling you that it's in the thousands.” When that message is received, add join (variable1)(K)
Oh I didn't see your message, I'll try both of yours for sure. Thanks a lot man.

Last edited by Mylaws (April 17, 2021 00:46:07)

PGBear73
Scratcher
100+ posts

Number System

Mylaws wrote:

PGBear73 wrote:

If variable1 > 1000 and < 1000000, divide by 1000. Same for each interval. And then broadcast “message telling you that it's in the thousands.” When that message is received, add join (variable1)(K)
Oh I didn't see your message, I'll try both of yours for sure. Thanks a lot man.
@Oumuamua's is better; use his. He already figured everything out. I was just reasoning through how I would do it
Mylaws
Scratcher
24 posts

Number System

PGBear73 wrote:

Mylaws wrote:

PGBear73 wrote:

If variable1 > 1000 and < 1000000, divide by 1000. Same for each interval. And then broadcast “message telling you that it's in the thousands.” When that message is received, add join (variable1)(K)
Oh I didn't see your message, I'll try both of yours for sure. Thanks a lot man.
@Oumuamua's is better; use his. He already figured everything out. I was just reasoning through how I would do it
I'll see what happens but, honestly I wanna figure it out with help when I need it. If I'm really stuck then I'll use it lol. Also, can you explain to me how exactly I can add the “K”, “M”, etc. I think I can handle the other part you explained to me.

Edit: I made it so it can divide it, but I'm stuck about the “K, ”M“, ”B", etc..

Last edited by Mylaws (April 17, 2021 00:59:17)

PGBear73
Scratcher
100+ posts

Number System

Mylaws wrote:

I'll see what happens but, honestly I wanna figure it out with help when I need it. If I'm really stuck then I'll use it lol. Also, can you explain to me how exactly I can add the “K”, “M”, etc. I think I can handle the other part you explained to me.
Just whenever you store the number in the variable, instead of this:
set [variable v] to [x]

Do this:
set [variable v] to (join [x] [K])

X is the number that has already been divided, K is the letter (K,M,T, etc.)

Last edited by PGBear73 (April 17, 2021 01:01:25)

Mylaws
Scratcher
24 posts

Number System

PGBear73 wrote:

Mylaws wrote:

I'll see what happens but, honestly I wanna figure it out with help when I need it. If I'm really stuck then I'll use it lol. Also, can you explain to me how exactly I can add the “K”, “M”, etc. I think I can handle the other part you explained to me.
Just whenever you store the number in the variable, instead of this:
set [variable v] to [x]

Do this:
set [variable v] to (join [x] [K])

X is the number that has already been divided, K is the letter (K,M,T, etc.)
Wait how exactly do I pick out specific numbers out of a variable. Like lets say I have 1200, I want to take out 200. Wait nevermind I know.

Last edited by Mylaws (April 17, 2021 01:09:41)

Oumuamua
Scratcher
1000+ posts

Number System

You could treat a large number as a text string, getting(and joining) every three digits every time.

Time to rest for me
Mylaws
Scratcher
24 posts

Number System

Oumuamua wrote:

You could treat a large number as a text string, getting(and joining) every three digits every time.

Time to rest for me
Can you explain a bit more?
PGBear73
Scratcher
100+ posts

Number System

I think what he means is that one variable can store any amount of variables if you use the join function.

You can nest the join function inside itself to create more slots.

(join (join [111 ] [M ]) (join (join [111 ] [K ]) (join [111 ] [_])))

^^That will look like this: ((variableName) (111 M 111 K 111 _)
(I just put the underscore as a placeholder; you don't need it there)
Mylaws
Scratcher
24 posts

Number System

PGBear73 wrote:

I think what he means is that one variable can store any amount of variables if you use the join function.

You can nest the join function inside itself to create more slots.

(join (join [111 ] [M ]) (join (join [111 ] [K ]) (join [111 ] [_])))

^^That will look like this: ((variableName) (111 M 111 K 111 _)
(I just put the underscore as a placeholder; you don't need it there)
Oh okay thanks.
PcUserPro
Scratcher
500+ posts

Number System

Mylaws wrote:

Hey, so I have no clue on how to make a number system that display short numbers such as 1k, 1M, 1B, 1T, etc. instead of displaying 1000, 100,000,000, etc.. I understand it's probably very difficult, but help would be very appreciated!
I didn't really understand. If you want 1000 to show 1k instead, and the numbers are stored in a variable I can help:
if <(number's variable) = [1000]> then
set [number's variable v] to [1k]
end
JustDanceMathGod
Scratcher
1 post

Number System

could we use the mod block to calculate
Scyth3d
Scratcher
500+ posts

Number System

JustDanceMathGod wrote:

could we use the mod block to calculate
Please don’t necropost. And make a new topic for any questions you have
PurpleGuyCoding
Scratcher
1 post

Number System

Does anyone know how to keep numbers precision so im tryna type 11111111111111111111111111111+1 and then it comes out as 1e+28 does anyone know how to stop scratcch from doing that?

Powered by DjangoBB