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 .
×

Benefits of APIs?

Hey all, I'm relatively new to Roll20 and all of its associated APIs, and I feel like I'm missing something.  I see all of these cool and APIs that do things, but when I look at how they're implemented, it seems like it would take me way longer to type out the API command (especially because I would have to look up the exact syntax every time) than to just go into the token setting real quick and add an aura (for example).  Am I missing something about API functionality?  I really like the idea of not having to go into the token settings menu every time, especially since my Roll20 tends to get a little laggy when I have all my player in game and it can take a second or two for my browser to register clicks, but I feel like typing out commands would still be slower.  I also use Beyond 20 as opposed to the Roll20 character sheets and need to continue doing so because one of my players streams our games, and that interface works better for him and his viewers, so I don't even know if any of the APIs that do things like rolling group initiative or checks would work with that extension.  Any tips/tricks for an API newbie?  I do use the 5th Edition OGL Character Sheet and Change Map/Clone Tokens APIs successfully, so I see the potential, and would love to be able to incorporate more.
1616346887
The Aaron
Roll20 Production Team
API Scripter
Generally, the benefit to the API is automating tasks you would otherwise do over and over.  Something like TokenMod, which has an enormous list of options can be daunting to try and remember, but shines when you're creating macros or abilities that make use of them.  (I have to look up the commands to TokenMod all the time and I wrote it!?!! )  A classic example is something like Hunter's Mark: !token-mod --set statusmarkers|!archery-target --ids @{target|token_id} Giving a player that in an ability lets them mark/unmark their target without needing to interrupt the GM to do it (be sure to enable Players Can IDS in the settings). The another benefit is doing things across many tokens that you would otherwise need to do individually.  For example, setting the dead marker on all selected tokens: !token-mod --set statusmarkers|dead API is also great for removing some of the tedium from the interface.  Bump lets the GM put tokens on the GM layer, but still manipulate them from the Objects layer via an invisible token.  That removes the need to move between layers and make changes, as changes to the invisible token are propagated to the GM layer token and vice versa.  UniversalVTTImporter lets you import dynamic lighting lines for maps created in DungeonDraft, which can save you a ton of time if you're already using that program.  GroupInitiative lets you roll all your monsters into the turn order quickly without needing to open each one individually. Other API scripts can be used to generate content for you, such as handling your random encounters or treasure. Giving players new options can be done with scripts like DoorKnocker. Basically, the APi is like an assistant player that can take on the obnoxious and repetitive tasks for you, and help your players do more.
1616346923

