There's some great tips on these forums - One thing i haven't seen people mention is how to get Notepad++ to run a PICO8 cartridge from a button press.
This way, you can code your program in Notepad++, save it, and then run it, all with a few key presses.
- Open up a sample P8 file in Notepad plus plus.
2.Click on the "Run" menu in the top menu bar. -
Select the "Run" option (the top option in that menu, perhaps not unsurprisingly)
- Cut and paste the below into the dialog box that turns up
"C:\Windows\System32\cmd.exe" /K "C:\Program Files (x86)\PICO-8\pico8.exe" -run $(FULL_CURRENT_PATH)
(this relies on you having installed your PICO8 to the default location. If it doesn't work, find a shortcut to it either on the desktop or the start menu, right click, and "Open File Location". If you change the text, save it in a text file before the next step.)
-
Test it by clicking on the Run button. It should open up the windows terminal, which will then open up a copy of PICO 8 and autoload the cartridge you have open. I'll explain why you want the windows terminal open below.
-
If it works, go back to Notepad++. Bring up the run dialog and paste in the text you used before.
- This time, click the "Save" button. Assign a shortcut -I'd recommend ctrl + A. It's right next to ctrl + s, which is save, meaning you can quickly save and run your program when there are any changes.
The reason you want to use the prefix "C:\Windows\System32\cmd.exe" /K is that this runs the windows terminal, which then runs PICO8. This means you can see any printh statements you've put in your code for debugging.
One thing to note is that the K switch in the line "C:\Windows\System32\cmd.exe" keeps the terminal open when you shutdown PICO8. This is my personal preference, if you want it to shut when you close PICO8, replace the K with a C.
If you use this alongside the syntax highlighting (go to Settings, Style Configurater, Lua in the top menus and add "p8" in the "User Extension" box at the bottom of the window) and Function List mentioned elsewhere on these forums, you've got a pretty awesome dev environment!
Thanks for this, I'm currently copying back and forth between sublime text and the pico editor. I'll try this out soon :)
Nifty. Works like a charm...never really used Notepad++ for running anything, not sure I knew that feature even existed.
However, I usually run Pico8, load a cart, then open that *.p8 in an editor. When I save changes, I tab over to Pico8 and just CTRL+R to reload the cart, and it then loads with my changes. No need to rerun Pico8 every time and suffer through the boot sequence.
Only time the risk enters is if you switch into the Pico8 editor, then you have to make sure you re-load it after you edit in your local editor...but for me, I usually do all my sprites/music in batch so I'm not code editing at the same time.
But still very cool that NP++ can utilize Pico8 as such.
Thanks MT, I didn't know about CTRL+R to reload a cart. Thats even better again.
also check this up (p8run): https://www.lexaloffle.com/bbs/?tid=28483
You should be ashamed for using sublime text and not searching package control whenever you think "hm, would be nice if I could do this" :P
Sublime PICO-8 Package
I copied a cart into my AppData\Roaming\pico-8 carts folder then tried this, but I get a could not load message from Pico-8 on startup - do I have to somehow manage the cart location from in Pico-8?
I'm sorry it doesn't work with me.
The file doesn't seem to change when I run it from Npp but when I run it directly by double clicking it works.
yep, gives me the same error. is this a bug or are we just doing this wrong? lol
[Please log in to post a comment]