This cartridge is an installer and uninstaller for a new globally-available command: 'new'. I already released this in bare script form here and it's largely unchanged, but I've adopted a system that I moved it into for installation and uninstallation on my Picotron, and you can too! You can install this by running this cartridge and pressing X as prompted, manually by copying /ram/cart/exports/appdata/system/util/new.lua
to /appdata/system/util/new.lua
, or by using my dependency and package manager 'yotta' to install this BBS cartridge ID as a system util (yotta util install #util_new-0
).
The new command needs a template cartridge (by default, expected to be at /appdata/new/template.p64
) which allows you to customize your fresh cartridge. When you issue a 'new' command, this cartridge will be copied into /ram/cart
- so if you start with a blank cartridge, customize it to your liking as your new starting-point, and save it as /appdata/new/template.p64
- you're done!
When it creates a new cartridge, it assigns it a custom 'save-as' name. It doesn't automatically save your blank cartridge - it's up to you to press Ctrl+S if you'd like, just like a normal blank cart - but this name will default to /untitled_YYYYMMDD_NN.p64
with a timestamp and an automatically incrementing number to prevent overwriting the first cartridge(s) of the day.
If you'd like this to also be the cartridge that Picotron boots up with, you can edit your /appdata/system/startup.lua
to include the following lines:
if fstat("/appdata/system/util/new.lua") == "file" then create_process("/appdata/system/util/new.lua") end |
My template cart is pretty simple. You can do whatever you want with it, but all I've done to mine is modify the default main.lua script to something like this:
-- New Picotron Cartridge -- by Your Name Here <[email protected]> -- v1: inception -- called once per cart run function _init() end -- called every frame function _draw() end -- called every 1/60th of a second function _update() end |
So, now, when I boot up Picotron or call new
, this is the main.lua that I get in my fresh cart by default.
edited to revision 1: places template file in its namespace at /appdata/new/template.p64
instead of polluting the system namespace.
[Please log in to post a comment]