Big Numbers

Big number is a plugin that makes high numbers easier to read.

If variable 17 contain a large number, and you want to store an easier to read version in variable 18, you use the following plugin command:

Code:
bignumber 17 18

1741695682078.png


And the result will be:
1741695708117.png


This works for all numbers up to 999.99 decillion, and on request I can pump this number up even more.

Numbers:
Code:
                              <1000 = no change
                               1000 = thousand
                            1000000 = million
                         1000000000 = billion
                      1000000000000 = trillion
                   1000000000000000 = quadrillion
                1000000000000000000 = quintillion
             1000000000000000000000 = sextillion
          1000000000000000000000000 = septillion
       1000000000000000000000000000 = octillion
    1000000000000000000000000000000 = nonillion
 1000000000000000000000000000000000 = decillion

Download for free:

TERM AND CONDITIONS:
  • Credits to JohnDoeNews
  • Free to use in any RPG maker game.
  • Free to edit as you please.
  • Show me the games you make with this!
    (This is not a request, it is a condition.) 😛
with the look of the code, you can shorten it (as example)
JavaScript:
const writenumber = v => {
  if (v < 1e3) return v; //999
  if (v >= 1e3 && v < 1e6) return +(v / 1e3).toFixed(2) + " thousand";
  if (v >= 1e6 && v < 1e9) return +(v / 1e6).toFixed(2) + " million";
  if (v >= 1e9 && v < 1e12) return +(v / 1e9).toFixed(2) + " billion";
  if (v >= 1e12) return +(v / 1e12).toFixed(2) + " trillion";
  //etc
};
you can go all the way down if needed (just as reference of another way)

even though, I use a different method for the currency, but it can have
its uses, not exactly sure where to use such big numbers though =)
Oh wow, that's really nice actually.
I can't think of a specific use at the moment, but I'll keep it in mind for the future.
with the look of the code, you can shorten it (as example)
JavaScript:
const writenumber = v => {
  if (v < 1e3) return v; //999
  if (v >= 1e3 && v < 1e6) return +(v / 1e3).toFixed(2) + " thousand";
  if (v >= 1e6 && v < 1e9) return +(v / 1e6).toFixed(2) + " million";
  if (v >= 1e9 && v < 1e12) return +(v / 1e9).toFixed(2) + " billion";
  if (v >= 1e12) return +(v / 1e12).toFixed(2) + " trillion";
  //etc
};
you can go all the way down if needed (just as reference of another way)

even though, I use a different method for the currency, but it can have
its uses, not exactly sure where to use such big numbers though =)
Yeah, great. I learned a lot from this post. And I am still learning JavaScript. I see you send me an edit... I'll look at when I get home, but I won't use it. I will learn from it, if I can, but I want to do all the work myself.

That is the whole reason I make those plugins: cause I like the whole designing and engineering.

You said you converted it to MZ, which I am really happy with, cause then I can maybe figure out how MZ plugin commands work. (I can't figure that out, that is why all my plugins are MV only)

But the 1e9 and 1e12 stuff is great. I didn't know it worked like that.

@TRIDIUM Thanks. it is mostly useful in games that are all based on stats. Think cookie clicker (where I got the idea) or a stock teading game (for which I made this plugin) and other. Not much for RPGs.

Edit: @ShadowDragon Did you test your code? There plugin you've send me has a few hick-ups, but I get the idea. I will def. use it to improve my methods.
There plugin you've send me has a few hick-ups, but I get the idea. I will def. use it to improve my methods.
I tested it more for bigger numbers, and I see the issue =)

will test more on it, as it's interesting though 😉
Let me see, might be useful for an idle game in which you hoard millions, trillions of wealth.
In the end they are just numbers. I think some game use different terms, for exaple, 100 copper = 1 silver, 100 silver = 1 gold, 100 gold = 1 platinum, and so on.
Spoiler
1741781628528.png
You could also do a direct assignment with an array to avoid numerous if-statements, conditional checks, etc. I already have a few different functions that do this, so it is cool to see other approaches.
I tested it more for bigger numbers, and I see the issue =)

will test more on it, as it's interesting though 😉
Yeah, it's a small oversight. 😛 You saw it though? Everything was stuck on the same dividing value about a billion or a trillion. 😛 And I know exactly how it happened. you wrote the line once, copy/pasted it a few times, then adapted the values of each line. Then coppied the last line 20 times over, but forgot to update 1 of the 3 stats. 😛

