I usually keep all my carts in a specific folder in Picotron, but it's annoying having to cd into that folder every time I want to load a cart, or type the whole path out. I'd rather just be able to load carts from that folder from anywhere in the filesystem.
So, I made loadcart
. It's like load
(and even uses load
to do the actual loading), but you can run it from anywhere and it'll always load from a folder you specify. (It will default to /desktop
if you don't set a folder.)
Let's say /desktop/carts
is where you store all your carts. You'd run loadcart -d /desktop/carts
at some point to set loadcart's saved folder. Now, from that points on, from anywhere in your filesystem, you can type loadcart mycart
and it would be the same as running load /desktop/carts/mycart.p64
.
Here's the contents of the .lua
file. Just save it to /appdata/system/util/loadcart.lua
. When you run it with the -d
switch, the saved folder will be set in /appdata/loadcart.pod
.
--[[ For loading carts from a specific saved folder. ]] function print_usage() print("\f6usage:\t\tloadcart filename\n\t\t\t\tcan be file or directory\n") print("\f6\t\t\tloadcart -d directory_name\n\t\t\t\tsets carts directory (defaults to \"/desktop\")\n") if (fstat("/appdata/loadcart.pod")) then local meta = fetch_metadata("/appdata/loadcart.pod") if (fstat(meta.dir) == "folder") then print("\f6current: "..meta.dir) else print("\f6current: /desktop") end else print("\f6current: /desktop") end end --show help local e = env() local argv = e.argv if (#argv < 1 or #argv > 2) then print_usage() exit(1) end --load cart based on settings or default to /desktop if (#argv == 1) then if (argv[1] == "-d") print_usage() exit(1) local dir = "/desktop" if (fstat("/appdata/loadcart.pod") == "file") then local meta = fetch_metadata("/appdata/loadcart.pod") if (meta.dir and fstat(meta.dir) == "folder") then dir = meta.dir else print("\f6invalid directory setting, defaulting to /desktop") end end cd(dir) create_process("/system/util/load.lua", { print_to_proc_id = e.print_to_proc_id, argv = {fullpath(argv[1])} } ) exit(0) elseif (#argv == 2) then cd(e.path) if (argv[1] == "-d") then local directory = fullpath(argv[2]) if (fstat(directory) == "folder") then store("/appdata/loadcart.pod","",{title="loadcart utility settings",dir=directory}) print("\f6loadcart set to: "..directory) exit(0) else print("invalid directory") exit(1) end else print_usage() exit(1) end end |
I'm trying to run a /system/util
command from my own custom /appdata/system/util
command, but I can't seem to get the output from the /system/util
to show up when I run it.
For example, let's take a dumb example and pretend I want a custom command called sys_ls
to list the contents of the system folder. I would think my /appdata/system/util/sys_ls.lua
would look like this:
create_process("/system/util/ls.lua", { argv = {"/system"} }) |
And then running sys_ls
should spit out the same output as if I ran ls /system
. But it doesn't. Instead it outputs nothing at all.
Any idea how to get the called command's output to actually display in terminal along with any other output from a custom command?
I cannot figure out what's happening with btn()
. It seems totally random. I made this cart so you can see. I thought it was supposed to imitate PICO-8's btn()
function, but that's clearly not happening.
Also, if anyone knows how to get data from different controllers, please share. Usually I would do something like btn(btn_num, controller_num)
but with btn()
acting the way it is... π€·π
@zep It would be hugely helpful if we had a -home [path]
commandline parameter for Picotron. I'll describe how I currently have it set up for PICO-8, so you can see how it would be helpful for Picotron:
> Computer lab environment, with each computer having Google Drive installed. (Installing Google Drive locally is like Dropbox, but for Google Drive. Basically gives you a G-Drive on your computer that is direct local access to your Google Drive files and folders, so you can, say, save directly from Notepad into your Google Drive.)
>
> PICO-8 is installed on each computer, but the desktop shortcut to launch PICO-8 uses the -home
commandline parameter to point the home folder to c:\pico8
instead of the user's profile folder. Inside c:\pico8
are folder symlinks for carts
and images
that point to corresponding folders in G:\My Drive\pico8
. Then the c:\pico8\config.txt
points desktop_path
and root_path
to ./images
and ./carts
, respectively.
>
> This means no matter which computer they use, c:\pico8\carts
always points to their carts
folder in their G-Drive. And because their carts are saved to the cloud, they're not locked to using a specific computer and they can even access carts from home.
This works beautifully.
However, with Picotron having no -home
commandline parameter, each student is now locked to having to use a specific computer if they want to use Picotron because on each computer, a separate picotron_config.txt
gets created for each student that logs in, rather than just being able to simply have the Picotron desktop shortcut globally point to the single c:\picotron
folder and pick up the global config file in there.
I hope this makes sense. It would be hugely helpful to have this feature.
Or, in place of a -home
parameter, having a -mount
parameter that supersedes whatever is in the picotron_config.txt
file would work too. Then I could just make the desktop shortcut use -mount / "G:\My Drive\picotron\drive"
and that would work just as well.
Just checking web player timings. Please ignore.
(Just to note, this uses really crappy math for getting the seconds, so if it overlaps the current minute's seconds, the numbers will be overlap incorrectly. Just start it again near the beginning of a minute.)
But @zep, check these timings. The web player is running super fast.
This is a fun, simple wallpaper. I was trying to keep it from being too annoying, but also still look cool. At some point I may have it follow the current theme colors. But for now it just uses the spritesheet. It runs idle at around 0.3% CPU and maxes out around 4% or 5% CPU.
You can add this to your Picotron wallpapers by typing this in Terminal (which assumes you've already created a /appdata/system/wallpapers
folder):
load #hexpop save /appdata/system/wallpapers/hexpop.p64.png |
If you want them, I also made three other variations: Fire, Rainbow, and one that follows your theme.
When using Ctrl-X to cut and paste sprites, the sprite flags remain in the old sprite location. Maybe this is intentional? But it seems like maybe the sprite flags should reset back to a brand new, untouched sprite state when sprites are cut and then pasted elsewhere. Here's a GIF showing the behavior:
If you keep increasing the Y value of the cursor, things get weeeeiiird. First, the CPU usage goes out the roof. Second, there's a weird area in the corner that obscures the text. Here's a bit of code that will reproduce the problem:
function _init() y=110 f=0 end function _draw() cls(1) f+=1 if (f%20==0) y+=1 cursor(0,y) print("hai") print("cursor_x:"..peek(0x5f26).."\ncursor_y:"..peek(0x5f27).."\ny:"..y.."\ncpu:"..stat(1),0,0,7) end |
And this is what happens:
I made a very simple FPS controller as a sort of example cart to build off of. This is just to get you going, as opposed to a full framework around which to build a full game. Hopefully it serves as a good jumping off point for someone to make something fun.
It uses player 2's ESDF controls for moving around and SPACE for jumping.
EDIT: Here's a very heavily commented version! Probably way more comments than usually necessary, but it's intended to help you learn, rather than just briefly annotate what's happening in the code.
Dig Deeper
This was made for Global Game Jam 2021 with PIGSquad. The theme was Lost & Found.
Controls
β¬
οΈβ‘οΈβ¬οΈβ¬οΈ - Movement
π
ΎοΈ/β - Interact (Z/X or X/C on keyboard!)
β¬
οΈβ‘οΈβ¬οΈ+β - Dig
β¬οΈ - Jump/Jets
Credits
Everything But Music - @MBoffin
Music - @Gruber (from PICO-8 Tunes Volume 1)
Edit: Forgot to mention, but there is a speedrun mode you can enable/disable from the menu.
Edit 2: Fixed a couple visual errors and balance tweaks. Also made the speedrun mode skip the intro cutscene, and also shows your final time on the very end message screen (after the final cutscene).
You are the ghost of Cubepig, looking for a body! Can you find one on your own, or will you have to trade something... precious...
This game was made in 3 hours by the PIGSquad Twitch Chat during a mini-jam on January 17, 2021.
@zep:
I teach a LOT of students PICO-8 and lately I've been mostly teaching online classes over Zoom. I'm usually doing this webinar style where I am the presenter and the students are participants. I can't see their screen, but they can see mine and there's a Q&A chat window where they can ask questions and so forth.
It would be extremely helpful to be able to copy console error messages to the clipboard. Currently you can hit CTRL-C in the console to copy what's typed into the command prompt, but it would be even more useful, if the prompt was empty, to use CTRL-C to copy the last error generated. Like this:
This would make it so much easier to help students when they run into errors, especially the very young students. If they get an error, they can just hit CTRL-C and paste the error into the Zoom chat. This would also be helpful for people trying to get other live help online, such as from Discord.
I had a lot of fun making this. This is the top-down adventure game tutorial I made for PICO-8, but re-written to work in Voxatron.
I had to make a few changes to how things worked, since it's in 3D, of course, and there are things that Voxatron doesn't have, like a map editor or its associated functions like mget() or mset(), or other functions like btnp() and so forth. But other than those few changes, it's basically the same code as from the tutorial.
Feel free to take it and make your own games with it. :)
I'm sure this is probably an easy answer, but why do these work differently, where co_anim1 resets to nil after completion, but co_anim2 does not?
function _init() co_anim1=cocreate(animate) co_anim2=cocreate(animate) end function _draw() cls() --first method if (co_anim1 and costatus(co_anim1)!="dead") then coresume(co_anim1) else co_anim1=nil end --second method, same as first, --but sent to a function to do --the work. resume(co_anim2) print("co_anim1:",0,0,5) print(co_anim1,36,0,7) if (co_anim1) print(costatus(co_anim1),75,0,7) print("co_anim2:",0,6,5) print(co_anim2,36,6,7) if (co_anim1) print(costatus(co_anim1),75,6,7) end function resume(co) if (co and costatus(co)!="dead") then coresume(co) else co=nil end end function animate() local a=rnd() for i=1,40 do circ(64+cos(a)*i,64+sin(a)*i,4,7) yield() end end |
This code results in this behavior:
I use Dropbox to share my PICO-8 carts, screenshots, and gifs between my desktops and laptop. It's extremely useful to use it that way. It means all my carts in are one place, they're all saved to the cloud, and I never have to worry about which carts are on which device. (Another bonus is that I only have to update PICO-8 in one place, Dropbox, when a new version comes out.)
The TL;DR is just installing PICO-8 in a folder in Dropbox, and then tweaking the config file on each device to make sure it uses the Dropbox folder as where stores the carts and images (screenshots and gifs).
I know there are probably tweaks that could be done to this guide for each person's individual setup, and maybe there are ways to improve what I have set up here, but this has worked for me for half a decade, so.... ¯\_(γ)_/¯ Also, I primarily use Windows machines, so this setup may need tweaking to make this kind of setup work on MacOS or Linux. (It should be effectively the same process, though.)
Here are the steps I use:
1) I install PICO-8 into a folder on Dropbox. I'll call that folder D:\Dropbox\pico8 for simplicity. (My actual path to PICO-8 in Dropbox is way longer, has spaces, etc.)
2) I run PICO-8 from that folder so that it creates the appropriate files and folders in my AppData folder at C:\Users\Dylan\AppData\Roaming\pico-8
3) I create a carts and images folder in D:\Dropbox\pico8
4) I create a symbolic link folder for both carts and images in the root of my C:\ drive by opening up a Command Prompt window and typing the following:
cd c:\ mklink /d pico8-carts d:\dropbox\pico8\carts mklink /d pico8-images d:\dropbox\pico8\images |
This step requires some explanation, and this step might not be necessary for you, but I do it because my full Dropbox folder path has spaces in it and that seems to not work with PICO-8's config file settings.
A symbolic link is a like a fake folder that points to a real folder. So I'm effectively making a fake c:\pico8-carts folder that, when you open it, actually goes to D:\Dropbox\pico8\carts instead.
5) Now I edit my PICO-8 config.txt file to use these new folders. Specifically, I ensure that these settings are set in the config.txt file:
// Location of pico-8's root folder root_path c:\pico8-carts // Desktop for saving screenshots etc. Defaults to $HOME/Desktop desktop_path c:\pico8-images\ |
If the settings aren't already in your config.txt file, go ahead and add them. (The lines that start with // are just comments and can be ignored if they aren't there or are different.)
This makes sure that PICO-8 is looking at the "fake" folders created with mklink above for saving carts and screenshots/gifs. While PICO-8 thinks they are being saved to c:\pico8-carts and c:\pico8-images, they are actually being saved into my Dropbox folder.
I then do steps 2-5 on each device. Now, when I save or load a cart, or I save a screenshot or gif, it goes to Dropbox instead and everything stays in sync.
I'm happy to answer questions on this process, and if you have suggestions for improving it or changing it, feel free to comment below. Like I said above, there are probably many ways of simplifying this process or making it cleaner (like using command line arguments instead of changing the config.txt, for example) but this works for me and I thought others might benefit from its use.
Remember the classic Shockwave Flash snowball fight game called Snowcraft from 1998? 21 years ago! My entry for this year's PICO-8 Advent Calendar is a demake of that beloved Flash game. Huge thanks to @Gruber for helping with the sound effects!
This game uses the mouse. (Sorry, mobile users!)
I tried to make this as close to the original as possible. Have fun! :)
β to show CPU usage (but I don't think it's accurate?)
π
ΎοΈ to show the follow target
This is a quick port of my PICO-8 boids cart. Nothing fancy, just some boids doing their thing.
β to show the follow target
π
ΎοΈ to show CPU usage
I've been wanting to do this for a while. This is a simple boids simulation. Most of the code was adapted from Daniel Shiffman's implementation in Processing.
Feel free to pick apart the code. Unfortunately, it's not commented much, and I'm absolutely sure there are optimizations that can be done.
This is a heavily commented cart that shows one way of doing flowing dialog text with coroutines. If you have any questions on how it works, feel free to ask. Again, this is one way of doing it. :)
I just finished creating a tutorial for making a top-down adventure game in PICO-8. It's 10 relatively short videos (45 minutes for all 10 videos). You don't need any prior experience with PICO-8 to do the tutorial. I have done this tutorial with many, many kids and the games they create with it are always inspiring.
UPDATE 8/25: I've added a bonus step that allows you to add text to your game! :D
UPDATE 8/27: I added another bonus step that allows you have as many types of tiles as you want. You could use them for treasure, special keys to specific doors, teleporters, quest items, anything you want! ποΈπ
You can find it on itch.io and on YouTube:
https://www.youtube.com/playlist?list=PLdLmU93eWisKpyk1WZywUSYAq5dkCPFIv
https://mboffin.itch.io/pico-8-top-down-adventure-game-tutorial
If you have any questions or need any help, feel free to let me know. I hope you enjoy it! :)
My Happy Challah Days entry for the 2018 PICO-8 Advent Calendar was created using this tutorial as the base code. (I added extra features for the jam, like dialog boxes, quests, and a larger inventory, but its foundation is this tutorial.)
View Older Posts