Log In  


(This may sound convoluted)

Is it possible to invoke an embedded ("export html") pico-8 program's functions from an external javascript file?

In this particular case, I wrote a .js app that fetches remote data asynchronously (via ajax). I then want to map that data to a sequence of pico-8 program function names, invoking each one in turn at regular intervals.



I see you can emulate events by writing to pico8_buttons array. Not exactly what I had in mind but it's (infinitely) better than nothing.

Still, I need to map my data to (up to) 26 different actions (or, function invocations), so if anyone knows of a way, I'd love to hear from you.

Thx!


If you assign a new Array(128) to the JavaScript global pico8_gpio, you can read from and write to Pico-8 memory 0x5f80-0x5fff. Use pokes and peeks on the Pico-8 side. The easiest method would be to map incoming values to functions in the _update loop. I can't think of a way to invoke an arbitrarily named function communicated over this memory range.


Perfect solution. Thanks for this. I'll figure it out for the function-to-peeked-value mapping.



[Please log in to post a comment]