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 .
×
Advertisement Create a free account

Overconfident?

1612993562
I noted that there is a library of ready made API scripts so I upped my membership to Pro (from plus) to give it a shot thinking that perhaps I do not need to be a programmer to use the scripts. I think I was overconfident... I went to the API library and clicked "critical" and typed in the command in the chat box and got an error. I clicked on "fumbler" and same thing. I can't find an "intro" to using roll20 api scripts so I think I may just go back to plus
1612994472
The Aaron
Forum Champion
API Scripter
Here's a good place to start:&nbsp; <a href="https://www.youtube.com/watch?v=jam2yx8btaQ" rel="nofollow">https://www.youtube.com/watch?v=jam2yx8btaQ</a> Many scripts in the repo have a long and storied past most easily understood by looking at the threads that spawned them on the forum.&nbsp;&nbsp; For Critical, are you typing: !critical For fumble: !fumble There is a wide variety and range of polish to the different scripts.&nbsp; It might be easier to start with what you'd like to accomplish with the API, perhaps how can the API make your game easier or more fun?&nbsp; What sorts of things do you find yourself doing that you feel like there has to be a better way?
1613002912
I'd say start slow, with one or two focused scripts that will improve your quality of life at the game table, like GroupInitiative (by The Aaron) or Token Action Maker (by keithcurtis). Once you've got a handle on it, then you can branch out. It took me years to become the full-blown script fiend I am today. ;)
I recommend you make a copy of your game for testing scripts, and maybe one or two sandbox games with just a few pages and tokens to play around in. There are so many scripts to choose from, and you can create macros that call scripts to accomplish all kinds of complex tasks with the push of a button or two.&nbsp;
1613009750
Gold
Forum Champion
I'd say stick around and try API scripts for a month, following the advice posted above. Enjoy. It is fun and convenient, and community-created, community-supported, in large parts, again referring to people above for example The Aaron has a nickname "The Arcane Scriptomancer" on here. Pretty neat.
1613155552
Thanks! I don't know what happened when I first tried the API but they weren't working. I thought I was doing something wrong. However, I made a copy of the game as you suggested and tried them and they seem to be working! Now I have to try them on my "actual" game....
1613156285
timmaugh
Pro
API Scripter
Good to hear, Victor! Remember that sometimes a script can break your sandbox, and you'll have to restart it. If you go to your Script Library for the game you might see a big pink error box alerting you that an error was detected and script execution has been halted. On the first/main tab of the script library you'll see a button to restart the sandbox. Doesn't hurt to give that a try if a script doesn't seem to do what it should. (In fact, sometimes you *won't* have the pink error, but things just aren't behaving right... you should start with rebooting the sandbox to see if that works.)
1613157385
I just want to say, you arent' the only one.&nbsp; I decided to go from Plus to Pro, mainly for the Transmogrifier not the API, but as I'm here, I've started dabbling.&nbsp; I came to Roll20 with no idea about programming at all, I can just about understand some basic HTML now, Roll20 has given me a reason to learn a little.&nbsp; So for i have TokenNameNumber, which is a godsend when adding monsters, Maplock, for when players get too enthusiasit and i think it is called AuraHealthColours so that ithe tokens get an aura when they reach 50% health.&nbsp; There are a couple of others but i haven't translated the arcane instructions into something i can understand yet.&nbsp; My advise is when you come across something that you think a script might help with google it and see what you find, and take it one at a time, get one little thing to work and, if you are anything like me, you will be dancing around the room and calling the people on this forum gods for solveing your little problem.&nbsp; i will also add that eveyone has been extremely helpful when it comes to advice and help, without them I wouldnt' have got any where near as far as i have.
1613233386
Jay R. said: I'd say start slow, with one or two focused scripts that will improve your quality of life at the game table, like GroupInitiative (by The Aaron) or Token Action Maker (by keithcurtis). Once you've got a handle on it, then you can branch out. It took me years to become the full-blown script fiend I am today. ;) Any suggestions for what do do when I have questions about specific APIs? For example, I'm trying the Token Action Maker. It does create the token actions but the actions don't work. When I clicked on the "short sword" button for a Redbrand in LMoP I get:&nbsp; Victor G. (GM): -MNywIjfI1k_Cj180Mxq|repeating_npcaction_-MOHDXU4AHwlLskFMtUO_npc_action &nbsp; It's the same thing when I try a different token or action.
1613236708
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There's an official feedback thread:&nbsp; Token Action Maker . But maybe we can work it out here. Are you using the official D&amp;D 5th Edition by Roll20 Sheet. Have you altered the token after the setting up the token action buttons? If so, you can reinitialize by running !deleteta &nbsp;and starting over. You can try running the creation macro with the added argument " name ". That can solve some cases where the character id gets reset for some reason, though usually only in cases where the Character Vault was used.
1613257387

