I extracted all the public names of functions and tables that are visible to Picotron, it might be useful to explore everything that is available
printh doesn't seems to work like in Pico 8 so I couldn't easily make it into a text format, so here is just a screenshot of all the globals functions (in white), tables (in dark blue) and others (in red):
And I also got the functions inside all the tables:
Nice, thank you! Is there an official (or unofficial) Picotron reference doc yet?
I don't think there is a user manual yet, which is a shame because I can't figure out how to display all the layers of a map...
You can find some info in the links inside the faq
most notably the gfx pipeline
Equivalent of sget from Pico-8:
get_spr(sprite):get(x,y)
Still looking for an mget equivalent though O.o
is it possible to find out what args each API function accepts?
@NuSan There is readme.txt
on the Picotron desktop, but that's more of a quick start guide than an actual manual. Still, it's as close as you're gonna get for now, and is pretty handy for getting to know the new UI.
@beepyeah As far as I can tell: no, sadly. Some of the global functions are described in the .lua
files within the /system/
directory, but most others aren't. For most of them, you can get by on prior PICO-8 knowledge, the aforementioned readme.txt
, some of the demos or other pre-installed programs, the html docs released in the days leading up to the launch of Picotron, and even just some simple intuition/trial-and-error. But, even with all that, there are still some mysteries, like clear_key
, peektext
, and wrangle_working_file
to name a few.
I also made an api explorer; the sorting isn't as nice but it will always be up to date: https://gist.github.com/pancelor/0489fc0671cc566db24ee737af4f94c3
RE: Nusans and my own concerns regarding missing map functionality
Polyfill for:
- Missing mget - implemented as mget(x,y,map_layer)
- Replace flag based map layer drawing with Picotron map layers
- Add support to map() for (hidden) tile_w and tile_h properties for maps with tiles that aren't 16x16
The replacement for map() is quite slow as I'm not sure how to read the camera x,y. So remove it if you don't need the functionality described above.
function polyfill_map() --A super nasty and slow polyfill to add missing map functionality local map_data=fetch("map/0.map") --This map function removes the flag-based layer drawing, and allows --you to draw the chosen layer instead. Additionally this function --respects the tile_w and tile_h from the map data. map=function(cel_x, cel_y, sx, sy, cel_w, cel_h, layer) layer=layer or 0 flags=flags or 0 assert(layer<#map_data,"Map layer does not exist") local map_layer=map_data[layer+1] local tile_w=map_layer.tile_w local tile_h=map_layer.tile_h --This could do with a check if its in frame, --but we need the camera x,y for that and I'm not --sure where it is in memory. local min_y=0 local min_x=0 local max_y=cel_w-1 local max_x=cel_h-1 for y=min_y,max_y do for x=min_x,max_x do local dx = sx + x * tile_w local dy = sx + y * tile_h local val=get(map_layer.bmp,x,y) local sprite=get_spr(val) spr(sprite,dx, dy) end end end --Same as Pico-8, but lets you specify the layer. mget=function(x,y,layer) layer=layer or 0 assert(layer<#map_data,"Map layer does not exist") local map_layer=map_data[layer+1] return map_layer.bmp:get(x,y) end end polyfill_map() |
Thanks, this is a huge help!
So it looks like there's no equivalent to mset() yet? That puts a damper on porting my roguelike project over.
I can only imagine how weird this must be for zep, seeing us frantically scrabble together docs when he's probably like, "I have them nearly done, okay, just give me a few days" :D
nice @pancelor it's cool to have a cart to browse all the functions!
I managed to get map working with tline3d for some rotations
but I'm running into crashes and my files ends up corrupted, and I can't load them into picotron anymore, the only solution I found is to use a text editor to manually copy the code/gfx/map part into a new cartridge
function rot(x,y,a) x,y=x-offx,y-offy local ca=cos(a) local sa=sin(a) return ca*x+sa*y+offx,-sa*x+ca*y+offy end m1 = fetch("/ram/cart/map/0.map") function _draw() cls(1) offx,offy=480/32,270/32 local a=time()*.01 for i=1,#m1 do --map(m1[i].bmp,0,0,0,32,32) for y=0,270 do local px1,py1=rot(0,y/16,a) local px2,py2=rot(480/16,y/16,a) tline3d(m1[i].bmp,0,y,480,y,px1,py1,px2,py2) end end end |
Great work @NuSan 👍
@kozm0naut Not seen an official manual (yet), but guess Zep will get to that (+changelog) when he gets time.
Either way, think I'll get started on a Picotron Cheat Sheet soon 😅
(would rather the official manual/reference to be available beforehand - if possible)
@Liquidream It'd be awesome to have a cheat sheet in the draggable tooltray
A command line tool for searching these would be great. I might try to do it, although adding individual manuals (like the program "tldr") would take some time.
it's all begining in #picotron. I got feeling someone will make a cheat sheet for #picotron soon.
Really looking forward to a Picotron cheat sheet. That pico-8 one was a godsend.
[Please log in to post a comment]