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

Could use some advice!

So I've heard a lot about this super fancy API thing, and it kinda has me excited! It sounds like a number of things can become a lot easier. Now, my regular ($50) subscription is coming to an end relatively soon, and I'm considering getting the Pro one when I renew. BUT I want to make sure I can use the fancy toys I'm buying, ya know? So I have a few questions for those of you who use the API.  What exactly is it/how does one utilize it? I probably don't know the programming language for it, but I can probably learn. Is it worth getting without already knowing the language? Here are some things I'd like to be able to do. If you're willing, can you tell me how possible and how difficult each thing might be to accomplish? A script to easily attach light sources to tokens Allowing players to use above script A script to place down a predetermined set of tokens (like a wandering monster table entry) without dragging each one onto the table An alteration to the Dynamic Lighting that makes it a dark grey, rather than black, and so that it blocks anything on the token layer but not the background layer? An alteration to the Fog of War to make it auto-reveal based on what the characters can see via DL? I can't think of any others. For now... :P Thanks in advance!
1476767735
The Aaron
Pro
API Scripter
Hi, I'll take a stab at some of those! What exactly is it/how does one utilize it? It is a collection of event driven operations that happen on a server in response to things in your game.  That's not a very useful definition, so here some examples of events: An API command is special text you type in chat that does something.   !token-mod --set statusmarkers|interdiction !torch !group-init [[1d8]] Someone moves a token A token takes damage Someone rolls a die The current player map changes You use it by installing one of the many scripts (or writing some).  Events that occur will then cause the scripts to do various things. I probably don't know the programming language for it, but I can probably learn. Is it worth getting without already knowing the language? It's written in Javascript, the basic flow is similar to a Node module (because of the event driven nature and the lack of a DOM to interact with), but you don't need to learn it to benefit from it.  There are hundreds of scripts already and many more written all the time (and people to write them if you have something you need!). Now the other questions in rapid succession: A script to easily attach light sources to tokens -- yes, several.  Torch manages it directly, TokenMod can do all of it as well. Allowing players to use above script -- Yes, definitely! A script to place down a predetermined set of tokens (like a wandering monster table entry) without dragging each one onto the table -- There are several, but with a few limitations based on the graphics involved (Marketplace graphics can't be created by the API currently).  Kings Summing script is one. An alteration to the Dynamic Lighting that makes it a dark grey, rather than black, and so that it blocks anything on the token layer but not the background layer?  -- I'm afraid this is beyond the API.  The API only manipulates existing Game objects, like tokens, characters, lines, pages, etc.  It can't directly affect the UI of Roll20 An alteration to the Fog of War to make it auto-reveal based on what the characters can see via DL?  -- not directly.  Fog of War is a UI thing again.  It could simulate that by covering the entire map in black filled in rectangles and then removing and resizing them to reveal the areas.  There would be some intense calculation for the DL paths, but it would technically be doable... but lets call it very very hard and unlikely to be satisfactory. I can't think of any others. For now... :P   -- You will, ask all of them!
1476767943

Edited 1476768092
Tetsuo
Forum Champion
1.its pieces of code that change the game environment in big ways.  2. I know no languages and heavily rely on APIs 1. Easy. TokenMod.  2. Players can use it too.  3. If it doesn't exist, request it. The community is very helpful.  4. Not possible I'm afriad. As far as I know.  5. Not sure what you're asking. Can you elaborate? EDIT: Always the brides maid, never the bride. TheAaron beat me to it in a much better way :p
1476769054
The Aaron
Pro
API Scripter
( Heheheeheh =D )
I will add to this that I do not know any programming language (although I've learned a little bit over the past year of Pro membership about tweaking other people's hard work...), but I would say that the Pro sub is definitely worth it - most especially if you GM a lot.  There are lots of tools that are available to make things work much more smoothly, and many very useful scripts now have one-click install and good documentation that makes it easy to use them.  You also have super helpful people in this community (as you've already seen) who will help you work through any issues you might have. Happy Gaming!
I'd like to add that torch and token-mod (two scripts provided by The Aaron) alone were reason enough for me to subscribe to the Pro account (and dynamic lighting). They are (roll20-)life changers. And they are just the beginning. There are dozens and dozens of amazing scripts out there. You will stop GMing for a while just because there is so much to play with.
Wow thanks so much for the responses!! I'm sold haha But it is good to know, going in, that I can't mess with the DL or Fog. Now I won't break my brain trying!
1476792269
The Aaron
Pro
API Scripter
Oh, you can mess with DL like crazy. You just can't mess with fog. 
There a range of useful things in API (mainly I use it to auto number and roll hit-dice for my monster tokens at the moment) though there is a list of API's you can use from a drop down theres an even bigger array here on the forums and the really nice people here are great at writing them if you make a request though to me how they actually work or are written is witchcraft but luckily for me most of the writters are considerate enough to make them easy to implement and use.
1476793922

Edited 1476793982
Lithl
Pro
Sheet Author
API Scripter
The Aaron said: the basic flow is similar to a Node module (because of the event driven nature and the lack of a DOM to interact with) I'm pretty sure it is  a Node sandbox, considering how it mirrors Node's ES6 idiosyncrasies, and the timer functions (setTimeout/setInterval) return Node's timer objects instead of an integer. The latter bit screwed up a script I was trying to write a while ago, because I was trying to store the return value from setInterval in state, but state gets serialized to JSON, and JSON can't represent the Node timer object.
1476794264
The Aaron
Pro
API Scripter
I'm pretty sure it is a Node sandbox It is.  But I just like to throw in that note to distinguish it from the in browser javascript most people with javascript experience have experience with. =D
This thread makes me want to go pro, The macro i was doing could have been done much easier with API. Question, can you designate an area on the map to trigger and effect? Such as a sound, tokens moved from gm layer to token layer, decease/increase sound volumes as tokens get closer/farther. Sort of like the original Neverwinter Nights game, when you entered DM mode and made triggers/transitions/sound modifications.
1476800265
The Aaron
Pro
API Scripter
All of those things are possible in one form of another.  There are scripts already that will trigger various things when tokens enter a zone (see It's a Trap for a classic example).