Log In  

I'm just curious how you might save data easily that would otherwise be a bit much for the usual 64 number limit of dset/dget. I am trying to store high scores and have tried a lot of things and just ended up confused, the data format is something like:

AAA - time (minutes:seconds) - clicks
(1 byte per letter) - (1 for m, 1 for s) - 1 for clicks <---when I tried poke this is how I approached it

I wish to store different scores for each difficulty so people can compete at different levels and probably about 10 scores per difficulty (though I don't mind going lower if I have to). I tried dset and dget but it didn't provide enough spaces for data, and so I was looking at peek and poke, I should be able to store it no problem then but then how do I make the data persistent? even though I saved to the persistent data area in memory, it is empty when I reload the game, do I need cstore? and if so, I read that that doesn't work with browser played games so it isn't really going to work for me either right?

I also messed with the idea of using shifting bits to concatenate these values to store them into dset and dget but that had varying degrees of success, worked slightly but then would stop randomly so maybe I was using the wrong shifting, I think I tried shl() (I know there's a newer version though, <<< right?)

another thing I messed with for a while was generating a text file of high scores but then when I export as html, where would I need to put the blank text file? pretty sure I would need a blank file there by default otherwise using #include will cause an error...

as you can see there's a huge web of trains of thought here and I keep coming up blank with them because I feel I'm misunderstanding something small that ties it all together haha, I just want high scores that can run through itch.io

Hopefully you kept up with all this, if you understand this stuff and are happy to help but need more info about anything, please let me know and I can provide details :)

P#92699 2021-05-27 21:33 ( Edited 2021-05-28 10:06)

I'm not sure whether my initial point came across because I rambled a bit too much, but I am wondering which of these options would work best and what I might be missing with them.

P#92705 2021-05-27 22:29

For anyone else who was curious, I figured out I need to also call cartdata() before using the peek and poke on the persistent data section of memory... I somehow missed that while looking into all of this... oops haha

This means that it is working pretty well now :)

P#92824 2021-05-30 23:05

Glad you found your answer! This cart shows another way to use the memory section (another than dset/dget): https://www.lexaloffle.com/bbs/?tid=30711

Left shift is << like in many languages. The >>< and >>> operators do bit rotation which I don’t understand.

I think cstore is mostly useful for cart tools, like alternate pixel editors (painto8), map or metatile map editors, etc. It’s useful to write data into a cart. I suppose a regular game could use it as a save system (if it had some unused memory in the ROM).

Generating text files with printh is another idea that’s best used with developer tools, not regular games. It would only work with real pico8, not exports, and put strange-looking files in the carts directory which I find messy.

Feel free to join the unofficial pico8 discord server btw, sometimes there’s more activity there than on the bbs! Cheers

P#92831 2021-05-31 02:57 ( Edited 2021-05-31 02:57)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-20 14:06:35 | 0.006s | Q:10