API scripts are really just JavaScript, so any resource to learn JS will be helpful. Code Adacemy and Mozilla Developer's Network are both great resources. API scripts are running server-side, so they don't have access to things like the document or window objects. You could look at a NodeJS tutorial (since that's what the API is running under), but most Node tutorials will be focused on creating a JS-backed web server or command line interface, which requires various Node modules you don't have access to, so learning base JS is probably more useful. It's possible you'll run into some corner-case that's a quirk of Node, though, so it's worth bringing up. (For example: I had an issue a while ago trying to store the value of setInterval. In almost every browser on the planet, setInterval returns a number. In Node, however, it returns an object.) Once you feel somewhat comfortable with JS in general, you can look at the Roll20 wiki for documentation on how to use the functions available to you that interact with the VTT. You can also look at Underscore.js , a utility library that's available in API scripts. The general structure of an API script is: on ( some event , function( event arguments ) { var foo = // Campaign (); // filterObjs (...); // findObjs (...); // getAllObjs (); // getAttrByName (...); // getObj (...); var newObj = createObj (...); var val = someObj . get (...); someObj . set (...); sendChat (...);
log (...); }); In particular when studying baseline JS, note that Roll20 scripts use "log", not "console.log".