Edited 1616347014
Kraynic
Pro
Sheet Author
If you just take the api command by itself, I agree that I wouldn't want to be typing all that out each time.&nbsp; However, just like macros, there are several ways to save commands and then trigger them with a mouse click or 2.&nbsp; For instance, I make extensive use of macro sheets, which are just "characters" that hold a bunch of macros.&nbsp; My ApiMM (stands for Api Macro Mule, complete with a mule avatar) sheet has (as ability macros on the Attributes &amp; Abilities tab) all the various commands I find routinely useful for TokenMod, GroupInitiative, Universal Chat Menu, and Ammo.&nbsp; I use the Bio &amp; Info tab to document any commands I need to remember when setting up the different api scripts (like setting any tie breakers or initiative modifiers for GroupInitiative, or how to set the dynamic lighting line color for doors for Door Knocker), and even some generic attribute calls that might be needed (like what the attribute name would be to reduce wand charges in the "Spell-Like" magic section of the Pathfinder by Roll20 sheet). Just taking TokenMod as an example, I might have a command to apply/clear each token marker that I use regularly.&nbsp; I will probably have commands to add/remove a color dot, and possibly a few that allow me to add a color dot with a number.&nbsp; I will have commands to show/hide nameplates, enable/disable vision, and commands to enable/disable common sources of light.&nbsp; Then as the last thing I write for TokenMod on that sheet, I will write a chat menu that will print to chat a button for each of these commands.&nbsp; I either leave a blank macro/ability at the top of the list on the Attributes &amp; Abilities tab, or drag it there once I am done, because I will be able to take that chat menu macro and copy/paste it to the Collections tab in any game I start.&nbsp; Mark that collections macro as a token action, and it will be available for any token I have selected.&nbsp; This allows me to select a token (or multiples) click the button to bring up the menu in chat, and then click on the command I want in chat to apply that command to the selected token(s). I write each and every command separate from the others as ability macros.&nbsp; This allows me to totally avoid any html replacements.&nbsp; It keeps me from having to find the correct place to edit in a large query macro, and it is easily transferred between games (transmogrifier or character vault).&nbsp; I have one of these for each game system I run, so the usage of TokenMod, settings for GroupInitiative, and attributes documented for Ammo may vary quite a bit from one to another. This is the combination of a couple tricks from the Roll20 tricks thread. Macro Character sheet:&nbsp; <a href="https://app.roll20.net/forum/permalink/7605679/" rel="nofollow">https://app.roll20.net/forum/permalink/7605679/</a> Chat Menu:&nbsp; <a href="https://app.roll20.net/forum/permalink/5927072/" rel="nofollow">https://app.roll20.net/forum/permalink/5927072/</a> The first post in that thread is an index.&nbsp; You should look through that and follow up on any that sound interesting to you.
1616350112
Kraynic
Pro
Sheet Author
The Aaron mentioned being able to make the TokenMod commands available to players.&nbsp; One thing I have done that used that was a multi-part combination lock on a large map/scroll case.&nbsp; Somewhere I ran across a series of alphabet tokens that were meant to look sort of like they were part of a combination lock.&nbsp; There were the letters and a couple end caps.&nbsp; I downloaded all of those from wherever I found them (they don't come up on a quick search, so I can't tell you where they came from) and uploaded them to my art library. Then I created a rollable table with the whole alphabet, created a token from that rollable table, and created a sheet called "Cylinder Puzzle".&nbsp; This character sheet is not visible in the journal for any players, but all players have edit permissions.&nbsp; This allows them to use any macros on it without having it clutter up their journal.&nbsp; On the Cylinder Puzzle sheet, I set up a tokenmod command for each letter, so setting the token to letter a (the ability was called SetA) used this command: !token-mod --set currentside|1 I created an individual ability for each one all the way up through SetZ which set the side to 26. Then I created the chat menu.&nbsp; Whatever is in the [ ] is the part that displays and is clickable, and whatever is in the ( ) is what is called when the menu item is clicked.&nbsp; The menu entries end up being constructed like this: [A](~SetA) That would be the part that would show up in chat as the letter A, and when clicked it would set the currently selected letter token to display A. This is using a roll template from the Pathfinder by Roll20 sheet, but the complete chat menu macro (which I called SetLetter) looked like this: &amp;{template:pc} {{showchar=[[0]]}} {{charname=}} {{name=Cylinder Puzzle Letters}} {{type=attackdamage}} {{roll=}} {{descflag=1}} {{desc=[A](~SetA) ~ [B](~SetB) ~ [C](~SetC) ~ [D](~SetD) ~ [E](~SetE) ~ [F](~SetF) ~ [G](~SetG) ~ [H](~SetH) ~ [I](~SetI) ~ [J](~SetJ) ~ [K](~SetK) ~ [L](~SetL) ~ [M](~SetM) ~ [N](~SetN) ~ [O](~SetO) ~ [P](~SetP) ~ [Q](~SetQ) ~ [R](~SetR) ~ [S](~SetS) ~ [T](~SetT) ~ [U](~SetU) ~ [V](~SetV) ~ [W](~SetW) ~ [X](~SetX) ~ [Y](~SetY) ~ [Z](~SetZ)}} I didn't copy this chat menu to the collections tab, because I only want it to be visible when manipulating these letters.&nbsp; I did set it as a token action so that the button for SetLetter would be visible to anyone who had a letter token selected.&nbsp; When clicked, it generated this visual in chat: I sprang this on my players at the end of a session.&nbsp; I haven't messed around with the TokenLock api, so these are "free floating" and got a little out of line as players messed with them.&nbsp; A couple of the players stayed around and solved the puzzle about an hour to an hour and a half after the session ended.&nbsp; There was an old note left with this case that had clues to what would open it.&nbsp; Totally by accident (I wish I could say I planned it that way), the author of the note had names and title with the right number of letters...&nbsp; though it ended up being past, present, future instead of Frey Raleigh, Wizard. Could this be done without the api?&nbsp; Sure.&nbsp; But then you would have to right click on a token, choose side, go to the correct letter on the slider, and confirm that choice via the Choose button.&nbsp; Much easier to bring up a menu where you can click any letter you want and have the selected token change instantly to that letter.&nbsp; I probably spent as much time setting it up as my players did solving it.&nbsp; But it is a "character", meaning that I can move it to other games (as long as I have TokenMod installed), set the visual tokens up for other words, and the worst that could happen is that I need to change the roll template I am using to display the menu due to using it in another game system/sheet.&nbsp; Just another tool to use in my games now.
As The Aaron said, using the API lets you automate aspects of the game that you would find tedious and time-consuming to do by hand. For complicated API commands, create macros and populate your macro quick bar with the go-to commands you need. Trust me, once you start to do it, you will NOT want to go back. I have a lot of macros in my quick bar, but a sample of them: Damage macro Healing macro Assign healing potions to players Create suite of token actions for PCs and monsters (Token Action Maker script) List all encounters on page (EncounterHelper script) Start combat, advance turn, show conditions on creature (Combat Master script) Toggle inspiration (InspirationTracker script) Flying (Combat Master) Distribute, add, or subtract loot (PurseStrings script) Rollable Tables! (lingering injuries, random events) Group checks (GroupCheck script) And a few more that I can't remember off the top of my head. :)
1616377539
David M.
Pro
API Scripter
FYI&nbsp; here's my standard spiel on recommended scripts, with links and short descriptions.
Kraynic said: The Aaron mentioned being able to make the TokenMod commands available to players.&nbsp; One thing I have done that used that was a multi-part combination lock on a large map/scroll case.&nbsp; Somewhere I ran across a series of alphabet tokens that were meant to look sort of like they were part of a combination lock.&nbsp; There were the letters and a couple end caps.&nbsp; I downloaded all of those from wherever I found them (they don't come up on a quick search, so I can't tell you where they came from) and uploaded them to my art library. That's awesome!&nbsp; Similar idea to this kit on the Roll20 marketplace.
1616465406
Victor B.
Pro
Sheet Author
API Scripter
Apis make life easier. Search this thread for suggested apis and you'll get an exhaustive list. Pick and choose what you want&nbsp;
There are none! Paying for a subscription an it doesn't work! Roll20 takes your money and if it doesn't work, an you don't know how to fixit it's the same for theme! they already have your money! No existing sandbox found.&nbsp; Preparing sandbox to start on game activity.
1617065805

