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

API Updates

1733798509
The Aaron
Roll20 Production Team
API Scripter
Keeping parity with the Roll20 Tabletop, we've rolled out a few minor feature updates, see below for more details! [Jumpgate] Page Object: darknessEffect The new Darkness Effect is now available on Page objects using the darknessEffect property.  There are 3 values you can set: Value Result "none" This is the Overlay  effect, just pure darkness. "lightfog" This is the Pale Mist effect, light colored mists slowly swirling about. "darkfog" This is the Dark Fog  effect, dark colored fog slowly swirling about. Set these values on a page object: page.set('darknessEffect', 'darkfog'); Text Object: stroke Text objects now have access to the stroke  property.  You can use the same rules for setting the stroke  color as you do the color  property.  The stroke  property defaults to "transparent" . createObj('text',{     top: 70,     left: 280,     font_size: 26,     font_family: "Goblin One",     text: "Time for your Doom!,     color: "#ff0000",     stroke: "#000000"     layer: "map",     pageid: pageid }); Image URLs Image URLs will now use the correct version of the image ( thumb , max , etc) based on the property they are being set into. Card Object: card_back Card objects now have the card_back  property exposed.  The value will be "" (empty string) if the card uses the deck's back, or will contain a URL if the card has its own back.   sendChat("Card List", `<div>This card: <img src="${card.get('card_back')||deck.get('avatar')}" /></div>`); You can set card_back following the same rules as for the card's avatar  setting: createObj('card',{     name: "Attack +2",     avatar: AttackP2URL,     card_back: AttackCardBack,     deckid: MoveDeckId }); findObjs() Additions There is a new option for findObjs() , startsWith .  If you set startsWith  to true , any string comparisons check if a string begins with a given value.  For example, if you wanted to find all the graphics with a name that started with "NPC" , you could use: let NPCTokens = findObjs({type:'graphic', name: 'NPC'},{startsWith: true}); You can of course combine this with caseInsensitive : let NPCTokens = findObjs({type:'graphic', name: 'npc'},{startsWith: true, caseInsensitive: true}); In addition, there are some behind the scenes changes to the way that filtering works which will speed up some cases (specifically, simpler comparisons are used to eliminate objects before more complicated ones).  Furthermore, image URLs will now match exclusive of unimportant details (cache buster differences, format differences, etc.).
1733801787
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
On the imagURLs update, how does that change script writing? Example, previously a graphic had to be set using the thumb option of the image property. Does this mean you can now specify <a href="https://s3.amazonaws.com/files.staging.d20.io/images/123456/med.png?12345678" rel="nofollow">https://s3.amazonaws.com/files.staging.d20.io/images/123456/med.png?12345678</a> and it will substitute <a href="https://s3.amazonaws.com/files.staging.d20.io/images/123456/thumb.png?12345678" rel="nofollow">https://s3.amazonaws.com/files.staging.d20.io/images/123456/thumb.png?12345678</a> on the fly?
1733807413
The Aaron
Roll20 Production Team
API Scripter
That's correct! &nbsp;You can even specify <a href="https://files.staging.d20.io/images/123456/original.png?12345678" rel="nofollow">https://files.staging.d20.io/images/123456/original.png?12345678</a>. And it will work.&nbsp; More importantly, when you use findObjs() to search for a graphic with a given image, it will match regardless of which you use.&nbsp;
1733811414
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's a lot of parsing headache gone. Cool!