I hang out in the pico-8 discord's #help channel, and I see a lot of questions that boil down to "my code isn't doing what I want, and I don't know what to do. help?" If you feel completely lost when your code doesn't work, this tutorial is for you!
PRINTH is the single most helpful tool I know for pico-8 debugging. When programming, your head can get out of sync with the computer, and you won't understand what it's doing. The best way I know to bring them back in sync is to slap down some PRINTHs all over the place! Print some info to see what your code is actually doing, and figure out exactly where the code starts to go off-track.
setup
Here's a video showing how to launch pico-8 with an attached console on Windows. You'll need to do this somehow, because PRINTH messages are only visible in the attached console.
The first 30 seconds of the video show how to create a shortcut to pico8.exe, and then edit that shortcut's "target" so that it will run from a console. After making it, you can move this shortcut anywhere you want.
The rest of the video walks through a simple debugging scenario, and ends by showing off PQ (see explanation below)
PQ
PRINTH itself can be a bit annoying to use, so I built a function called PQ that's nicer to use. You're free to copy it into any of your projects. If you find my functions helpful and you'd like to credit me, I'd appreciate it! but that's not required; feel free to use the functions for whatever you want.
PRINTH annoyances
PQ library
Let me know if you found this helpful!
Excellent tutorial! I'm surprised it's so easy to do, I'd expect you'd have to make some PICO-8 game to receive it.
yes, sometimes I use a mac and I open Terminal in the folder where pico8 lives and run ./pico8
(I'm unsure what the exact name is). then the Terminal window stays open and the printh output is shown in that terminal.
I'm not happy with that setup, there's probably a more convenient way to do it. but I'm hardly ever on mac -- someone else would be able to make better instructions than me
pq() is super useful, was looking for something like this. Thanks!
[Please log in to post a comment]