Log In  

Since reload() and cstore() can now read and write across carts, it should be possible to create tools to edit carts from within pico8.

I'm making a small utility to reorganize the sfx samples (and remap them to the music accordingly). Keeping it on pico8 itself allows the user to preview what each sample sounds like.

However, it would be great if filesystem commands were accessible from carts themselves.
It is possible to use the commands, but for instance, it would be great if ls() returned a table with the files in the current directory, instead of just printing them to the screen directly.

This would allow to make file browsers (like splore) to choose carts to edit from a running cart.

P#20284 2016-05-07 13:15 ( Edited 2017-04-20 05:06)

I definitely agree, the ls function or an equivalent would be extremely useful in carts!!
Maybe just a function that works like all(table) that lets you iterate through the names of the files?

It'd be great! Love you Zep! ~<3

P#20291 2016-05-07 19:35 ( Edited 2016-05-07 23:35)

I was initially thinking of a table with filenames as keys and file type as value, but you could also make an array and have each entry hold another table with all the file metadata (name, type, size, etc)

something like this:

local files = ls()

-- iterate over the files
for k,v in pairs(files) do
    print(v .. " - " .. k)
end

--> d - wip
--> f - disco_descent.p8
--> f - iconoclasm.p8
--> f - music_editor.p8
--> f - visualizer.p8

or, for the second implementation:

local files = ls()

-- iterate over the files
for file in all(files) do
    if file.type == "d" then
        color(14)
        print(file.name)
    else
        color(6)
        print(file.name .. " - " .. file.chars)
    end

end

--> wip
--> disco_descent.p8 - 1175
--> iconoclasm.p8 - 0
--> music_editor.p8 - 2727
--> visualizer.p8 - 1160
P#20301 2016-05-08 05:32 ( Edited 2016-05-08 13:16)

+1

Having this feature (along with extending DevKit mode to have keyboard support, like we have "mouse"), would be SO helpful for us to build tools for PICO-8 game/level editing.

P#39788 2017-04-20 01:06 ( Edited 2017-04-20 05:06)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-16 10:41:54 | 0.008s | Q:15