Edited 1617065823
Kraynic
Pro
Sheet Author
Dario M. said: There are none! Paying for a subscription an it doesn't work! Roll20 takes your money and if it doesn't work, an you don't know how to fixit it's the same for theme! they already have your money! No existing sandbox found.&nbsp; Preparing sandbox to start on game activity. Are you logged into your game in another window or tab?&nbsp; That is a fairly normal message if the game isn't active.&nbsp; The sandbox isn't active if no one is logged into the game to use it.
I've have done everything I could think of.&nbsp; Everything at my very limited knowledge of something like this.&nbsp; I've restarted browser, installed new browsers, runed it with a tab opened in the game, created a new game, did everything that I mentioned before, and will try ask a player to be online to test it later, but I'm certain, it will be the same.&nbsp; How can a DM test new Api script if he can't do it wille no one is online?&nbsp; This feels like taking you car to a machanic and me and the other costumers have to fix it without tools or any real knowledge of what we're doing!&nbsp; This is why I pay for stuff I can't do.&nbsp;
1617108630
The Aaron
Roll20 Production Team
API Scripter
APIs are only active when someone (including you as GM) is in the actual VTT.&nbsp; I usually have the API Console open in one tab and the game in another.&nbsp; Then you can type chat commands and such.
1617156865
David M.
Pro
API Scripter
To avoid getting this topic sidetracked by case-specific troubleshooting, here's the link to Dario's Bug thread :)