Discuss Scratch

Rakkoon_Guy
Scratcher
25 posts

Help with abbreviation

I want to show numbers in a simpler format in my clicker game. For example, 1213 should display as 1.21K. I need help creating a code that works up to nonillions (after octillion). Any suggestions will be appreciated! Thanks

Last edited by Rakkoon_Guy (Dec. 2, 2024 01:15:40)

SML_365
Scratcher
31 posts

Help with abbreviation

Maybe add this?

This is for the thousands:

if <(clicks) > [1000]> then
set [clicks v] to ((clicks) / (100))
end

Then add a “K” costume after the digits. if you're using a variable, you can add a

set [clicks v] to (join [clicks] [k])
repeat this for the millions, dividing by 10 more.

Last edited by SML_365 (Dec. 2, 2024 02:14:08)

Jlerpy
Scratcher
1000+ posts

Help with abbreviation

I'd strongly suggest not altering the variable itself, but setting a separate display variable. That way you can still do calculations on the original variable without weird stuff happening.

Here's how I handled it: https://scratch.mit.edu/projects/690496889 (this project goes up to quindecillions)
Rakkoon_Guy
Scratcher
25 posts

Help with abbreviation

Jlerpy wrote:

I'd strongly suggest not altering the variable itself, but setting a separate display variable. That way you can still do calculations on the original variable without weird stuff happening.

Here's how I handled it: https://scratch.mit.edu/projects/690496889 (this project goes up to quindecillions)
Thank you! I'll add it and give credits!
Jlerpy
Scratcher
1000+ posts

Help with abbreviation

Happy to help.

Powered by DjangoBB