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

New API Keys

June 03 (3 years ago)

Edited June 03 (3 years ago)
Corey J.
Roll20 Team

Hello API developers and enthusiasts! We have a number of exciting updates to the API for you to go over.

These additional keys have been long requested:


Token
Bar Location - ‘bar_location’
Bar Styling - ‘compact_bar’


Page 

Play on Load - ‘jukeboxtrigger’


For Updated Dynamic Lighting, we have added support for the following:


Token

Light Multiplier - ‘light_sensitivity_multiplier’,
Night Vision Effect - ‘night_vision_effect’


The following two keys are the same from the Legacy Lighting API but we thought it was worth mentioning again: 


Page
Update on Token Drop - ‘lightupdatedrop‘

GM Darkness Opacity - ‘fog_opacity’

And we made a lot of under the hood changes to UDL over the past few months so tokens should be able to update their light renders without the need to restart the page or use the key we added a few months back. So this is a notice that we will be deprecating the key
‘force_lighting_refresh’ in the upcoming months..

We’ve updated all of our Help Center articles to reflect these changes, so you can use those pages for reference.

Cheers!

June 03 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

That is awesome and very welcome news!

June 03 (3 years ago)
The Aaron
Roll20 Production Team
API Scripter

The token properties are now supported in TokenMod!  https://app.roll20.net/forum/post/4225825/script-update-tokenmod-an-interface-to-adjusting-properties-of-a-token-from-a-macro-or-the-chat-area/?pageforid=10136003#post-10136003

Also of note, the setdefaulttokens() API function now preserves all the above settings.

June 03 (3 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

Woot! looking forward to using this!

June 03 (3 years ago)
Gold
Forum Champion

Looking forward to using the API scripts that make use of this (For starters, I make regular use of TokenMod to configure Monster Tokens and PC tokens according to my standard desired settings, being able to switch a whole group of monster tokens to Compact Bar, Underneath & Overlapping style, will be great.)

Thanks Roll20 & those who script Community API Scripts, snippits & the one-click.

June 03 (3 years ago)
David M.
Pro
API Scripter

Particularly excited about the bar location and style! Thank you!

June 03 (3 years ago)

Thank you! It looks like my suggestion can be closed!

June 05 (3 years ago)

Super :)

When do we get api access to the style/placement of the token bubbles? :)



Really, REALLY happy to see all of these but especially the light_sensitivity_multiplier! I have a neat lighting effect combining low light sensitivity and night vision that makes for great temporary obscured vision (like thick fog). Using between 1-10% sensitivity with 15/15 light sources gives them a minor halo effect (like it's piercing the fog) but the rest of the area stays obscured. It makes navigating easier for the player as they can keep a point of reference but can still blindly bump into walls and other obstacles.

I was going to have to either set this by hand each time for each token or keep a second set of player tokens ready on the gm layer and switch out, but now I can add this to the API command that makes all the other changes and finish it out. Thanks guys! Looking forward to using it in the next session this week!

June 09 (3 years ago)
The Aaron
Roll20 Production Team
API Scripter

That sounds like a cool project!  One thing to be aware of: light sensitivity is computed for the full view of a player, so if they have one token with 15% and one with 100%, the view will be as if all of them have 15%.  

Also, there's a minor bug right now where if you remove a token with a light sensitivity setting, it doesn't recalculate the sensitivity multiplier.  you need to either set it back to 100% before deleting it, refresh the page, or set a different value on another token (or set it and set it back).

June 09 (3 years ago)

Edited June 09 (3 years ago)

Thanks for the heads up! I'll definitely keep that second one in mind.

But yeah, I've noticed a few quirks like that since I test with a dummy account that has vision through all the player's tokens. In practice though, each player only uses one each and I've been using force_lighting_refresh as a precaution for the time being. Hopefully that's enough to satisfy the pink kraken. :-)

The only thing left to complete the illusion would be the ability to change the page's darkness color, like you can the background. Shifting it to white or a light gray would sell the "fog" feeling much more. But I won't get greedy, and be happy with this. :-D

June 09 (3 years ago)

Edited June 09 (3 years ago)
The Aaron
Roll20 Production Team
API Scripter

force_lighting_refresh doesn't actually do anything now, and probably will get removed as a property.  (Corey posted that somewhere, I think.  Edit: Here)