Edited 1613257430
keithcurtis said: There's an official feedback thread:&nbsp; Token Action Maker . But maybe we can work it out here. Are you using the official D&amp;D 5th Edition by Roll20 Sheet. Have you altered the token after the setting up the token action buttons? If so, you can reinitialize by running !deleteta &nbsp;and starting over. You can try running the creation macro with the added argument " name ". That can solve some cases where the character id gets reset for some reason, though usually only in cases where the Character Vault was used. It seems that when I copied the game it didn't copy the character sheets from the original LMop game. I think that's a whole other issue... The API worked fine in the original game once I confirmed the existence of the Roll20 sheet.
1613260052
Jay R. said: I'd say start slow, with one or two focused scripts that will improve your quality of life at the game table, like GroupInitiative (by The Aaron) or Token Action Maker (by keithcurtis). Once you've got a handle on it, then you can branch out. It took me years to become the full-blown script fiend I am today. ;) I tried these two and they are awesome! Now , I just need to find the API that allows me to number the tokens so I don't have 3 "bugbears" listed in the turn tracker when I use GroupInitiative...
1613260453
Oenanthe said: So for i have TokenNameNumber, which is a godsend when adding monsters, Maplock, for when players get too enthusiasit and i think it is called AuraHealthColours so that ithe tokens get an aura when they reach 50% health.&nbsp; There are a couple of others but i haven't translated the arcane instructions into something i can understand yet.&nbsp; I took a quick look at TokenNameNumber, will it work with tokens already on the map? As I mentioned, we're playing LMoP and the maps are prepopulated already.
1613260912
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Victor G. said: keithcurtis said: There's an official feedback thread:&nbsp; Token Action Maker . But maybe we can work it out here. Are you using the official D&amp;D 5th Edition by Roll20 Sheet. Have you altered the token after the setting up the token action buttons? If so, you can reinitialize by running !deleteta &nbsp;and starting over. You can try running the creation macro with the added argument " name ". That can solve some cases where the character id gets reset for some reason, though usually only in cases where the Character Vault was used. It seems that when I copied the game it didn't copy the character sheets from the original LMop game. I think that's a whole other issue... The API worked fine in the original game once I confirmed the existence of the Roll20 sheet. Ah, if you generated the actions in one game, but then copied the game, I'm not sure if that would break the actions. I.e. I don't know if new character_ids are generated. The solution in either case is one of the above, use "name" or regenerate the actions.
1613265270
Victor G. said: Oenanthe said: So for i have TokenNameNumber, which is a godsend when adding monsters, Maplock, for when players get too enthusiasit and i think it is called AuraHealthColours so that ithe tokens get an aura when they reach 50% health.&nbsp; There are a couple of others but i haven't translated the arcane instructions into something i can understand yet.&nbsp; I took a quick look at TokenNameNumber, will it work with tokens already on the map? As I mentioned, we're playing LMoP and the maps are prepopulated already. No. It works when you drag out a token that has %%NUMBERED%% appended to the name of the default token . If you don't mind spending the time to drag out replacement tokens for the ones on the map, go nuts! I highly recommend Tokenmod that allows you to set up those default tokens with a couple clicks. Also, the Roll20 sheet has a companion script that allows for automatically tracking ammo, spells slots, rests...
1613267932

