String
Picotron is currently missing many basic string handling functions. I've created this library to fill in some of the functions that I've come across. If you want to contribute please comment below your code and I'll add it.
Installing
Use load #string
and then press ctrl+R
to install.
Functions
string.upper(str)
Converts a-z characters to their A-Z counter parts.
string.lower(str)
Converts A-Z characters to their a-z counter parts.
string.explode(str, delimiter)
Converts a string into an array, splitting it at the delimiter.
Script to dynamically include libraries, use dynInclude() instead of include()
You only need to specify the library name and it will be auto downloaded and installed if not currently installed then included automatically.
A simple and easy way to include libraries in your cart without the hassle.
Will try to load libaries from the following locations in this order:
1 - ./lib
2 - /appdata/system/lib
3 - /system/lib
4 - The BBS system (Will attempt to download and install the library to /appdata/system/lib
Usage:
The below code will include the basexx library, automatically downloading and installing it if necessary
include("./dynInclude.lua") [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=144273#p) |
The bug this cart fixes was patched in v0.1.0c, no longer needed unless you still use an old version
Use?
load #patch_load
and press ctrl+r
This only needs to be done once and is persistent over reboots
Why?
There is currently a bug where you can only load #<cart>
once per reboot
This is because of a typo on line 27 that doesn't properly delete the current cart
Patching isn't as simple as fixing the line as /system
will refresh itself on every reboot
Run this cart to permanently fix this bug (Persistent over reboots)
How?
When run, store a patched load.lua
in /appdata/system/util
and append some lines to startup.lua
that will copy this patched load.lua
to the /system/util
folder on each reboot
Will it overwrite my startup.lua?
This cart will append to /appdata/system/startup.lua
, so your current startup config will still work.
Src?
https://github.com/PyroChiliarch/picoPatchLoad
Versions:
version 1: main.lua was empty, fixed it.
Hi, I was experimenting with a way of making a multiplayer game on Pico-8 (on different cartriges to have more screen space).
So I was looking for a way to communicate from the cart to the host OS, I know it's possible to inject and retreive data on the web exports with javascript but I'm trying to find a way to do it localy .
I have tried that code:
cls() i_channel=0x804 o_channel=0x805 input='' output='' function _update() local nb=0 repeat nb=serial(i_channel,0x8000,0x1000) for i=0,nb do input..=chr(peek(0x8000+i)) end until nb==0 if (btnp(⬅️)) output..='⬅️' stdout('left ') if (btnp(➡️)) output..='➡️' stdout('right ') if (btnp(⬆️)) output..='⬆️' stdout('up ') if (btnp(⬇️)) output..='⬇️' stdout('down ') if (btnp(🅾️)) output..='🅾️' stdout('𝘰 ') if (btnp(❎)) output..='❎' stdout('𝘹 ') end function _draw() print('\^rf'..output,2,2,7) print('\^rw'..input,66,2,13) end function stdout(str) for i,c in pairs(split(str,'')) do poke(0x9000+i-1,ord(c)) end serial(o_channel,0x9000,#str) end |
it uses the stdin and stdout of the cart to read and write into files when called like this:
> pico8 < input_file.txt > output_file.txt -run mycart.p8
The problem I ran into is that I can't use the same file for the input and output.
My best attempt was to use a pipeline to redirect the stdout of a cart to the stdin of another one like this:
> pico8 -run mycart.p8 | pico8 -run mycart.p8
The problem here is that a strange thing is happening, the first cart boots and works fine but the second one freezes until the first one is shutdown. Then it works as intended, I get the output from the first cart. But I am not able to make the to instances of the cart run at the same time and communicate.
Any idea how to pull it of ?
basexx.lua library for use with Picotron, (very) slightly modified version of https://github.com/aiq/basexx/blob/master/lib/basexx.lua
Install from BBS with load load #basexx
and run it with crtl+r
A file will be created at /appdata/system/lib/basexx.lua
Usage:
include("/appdata/system/lib/basexx.lua") string = "hello world" print("Raw: " .. string) print("Bit (Base2)" .. basexx.to_bit(string)) print("Hex (Base16) " .. basexx.to_hex(string)) print("Base32 " .. basexx.to_base32(string)) print("Base64 " .. basexx.to_base64(string)) print("Crockford " .. basexx.to_crockford(string)) [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=144252#p) |
If you use the command line to set the value of a variable and then attempt to select a pause menu option where menuitem's callback function returns true (that is, an option that's supposed to keep the menu open after selecting), the game crashes with the message "attempt to call upvalue '_superyield' (a nil value)"
Just a calculator, but with a fiery twist. My wife came up with the name, so I had to add a little mascot :) It's a fully functional calculator. At least I hope it is. Better not do your homework or taxes with it ^^;
Update: Fixed some odd behaviour and added a button to make numbers negative or positive.
Update 2: Fixed the behaviour of the % key, added partial keyboard support (at least the numbers are working), a custom icon and meta date.
Things to do:
- Button feedback
I cannot edit after ID8 in the instrument edit.
https://www.lexaloffle.com/dl/docs/picotron_synth.html#Instruments
There are 128 global instruments defined at 0x40000 by default, each 512 bytes. |
Are the 128 instruments mentioned in the specifications scheduled to be available in the editor? Currently there are up to 25.
Also, when multiple envelopes are set to "DATA" mode, the window extends outside of the screen.
Scrolling is required in the same way as for the waveform configuration windows.
The picotron version at the time of this posting is at least 0.1.0d or earlier.
base64.lua library for use with Picotron, (very) slightly modified version of https://github.com/iskolbin/lbase64
Install with load #base64
and run it with crtl+r
A new file will be created /appdata/system/lib/base64.lua
Basic usage:
include("/appdata/system/lib/base64.lua") print("Plain: abcdefg") print("Base64: " .. base64.encode("abcdefg")) |
Basic functions:
base64.encode(string) base64.decode(string) |
Visit https://github.com/iskolbin/lbase64 for advanced usage
Source: https://github.com/PyroChiliarch/picoBase64
dynInclude compatible: https://www.lexaloffle.com/bbs/?tid=141042
This is a retexturing of Captain Neat-O in the Time Nexus by @paranoidcactus, done by my little brother. He wanted to show it off. Get to the final boss to see who it is! :)
A tool to help with print debugging based on the Python package IceCream. There's already a Lua version of IceCream but it won't work with Pico-8/Picotron as far as I know. I've called it db
for debug rather than ic
but it's very similar in concept.
You can download the code here or copy/paste below:
db.lua [hidden]
---------------------------------------------------------------------------- -- print debugging based on IceCream for python -- pico-8 lua version by jason delaat do local ignore = {} local lookup = _ENV for k,_ in pairs(_ENV) do ignore[k] = true end local function format_arg(value, env) for k,v in pairs(lookup) do if v == value and not ignore[k] then return 'db: '..k..'='..tostr(v) end end return 'db: '..tostr(value) end local db_meta = { __call=function(self, value, log) if db.display and log then print(log) elseif db.display then print(format_arg(value)) end return value end } db = { display = true, local_env = function(t) lookup = setmetatable(t or {}, {__index=_ENV}) return lookup end, reset_env = function() lookup = _ENV end, wrap = function(f) local fn = sub(split(format_arg(f), '=')[1], 5) _ENV[fn] = function(...) local log = 'db: '..fn..'(' local result = f(...) for a in all({...}) do log ..= tostr(a)..',' end log = sub(log, 1, -2) log ..= ') --> '..tostr(result) return result, log end end } setmetatable(db, db_meta) end ---------------------------------------------------------------------------- |
\
I don't have an image but been consistently using the mac zip 0.1.b zip version.
Randomly Picotron will crash. Doesn't seem to say anything or have any alerts/messages, just closes.
Have to reopen Picotron and reload my saved cart to begin work again.
Picotron is awesome btw! Thank you for making it.