Log In  

i know i can possibly write to a file with printh how can i read from a file then?

P#52922 2018-05-22 11:29 ( Edited 2018-05-23 19:27)

You can't read from files in a general sense. There's no general IO library.

It depends on what are you trying to accomplish, though. If you're trying to save data, look into cartdata(). If you want to "flash" the cartridge, look at cstore().

But there's nothing that's the "opposite" of using printh(), which is really meant as a logging utility.

P#52929 2018-05-22 14:18 ( Edited 2018-05-22 18:18)

Judging from this and your other thread on keyboard/mouse input, it seems you may be conceiving of PICO-8 as a general purpose computer, when in fact it is really much more of a console (with a gamepad as input) for which you happen to have the editing tools to produce cartridges for end-users. Keeping this in mind may clarify some things for you.

Also, please remember to check the category when posting, as this is your second post in the "Cartridges" category which is not a cartridge. This should be in "Discussion" or "Workshop" or something. Thanks.

P#52939 2018-05-22 17:58 ( Edited 2018-05-22 21:58)

im just looking for a way to save the game

P#52957 2018-05-23 09:18 ( Edited 2018-05-23 13:18)
:: Davbo

If you're feelin' mad there's a couple things you could try. This form talks about using the GPIO pins to communicate with the outside world from a pico 8 card. The github repo is still live so you could figure out how they did it and try something similar.

This thread talks about shoving data into the pico 8 ram on the fly, which, I mean, I guess, if they did it, must be possible. Though they don't have any code to show how, maybe it's the start of a investigation.

I sware there was another networking game using pico 8 and some javascript to pass information between (and therefore into) carts but I can't find it right now. If you search around on google you may find other examples.

But yeah as kittenm4ster says the Pico 8 is a games console, not a computer. So that's worth bearing in mind when dreaming up Pico 8 projects.

EDIT: I only saw the comment re- just wanting save data after writing this - I think it was posted while I was writing this.

P#52958 2018-05-23 09:23 ( Edited 2018-05-23 13:26)
:: Davbo

Oh, for saving the game check out the Persistent cart data section of memory and start from there.

You want to use cart data:

You don't save to a seperate file you write to the cart itself hence why we were confused! (I've not tried it though!)

P#52959 2018-05-23 09:26 ( Edited 2018-05-23 13:28)

Yeah, if you want to save some state to the cart, look into cartdata() like Davbo said now (and like I said earlier). But if you want to save the actual game you are writing, then: http://pico-8.wikia.com/wiki/Save

P#52966 2018-05-23 15:27 ( Edited 2018-05-23 19:27)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-06-06 11:34 | 0.013s | 2097k | Q:26