You could create a Path object and fill it with a transparent color like #ffffff99 to "white out" the scene.  Just put it on the map layer sized for the area to affect and pulled to the front.

June 09 (3 years ago)

Edited June 09 (3 years ago)

You can display paths over "darkness"? The only trick I know for doing something like that is giving the player control over a token and granting it vision to trick Roll20 into rendering it over everything else but use with a 0deg range, so it can't actually see (actually I think you're the one that suggested that to me a while back, it helped a lot! :-D)

But then you have to use the object layer for vision to count and end up with the awkward situation where they can accidently select and move it. It works fine for temporary things that quickly get removed anyways (like message boxes or spell effects), but I learned not to use it for anything meant to be more permanent, like map decorations.

Edit: Also, holy crap! I never knew you could add alpha values to the colors. That... opens a lot of doors for me... :-D

June 09 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

updated the references on the wiki, where all the api keys are on a single page:

https://wiki.roll20.net/API:Objects

June 09 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Andreas J. said:

updated the references on the wiki, where all the api keys are on a single page:

https://wiki.roll20.net/API:Objects

Thank you!

June 09 (3 years ago)
timmaugh
Pro
API Scripter

The token properties are now also supported in Fetch, making them available in the chat input line of any other script. Usage parameters here:
https://app.roll20.net/forum/permalink/10151776/


June 19 (3 years ago)
Pat
Pro
API Scripter


The Aaron said:

force_lighting_refresh doesn't actually do anything now, and probably will get removed as a property.  (Corey posted that somewhere, I think.  Edit: Here)

You could create a Path object and fill it with a transparent color like #ffffff99 to "white out" the scene.  Just put it on the map layer sized for the area to affect and pulled to the front.

I have a partially working version of just such a thing... 

https://app.roll20.net/forum/post/9631549/slug%7D


Can the turn tracker window be given the option of being moved as an independent window - outside the map window?

June 20 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Not to my knowledge, though you can double click on the header to minimize it.

July 23 (3 years ago)
Corey J.
Roll20 Team

Hi All, 

Wanted to follow up and mention two things that affect the API from the release this week:

The first was the introduction of the 'lightColor' key. This Graphic key will allow a color to be added to bright and dim light for a token. It takes strings with hex color codes like "#0000FF". 

The second  change we unshackled the dynamic lighting keys that were primarily only updating through controlled tokens. This means on object creation and updating values on the fly for lighting should just work in many cases. We have a few more key to fold in as David M. mentioned in the main bug thread here like the directional and bright light keys. So we'll keep you posted when we get those addressed. 

Have a good weekend!

September 20 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

The Sept. 8th changelog mentions:

  • Added Pro API support for removed cards.

Is this a new function or a bugfix to existing stuff?

Was the documentation update? I see several API pages where edited Sept.1st...

September 21 (3 years ago)
Corey J.
Roll20 Team

Hi @Andreas J. 

There were some new keys added to the 'deck' objects


KeyDefault Value
removedcardsmode
'choosefronts'
removedcards
'none'

And related we also added to the 'card' object

KeyDefault Value
is_removed
false

The is_removed flag marks them as "removed" which makes them not get recalled in the deck or show up in the discard pile, instead they show up in a "Removed Cards" section

Andreas J. said:

The Sept. 8th changelog mentions:

  • Added Pro API support for removed cards.

Is this a new function or a bugfix to existing stuff?

Was the documentation update? I see several API pages where edited Sept.1st...




September 24 (3 years ago)

That's nice thanks.

September 27 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

September 1, 2021

  • You can now change the the brightness of Dynamic Lighting Daylight Mode 
  • Adjust Dynamic Lighting Daylight Mode brightness with the Pro API

What's the key & values for this?


September 27 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

daylightModeOpacity, with a value from 0 to 1.


per this thread.



September 27 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

lol missed that I've already added it to the docs

October 10 (3 years ago)

Thank you, that's amazing :D

December 14 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

(comment to avoid thread being archived)

December 27 (3 years ago)

Hey, hi everybody ! \o
Someone can tell me how long PowerCards will stay OFF plz?

December 27 (3 years ago)

Edited December 27 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

