Millions And Billions Of ...

Published 2023-06-12

stars in the galaxy.
Whoops, sorry, not that. No, something BETTER. Millions and billions of VALUES you can now use in Pico-8.



load this in Pico-8 immediate mode with:

I understand there was a library made sometime ago that could increase a value to trillions, but it could not decrease, let alone go beyond 0 to negative numbers.

Well, I sat down and thought about it. Realized that getting past 0 is a tricky thing indeed. Especially going from 0 to a negative number and found at least for me a fairly simple solution to get around it.

So what do you have here ?

Well, in the demo hit LEFT and RIGHT to choose a positive or negative number to add or subtract to your total. And calculate the result every time you hit (O).

A program that lets you count up as high as you like, well past a billion or trillion using a STRING instead of a numeric variable. There is a catch though, and likely this is a limitation on my coding ability. You can only add or subtract up to 16383 at a time.

I'm not sure how to do it otherwise, but one advantage is if both numbers are ranged to 16383 or less, positive or negative, then the calculation is instant.

If not, it goes through my function and adds or subtracts properly and it defaults to 16-digits, or you can choose how many digits you want in your numbers if that's not enough.

Useful if you want to have a score over a long time or experience points for an RPG that surpass the 32767 barrier.

I have no doubt my code could be optimized further. :)

...

Wait. What the heck ?? It doesn't work correctly here but it does in Pico-8 ??
Well that's just EVIL. I had this problem in GFA-Basic years ago. My code would ran fine in the editor, compiled, didn't run properly. Augh ! Solution anyone ? Gotta be a bug @zep needs to squash.

Try for yourself to see it works perfect in the actual Pico-8 system.