Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Number System
- Mylaws
-
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
-
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
-
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/
https://scratch.mit.edu/projects/372209240/
- Mylaws
-
24 posts
Number System
wow dude, thanks a lot. I'll credit you lol 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/
Last edited by Mylaws (April 17, 2021 00:44:38)
- Mylaws
-
24 posts
Number System
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. If variable1 > 1000
Last edited by Mylaws (April 17, 2021 00:46:07)
- PGBear73
-
100+ posts
Number System
@Oumuamua's is better; use his. He already figured everything out. I was just reasoning through how I would do itand < 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. If variable1 > 1000

- Mylaws
-
24 posts
Number System
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.@Oumuamua's is better; use his. He already figured everything out. I was just reasoning through how I would do itand < 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. If variable1 > 1000
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
-
100+ posts
Number System
Just whenever you store the number in the variable, instead of this: 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.
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
-
24 posts
Number System
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.Just whenever you store the number in the variable, instead of this: 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.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 Mylaws (April 17, 2021 01:09:41)
- Oumuamua
-
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
Time to rest for me
- Mylaws
-
24 posts
Number System
Can you explain a bit more? You could treat a large number as a text string, getting(and joining) every three digits every time.
Time to rest for me
- PGBear73
-
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.
^^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)
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
-
24 posts
Number System
Oh okay thanks. 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)
- PcUserPro
-
500+ posts
Number System
I didn't really understand. If you want 1000 to show 1k instead, and the numbers are stored in a variable I can help: 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!
if <(number's variable) = [1000]> then
set [number's variable v] to [1k]
end
- Scyth3d
-
500+ posts
Number System
Please don’t necropost. And make a new topic for any questions you have could we use the mod block to calculate
- PurpleGuyCoding
-
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?
- Discussion Forums
- » Help with Scripts
-
» Number System