This is a thread about new API keys being added to the API library. PowerCard questions should be posted in the PowerCards Feedback thread. Note: You may be interested in investigating ScriptCards, its "spiritual successor".

March 02 (3 years ago)
Corey J.
Roll20 Team

Hi Scripters,

Moments ago we added a new key to give you the ability to lock a Graphic object in place. The feature can be found in the context menu when selecting a token/map on the VTT.

KeyValue
lockMovementBoolean

Warm Regards,
Corey J

March 02 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Thanks Corey!

How long before Tokenmod gets this is the real question!

March 03 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

The Aaron added it today. You can grab it at his git for a manual install, or wait till next Tuesday for the weekly merge. Details are in the Great Big TokenMod Thread.

March 03 (3 years ago)

Corey J. said:

Hi Scripters,

Moments ago we added a new key to give you the ability to lock a Graphic object in place. The feature can be found in the context menu when selecting a token/map on the VTT.

KeyValue
lockMovementBoolean

Warm Regards,
Corey J

This is a great addition! Thank you!

If I could make another suggestion - this would be a great action to have as a hotkey, and my suggestion would be for it to be tied to the '.' key (as in period), so for the regular hotkey it would toggle on a ' Ctrl/Cmd+. ', and for the advanced hotkey it would be ' l . '

March 03 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter


DM Eddie said:

How long before Tokenmod gets this is the real question!


And of course, it's added before anyone even asks about it. Aaron works fast!

March 03 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter


Jarren said:

Corey J. said:

Hi Scripters,

Moments ago we added a new key to give you the ability to lock a Graphic object in place. The feature can be found in the context menu when selecting a token/map on the VTT.

KeyValue
lockMovementBoolean

Warm Regards,
Corey J

This is a great addition! Thank you!

If I could make another suggestion - this would be a great action to have as a hotkey, and my suggestion would be for it to be tied to the '.' key (as in period), so for the regular hotkey it would toggle on a ' Ctrl/Cmd+. ', and for the advanced hotkey it would be ' l . '


I agree, I've had quite a few problems lately with nudging things out of alignment and it is a feature that should be very accessible IMO.

April 13 (2 years ago)
Corey J.
Roll20 Team

Hey Folx,

With One way Dynamic Lighting lines out for use the API has also been updated. Lighting Lines now have a barrierType option that defaults to 'wall'. And if 'oneWay' is used as a value the key oneWayReversed is helpful in changing the direction the arrows are facing. 

KeyValue
barrierType
'oneWay' or 'wall'
oneWayReversed
false or true

Warm Regards,

Corey J

April 13 (2 years ago)
The Aaron
Roll20 Production Team
API Scripter

Nice!

God I wish I was smart enough to do this stuff! 

April 19 (2 years ago)
The Aaron
Roll20 Production Team
API Scripter

The Kingsley said:

God I wish I was smart enough to do this stuff! 

What would you write if you had the time and requisite knowledge already?

April 24 (2 years ago)

Edited April 24 (2 years ago)

1) Most immediately I would write a script to lookup in a lookup table an image and then show it to the players. When the image is clicked on it would then post some text to chat. Specifically I would like to do a 5e Deck Of Many Things. When the table is rolled on it would show the graphic and when the graphic is clicked on it would show the text as per the DMG in the chat. I have tried to get the text into the tool-tip portion of a card deck but it won't take all of the text for some of the cards, (you, the Aaron, have touched on this in a recent Post).

2) Another script I would like is to somehow have a macro attached to a language in the skills section of the character sheet. The macro would whisper to all players that understand the given language language.

3) I would like to figure out how to send images directly to chat in a format that is large enough to see. Right now if I use a roll table with images in it they do show up in chat but they are so tiny I cant see really them.

Ooo That'd be nice. bar locations can be a pain and a setting, if i'm reading this correctly, would be very nice.



3) I would like to figure out how to send images directly to chat in a format that is large enough to see. Right now if I use a roll table with images in it they do show up in chat but they are so tiny I cant see really them.

Actually, I make images in the library that I show the players... but It'd be nice to be able to display it to just one player.. the person who drew it and then the other players would have to venture a guess as to what happened to the player.lol... 

But otherwise, I would lvove to see your suggestion too. :)


Did this do something with token actions? because I don't see the token actions when I click on any of the tokens in any of my games now.