Log In  


Hi all,

I decided very soon after getting started in Picotron that I was going to try and use it as the primary workstation for my projects (instead of working in external editors like I did for PICO-8). I created a /projects folder and realized very quickly that if I wanted to do this, I was going to need to write some utilities to quickly "build" my projects. So I started working on a build utility in /appdata/system/util that I could call from the terminal.

Pretty quickly, however, I ran into an issue of trying to get user input from this utility. The idea was simple: if the user tries to build into /ram/cart, get confirmation from them before potentially clobbering whatever cart was currently loaded. This is pretty trivial stuff in any "real world" scripting language but every approach I tried in Picotron seemed to not work.

Basically, the "program" completes instantly instead of hanging and waiting for user input. Here's the main way I tried getting user input:

function getch()
    while true do
        if peektext() then return readtext() end
        flip()
    end
end

Using ps I can tell the program is still running in the background, but it never receives input from the terminal. Digging into the system code a little bit, this seems to be caused by the terminal app running user code as a coroutine and never giving it input focus.

Does anyone know of a way for my utilities (or basically any "command-line" app) to get an exclusive hold on the terminal so that I could, for example, have it wait for user input without immediately completing?

(P.S.: I also tried running the utility as a "game" with an _update(), _draw(), and _init() function, but the same issue occurred.)



Given the limits of the current terminal, this isn't possible. I'm attempting to build a terminal capable of waiting for user input but I can't say when I'll be done



[Please log in to post a comment]