Log In  

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

 
mib
by dw817
Cart [#mib-0#] | Code | 2019-10-17 | License: CC4-BY-NC-SA | Embed
2

load this in Pico-8 immediate mode with:

load #mib-0

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.

P#68949 2019-10-17 02:29 ( Edited 2019-10-17 03:54)

Cool! I haven't had the chance to look into how it works yet, but it does work on my Pico-8. Not sure where the web version messes up, strange.

P#68951 2019-10-17 03:14
:: dw817

Hi. Thanks for your interest, Shoxidizer. Was giving it some thought. Tomorrow I think. I should be able to write one that adds or subtracts any amount at all, not limited to 16383.

Will be a bit faster than this one too - so, yeah, a total rewrite. Don't we always learn something when we do this tho ? :)

Still puzzled over why the BBS version runs different. That is a bad error indeed in Pico.

P#68956 2019-10-17 05:55 ( Edited 2019-10-17 05:56)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-11-19 21:34 | 0.016s | 4194k | Q:26