Log In  

Right, so basically what I'm trying to do is, when a game is running in JS, get some kind of data from them on some kind of event in-game. Example: achievements in-game captured by a website in JavaScript. Anyone found a way to do this? GPIO maybe?

P#41254 2017-06-03 00:20 ( Edited 2017-06-05 02:52)

yes, the GPIO is accessible via javascript

from the manual:

Cartridges exported as HTML / .js use a global array of integers (pico8_gpio) to 
    represent gpio pins. The shell HTML should define the array:

    var pico8_gpio = Array(128);
P#41255 2017-06-03 00:54 ( Edited 2017-06-03 04:54)

I did similar like this just several days ago for my game, "Kelin's Delivery: Rain", but on integrating it with Kongregate API and Newsgrounds API. And yes, I use GPIO to do it. It worked well.

I added extra function in the JS loop after "Browser.mainLoop.runIter((function(){" to check GPIO memory value whether it is 0 (not reached) or 1 (reached). I defined the extra function in other js file to update less hassle when updating the game.

P#41256 2017-06-03 01:00 ( Edited 2017-06-03 05:09)

Thanks guys!

P#41304 2017-06-04 22:52 ( Edited 2017-06-05 02:52)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-16 12:33:19 | 0.006s | Q:14