Typically, when using an external editor, I do cp -f cart.p64 src
and then work on src
externally. Every time I make a change, I need to load src
before running. Then, I can put it back in the cart by doing cp -f src cart.p64
.
The suggested way of using external editors in the docs is to have the code externally, and simply include it from inside the cart. This will automatically use the latest external change, but it makes it harder to switch back to editing inside Picotron, as you need to change parts of your code to put everything back in the cart.
I made a quick utility to make loading an external folders easier.
extload
is a modified version of /system/util/load.lua
that loads a folder for external editing. It saves the path of the folder in /ram/extcart.pod
and loads extrunner
instead of the actual folder. (It also loads the workspaces from the folder, though this is a little janky.)
extrunner
is a dummy cart that cds into the external folder (from /ram/extcart.pod
), loads the graphics and sfx (by including /system/lib/resources.lua
), and runs it (by including main.lua
).
So, to set up an external project:
- Create a cart for the project (
cart.p64
) - Extract the cart (
cp -f cart.p64 src
) - Load the extracted cart (
extload src
) - Make any changes with an external editor, test those changes with Ctrl+R
- When done, rebuild the cart (
cp -f src cart.p64
)
This lets you work on any cart externally without having to load src
every time you make an external change and without needing to make any code changes!
extload.lua
extrunner main.lua
https://gist.github.com/Rayquaza01/574a21a168aa38dc4c0b8b3ec2caf69b



Oh, that's pretty handy!
I was using a build system, but I also had to systematically execute a command, which slowed down the iteration speed.
First util to join my workstation :)
Thanks a lot!
For neophytes like me who have skipped a step, extrunner is indeed a .p64 cart and not a .lua file (like extload.lua).




Hello,
I am a novice and French (Google translation).
What to do with "extload.lua" and "extrunner.lua"?
I do not understand what this method brings.
Personally, I use Visual Studio Code for the ".lua" editor.
For this I rename the card to edit in picotron with 2 . "my game..p64".
I can then open this folder with VSC, main.lua editor or any other .lua, save (ctrl-s) on VSC and test by running on picotron by double-clicking "mygame..p64".
You have to keep picotron and vsc open to repeat quickly.
once finished, we must rename the card(folder) "mygame.p64" to edit on picotron.
(game..p64) for vsc
(game.p64) for picotron




@heliuse Huh, I didn't realize that you can name a folder to .p64 and double click it to run it.
When you load a cart, it makes that cart the present working cart (so you can run it with Ctrl+R). If you load a folder, it won't use the external changes when you press Ctrl+R. Extload is a workaround to make it so that Ctrl+R works when loading a folder and making external changes.
If you don't care about using Ctrl+R, then your method works fine! :)



It's only been a few days, and I've already changed my workflow at least 5 times!?
I realize I know nothing about Picotron or Lua. It's fun, exciting and ... confusing all at the same time :)
@heliuse this workflow seems pretty handy as I just drag the “.vscode\settings.json” from @arnaught into the special folder (“cart..p64”) and boom! Edit in vscode, test in picotron. The file can even be loaded into RAM with load cart..p64
It's a too bad that the load cartridge right-click function isn't available on folders, out of the box.
I hope the method will somehow survive, as it's an easy to remember solution.
Thanks



yes, my method also allows to "load s..p64" on the desktop in my case. Ctrl-r also works in addition to the double click.
I can thus edit with picotron and vsc.
the saves from picotons are directly updated in vsc.
on the other hand, you have to restart "load s..p64" in the picotron console to update the picotron editor after a save in vsc.
luckily the console keeps in memory with the up arrow
it would just be necessary for the save from vsc to update the picotron editor to avoid "load s..p64" with the console at each test with ctr-r
The double click does not have this problem




I succeeded thanks, you had to launch the commands in the console then use the src drawer
GG thanks :)




By combining renaming the card ..p64 your extload command is enough. we thus gain the double click.
the only remaining problem is the picotron editor which does not update when we save with vsc. we must close and reopen the tab.
the reverse is ok as well as ctrl-r and double-click.
We should modify code.p64 for an automatic refresh.
[Please log in to post a comment]