Edited 1613267988
OK, here is my standard spiel on go-to API scripts. I wouldn't expect neophytes to dive into all this right away, but it may be useful to you as a reference. Roll20 Script Recs ChatSetAttr . Its utility won't strike you at first, until you start to want to build your own macros and realize that this script is invaluable in allowing you to modify the sheet directly. Combat Master . Game-changer for combat. Incorporates conditions, combat tracking, concentration, and spell markers. Hugely versatile. Is set up to allow calls from other scripts. DoorKnocker . If you use dynamic lighting, this is essential, elegant, and simple to use. I don't remember what my DM life was like on Roll20 before DoorKnocker, and I don't want to! EncounterHelper . This script is relatively new to the one-click, and still flies under the radar (to me). But it's absolutely boss. You have multiple encounters on a map? Of course you do! Do you use GroupInitiative to add them to inish? I hope you do! But what if some monsters are hidden (on the GM layer) and others are visible? What if they're spread out over a large area and selecting them all would be a pain? Would you like to switch them between layers with one click, or add them to initiative with one click? Get this script. Groupcheck . Huge time-saver for monster checks (Perception, yo) and saving throws against your party wizard's stupid fireball. GroupInitiative . I can't imagine using anything else to handle monster initiative.&nbsp; OGL Companion . Dated, in need of an update, but still essential to me for that !longrest command. MapLock . Have a bunch of tokens in a small room on the map, and don't want to accidentally move them? MapLock is your friend. I LOVE the ability to toggle display of all "locked" objects in red, and have that command (in addition to the basic toggle lock command) in a separate macro, in case I lose track of what's locked and what's not. RecursiveTable . You like tables, but you hate how they render in Roll20's default interface? You want more control of how they display and what you can do with them? What are you waiting for? Roll20 Audio Master . If you use music, absolutely non-negotiable. Bypass the dumb Jukebox and you've got a lot of RP possibility here, especially in combination with keithcurtis's Theater of the Mind Stupid Trick. ScaleOnAdd . This is a weird use case. You might have this script disabled 50% of the time, but when you're setting up a big, complex map with lots of objects and you need to scale a bunch of objects to a certain size, hoo boy, you'll be happy to have ScaleOnAdd in your toolbox. Supernotes . Speaking of keithcurtis, this script gets you as close as currently possible to map pin functionality in Roll20. I use Supernotes in all kinds of ways: to provide map pins, to bring up chat menus of all kinds (music, dungeon keys, etc.), to make monster knowledge available to my players, send a bio image of a monster into chat so my players are properly frightened when they meet the dungeon boss, etc. etc. Great, versatile script. Teleport &nbsp;(grab the one-click version; there are many teleport scripts floating around). Pat has given us a superb new iteration of teleporting, with more in the works. Basic applications: teleport pads on stairs between levels of a dungeon on the same map, trapdoors, etc. But there are definitely more ways to use it... Token Action Maker . When I think Quality of Life enhancement, I think of this script, which, with one click, allows me to access and fire monster powers from the token menu, rather than having to tediously bounce back to the monster character sheet. TokenMod . This is the ur-script on which countless other scripts rest. It doesn't have a focused use, but it lets you do just about anything you want to a token. Absolutely mandatory. Token Name Number . If you're like me, you want "Creature 47" in the chat window, not "Beholder" or "Evil Lord Whose Name You Shouldn't Know Right Now". Simple, effective little script.
1613284323
The Aaron
Forum Champion
API Scripter
Victor G. said: I took a quick look at TokenNameNumber, will it work with tokens already on the map? As I mentioned, we're playing LMoP and the maps are prepopulated already.&nbsp; I have a little script that will do this, I'll try to find it tomorrow.&nbsp;
1613341889
The Aaron
Forum Champion
API Scripter
Here it is.&nbsp; You can have it renumber everything, or just the current page.&nbsp; It only renumbers NPCs, which it considers to be tokens that represent a character that is not controlled by a player. Renumber all NPCs on the current page: !number-npcs --current-page Renumber all NPCS on all pages: !number-npcs Code: on('ready',() =&gt; { const getPageForPlayer = (playerid) =&gt; { let player = getObj('player',playerid); if(playerIsGM(playerid)){ return player.get('lastpage'); } let psp = Campaign().get('playerspecificpages'); if(psp[playerid]){ return psp[playerid]; } return Campaign().get('playerpageid'); }; on('chat:message', msg=&gt;{ if('api'===msg.type &amp;&amp; /^!number-npcs(\b\s|$)/i.test(msg.content) &amp;&amp; playerIsGM(msg.playerid)){ let who = (getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); sendChat('',`/w "${who}" Renumbering all NPCs...`); let count = 0; let args = msg.content.split(/\s+--/).map(s=&gt;s.toLowerCase()); let props = { type:'graphic' }; if(args.includes('current-page')){ props.pageid = getPageForPlayer(msg.playerid); } let tokenData = findObjs(props) .map((o)=&gt;({ token:o, character:getObj('character',o.get('represents')) })) .filter(o=&gt;undefined!==o.character) .filter(o=&gt;''===o.character.get('controlledby')) .reduce((m,o)=&gt;{ let pageid=o.token.get('pageid'); m[pageid]=m[pageid]||{}; m[pageid][o.character.id]=m[pageid][o.character.id]||[]; m[pageid][o.character.id].push(o); return m; },{}) ; let pageIDs = Object.keys(tokenData); const burndown1 = () =&gt;{ let pid = pageIDs.shift(); if(pid){ let pageData = tokenData[pid]; let charIDs = Object.keys(pageData); const burndown2 = ()=&gt;{ let charID = charIDs.shift(); if(charID){ let n = 0; let charData = pageData[charID]; if(charData.length&gt;1){ charData.forEach(o=&gt;o.token.set({ name: `${o.character.get('name')} ${++n}`})); count += charData.length; } setTimeout(burndown2,0); } else { setTimeout(burndown1,0); } }; setTimeout(burndown2,0); } else { sendChat('',`/w "${who}" Renumbered &lt;code&gt;${count}&lt;/code&gt; NPCs.`); } }; setTimeout(burndown1,0); } }); });
1613422690
The Aaron said: Here it is.&nbsp; You can have it renumber everything, or just the current page.&nbsp; It only renumbers NPCs, which it considers to be tokens that represent a character that is not controlled by a player. Renumber all NPCs on the current page: !number-npcs --current-page Renumber all NPCS on all pages: !number-npcs &lt;snip&gt; It worked!
1613423329
The Aaron
Forum Champion
API Scripter
Great!
1613516880
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Note: Currently there is a caveat to using this script on a module. Many NPCs from WotC are just stock Statblocks (Duergar Warrior, Archmage, Commoner) with a name change. ("Olgar Darkhammer", "Goodgulf" the "Grayteeth", Bob the Blacksmith). The script as is will rename these if there is more than one on the map. So "Olgar Darkhammer" might be renamed as "Duergar Warrior 3". This could make playing with provided content confusing. I seriously messed up my GM's copy of Rime of the Frostmaiden, trying to be Mr. Helpy-Guy. I was able to fix, but use with caution.