The thing is, I didn't copy paste it, but when I learned from your adaptation and I tried to put what I learned into action. I ended up with a code that looked a lot like the one you showed me. (probably because that was already an adaptation of what I wrote, and I tried to apply the same changed you applied to my code...)

From your adaptation of my plugin:
JavaScript:
        if (v < 1e3) return v; //999
        if (v < 1e6) return +(v / 1e3).toFixed(2) + " thousand";
        if (v < 1e9) return +(v / 1e6).toFixed(2) + " million";
        if (v < 1e12) return +(v / 1e9).toFixed(2) + " billion";

I did basically the same thing. Not exact, but the idea is the same. However, why is there a "+" after each return except for the first? I didn't have a + in what I wrote

However... Even though I learned a a few things from your input, I am afraid I am going in another direction... Your code might have been shorter than mine, but... keep reading and you'll find out...

***CLIFFHANGER!!*** 😛
Let me see, might be useful for an idle game in which you hoard millions, trillions of wealth.
In the end they are just numbers. I think some game use different terms, for exaple, 100 copper = 1 silver, 100 silver = 1 gold, 100 gold = 1 platinum, and so on.
Funny you say that, because the idea for big numbers comes from cookieclicker. You might have seen it? It's an old idle game, and the only one I played for longer than a few weeks... In fact, I'm on this save for 1573 days. 😛

1741812319539.png


Is that screenshot from your game? That is awesome!!!

You could also do a direct assignment with an array to avoid numerous if-statements, conditional checks, etc. I already have a few different functions that do this, so it is cool to see other approaches.
That is actually how I handle data in my football manager plugin. And my card game. And names for weekdays and months in my clock and calendar plugin...

The reason I did it this was, is because I just learned about functions, and this was just the first function I tried out, since I needed this for my stock traders game...

I did think of using an array, since I use arrays for everything else... But I thought I would need to do the conditions anyway. That might not be true, though...

If I make a loop like this:
JavaScript:
var a = [""," thousand"," million"]
var v = 192837465
for (let n=0 ; n<a.length ; n++) {
    if (v >= 1000) {
        var v = v / 1000
        var i = i + 1
    }
}
var output = v + a[i]

//untested, wrote this in the RPG maker editor...


Yeah, I think this might be a huge improvement. I'm not sure if this was what you had in mind, but if I did the code correctly the first time without testing (which would be a miracle...) then this would be much more efficient than I had it before.

You know what else I can do now? Make a plugin parameter, to put the array in there! So users can choose to use "10k" for "10 thousand" and "10m" for "10 million".

See, that was a big issue for me before releasing this plugin: Am I going to use thousand, or just k? Because I like the full names, but they take up a lot of space in the HUD...
1741815011277.png

(Screenshot from the stock trading game I created this plugin for. Wanna see the plugin in action? Click HERE, it's a browser game, no download required.)

Edit: @utunnels Hey, that would make it useful for you too, making platinum, instead of million.
100 copper = 1 silver, 100 silver = 1 gold, 100 gold = 1 platinum, and so on.
I got a plugin for that 😀
it doesn't round it yet, but could add it, similar to my easyCurrency (which is old one).
@JohnDoeNews Not my game. I just find a random one in my steam library. I think the idea is similar, display number in limited space.:hswt:
big numbers comes from cookieclicker.
I did basically the same thing. Not exact, but the idea is the same. However, why is there a "+" after each return except for the first?
the first value if lower than 1000 just returns, otherwise, it return the current variable
to add decimal there.

as for cookieclicker, I don't know that, but on a pc, you can click while away.
so you can cheat on it, not sure why.

variable after 21 numbers in a variable returns 1e+21 so its neutral to add it
so it would be correctly returned 🙂

it could end up in 1e+2 decillion for example, something you don't want.

you can also avoid 1e21 on large number in variable, if you write the function
for it though =)
as for cookieclicker, I don't know that, but on a pc, you can click while away.
so you can cheat on it, not sure why.
Yeah, that is not a problem for me. An idle game is supposed to proceed while absent. 😛
In fact, I know many, many guys who got into coockie clicklerbecause of the cheats. (You need to work in the console to cheat in cookie clicker, which is interesting to beginning programmers.)

variable after 21 numbers in a variable returns 1e+21 so its neutral to add it
so it would be correctly returned 🙂

it could end up in 1e+2 decillion for example, something you don't want.
yeah, you mean, if my numbers go to decillion and you have like duodecillion or tredecillion in your account. I see, there is always a max to the numbers you can use. Although, decillion is sooooooo much already. I can make them even larger, but the problem won't go away, just move to an even larger number.

