(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.
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/bimg/pi/pi0.png)
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!
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/bimg/pi/pi31.png)
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.
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/bimg/pi/pi0.png)
Perfect solution. Thanks for this. I'll figure it out for the function-to-peeked-value mapping.
[Please log in to post a comment]