Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Wanting to start making APIs, not sure where to start.

So I just went through the codeacademy javascript course. It took only three hours and I cant help but feel...inadequetely taught. I thought the rest of the lessons might be behind the paywall but when I looked at what it says the paywall gives me, it pretty much says that it gives me projects. And thats wierd as I spent more time learning algebra. And Im sure this is way more complicated. So I thought, maybe after that three hour course, the rest I need is just practice. And if Im going to practice, why not practice making APIs for my campaigns? But not sure where to start. Should I just start spitballing ideas for APIs to make? Help someone else on their project? If the former, Im thinking an API that lets me play music from the jukebox with  chat command. Then I could just go !play victory_fanfare. And done. No need to search through the massive list of jukebox playlists. Or has that already been done?
Already been done. Roll20 Audio Master. I would start with something simple you think you could use for your campaign just to start learning.
okay then uh... what about an API that umm...lets me hide the turn order while keeping it active?
I sorta wrote that one already... by accident. I have a simple turn order tracker that works even if the GM closes the turn order tracker itself and players or the GM uses an end of turn macro. I wasn't sure it would work if the tracker was closed, but I just tested it... lol.
1492678992

Edited 1492679062
Then okay here is one nobody could have made.  I copy paste a formatted monster stat block into bio,  (because with roll20 you can copy paste html formatted stuff and it keeps its format.) then I run an API that reads the stat block, then makes the monster macros for me in the sheet. Since even if someone did it, it would be specific to the kind and source of the stat block used.
1492679102

Edited 1492679114
Or maybe I should go ahead and pay $20 a month for codeacedemy pro.
Devlin M. said: Then okay here is one nobody could have made.  I copy paste a formatted monster stat block into bio,  (because with roll20 you can copy paste html formatted stuff and it keeps its format.) then I run an API that reads the stat block, then makes the monster macros for me in the sheet. Since even if someone did it, it would be specific to the kind and source of the stat block used. I wrote a statblock importer for D&D 4e characters and monsters... someone else has written one for Pathfinder. I know of another someone was working on for Shadowrun chummer files as well as HeroLab stuff. :D
1492681211

Edited 1492681268
I want that importer. Now. I use masterplan for my statblocks, wouod it work on that?  And Im out of ideas. :( Only other thing that takes up a lot of my time is map creation.
oh is there a turn timer?
Devlin M. said: oh is there a turn timer? One that counts rounds or an actual timer that counts down to zero and then advances to the next person's turn?
1492686740
The Aaron
Pro
API Scripter
It really doesn't matter what you choose to do first, it's all about learning. The API runs on top of Node.js, so if you're looking for more in the way of tutorials, reading about the way Node modules work is probably helpful (the whole "event driven" thing).  However, I don't think you need to go overboard there.  Javascript isn't as complicated as it seems and 3 hours is long enough to learn the basics of the language, enough to write some API Scripts. I would start by writing the following: • A script that parrots back whatever you pass it: This will give you the chance to learn about API commands and the chat:message event, which is probably the most used event. !say polly want a cracker polly want a cracker? Then play with the formatting a bit.  Make it whisper it to the person that ran the command.  Add some header text like "The parrot says" to it. • A script that whispers to the GM how far a token moved. This will give you a chance to learn about change:graphic events, probably the other most used event. Start with just the x,y pixel distance, then add the name of the token, convert to the units of the current page, add the name of the character it represents, if any.  If you want to get REALLY fancy, read the lastmove and calculate the actual distance based on the path. • A script that tells you if your roll is higher, lower or the same as your last roll This will give you the chance to get into persisting data and understanding the inlinerolls syntax, which is a bit complicated. !roll [[1d20]] 18 (no prior rolls) 7 (lower) 9 (higher) 9 (same) 20 (higher) Once you've run through those, you'll probably have a pretty good feeling for the parts of the API.
@sky the latter. @Aaron thank you. I sure hope like most things the first stroke is hardest, and after I start it will all just clear up.
1492692942
The Aaron
Pro
API Scripter
Totally true. =D Here's something to start playing with: on('ready', function(){ on('chat:message',function(msg){ log(msg); }); });
Devlin M. said: @sky the latter. @Aaron thank you. I sure hope like most things the first stroke is hardest, and after I start it will all just clear up. Far as I know there is no automated turn timer script... so there you go. :D
1492717616
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I'd recommend taking a look at the  script index and the  repository to see what has been done and for ideas on how things should be done (Aaron's scripts are great learning pieces for this part). There are some things that aren't in either of those places, but that will give you a good sampling of what's available. You may also find something that you want implemented a different way (this is how I wound up making both EasyExperience and Roll20AM).