There has to be a limit to the numbers somewhere.

---

The loop is going to be a no-go. Loops are not good here, since it causes lag. Or something is causing lag, and I assume it is the big numbers. Your solution using a const instead of a function, might be the fastest way to get there after all. It means I need more code, but it runs less code, and hopefully deals with the lag.

(The downloadable version does not have this problem, since this still uses the old method, which works fine. So maybe I shouldn't want to fix something that isn't broken.) 😛
The limit is something like 1.79e+308 or thereabouts, about 179 uncentillion.
1e+303 is centillion, so you would need names from decillion (10-illion) to centillion (100-illion) Tredecillion is only 13-illion, so you have a ways!

Spoiler: big, big numbers
Million, billion, trillion are known already, they're 1 followed by six, nine, and twelve zeroes respectively.
1e+15 = quadrillion (the 4th -illion)
1e+18 = quintillion
1e+21 = sextillion
1e+24 = septillion
1e+27 = octillion
1e+30 = nonillion
1e+33 = decillion (un, duo, tre, quattuor, quin, sex/se, septen, octo, novem)
1e+63 = vigintillion
1e+93 = trigintillion
1e+123 = quadragintillion
1e+153 = quinquagintillion
1e+183 = sexagintillion
1e+213 = septuagintillion
1e+243 = octogintillion
1e+273 = nonagintillion
1e+303 = centillion
1e+306 = uncentillion/cenuntillion, 179 of these is the max in 64-bit floating point, anything higher becomes positive infinity!
These are some big numbers!
I would cap at 1e21 as that is the cap of editor variable value to read 0's.
but I don't know why it jumps from 133 I believe to 203 or 303 direcly.

anything between is a riddle 🙂

even when I wrote a function for all those for JohnDoeNews to learn from,
it would be easy to cap the maximum value from going higher than that.

but it's his choice which route he takes, what works best for him.
as it can unlock, while there are 40+ names of big numbers, 31 entries
might be best so it would be 1e99, so if the game allows 1e+60 max, than
you can cap value hold to 1e+96 and 1e+99 as fails-safe.

but it's not my game, so not my decision to make =)

but its interesting what you can do though and what others think on building it.
Well, the cap of the plugin is pretty much limitless. I would not put the cap at 21, just because the engine is capped by 21. 😛 Don't we make plugins to break the limits of RPG maker? 😛
Don't we make plugins to break the limits of RPG maker?
most would where possible.

I still try to puzzle with the 1e+21 and over to return a normal value
inside a variable to read.

1.837.464.395.365.382.194.235|.656.234.235.235.975.522.235 etc
hits 1e+21 in variable value (remove dots) as I can set dots in those
variables ^^ but shows incorrectly after large numbers.

if you can break it, it looks awesome =)
I just miss something, but I will break this inside variable value to show
numbers, not 1e+21 (although, this huge number go outside the message box
without wrapping (or smaller font)

lucky for you, convert it to smaller value fix that, but not in a clean way yet.
as it's rounded down or up, so you gain more and not precise.

I mess with some ways to keep the exact value without rounding down/up.
Note that the periods that we use to separate 000, means something different in America.
I don't know that, but I can crack down the big numbers.

so like:

12.5903948562 (default 12.60) => with change 12.59
12.513945 (default 12.514 (3 digits)) => with change 12.513

so it more accurate. so it wont round to give unwanted results 🙂

the last method I sended didn't work out and has hiccups, this method
is better and cleaner too 🙂

just need a few adjustments to make it smooth ^^

Edit:
fixed (is in your DM to study). no more rounding down/up ^^
Huh? 12.590 would round to 12.60? I don't think so... 12.590 will always be shortened to 12.59, no matter if you round correctly or cut the number. 12.595 should round to 12.60

But to fixed doesn't round at all. It just guts away everything after. So basically it always rounds down. And I am fine with that, because otherwise when you need 1.24 million for something and you have 1.238 million, but it shows that you have 1.24 million (because it rounds up), that would seem like a bug. The game would say: you have the same amount as needed, but it isn't enough.

So I purposely cut the number, I don't round it. Rounding would be mathematically correct, but not a great thing in gameplay, if you ask me.
made a mistake in DM, but here is toFixed(2) issue (what you dont want).
sample.png

as we didn't reach 12.4 yet, and should be 12.39 still 😉

Original thread: https://forums.rpgmakerweb.com/threads/big-numbers.176151/