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

Mod (API) Server release - Feb 28th, 2025

February 28 (1 month ago)
The Aaron
Roll20 Production Team
API Scripter

Hi all, I've just pushed an update to the Default and Experimental Mod (API) Servers.

Bug Fixes:

  • Calling .set() on a handout’s notes or gmnotes or a character’s bio or gmnotes from within a .get() for same no longer causes the API to crash. 
  • Calling .get() on a handout’s notes or gmnotes or a character’s bio or gmnotes which is empty no longer returns the string "null"
  • User changes to handout’s notes or gmnotes or a character’s bio or gmnotes get property cached on the API side preventing a revert by future API writes.
  • Inline rolls parsed by sendChat() from within the API no longer fail for leading triple brackets, for example [[[a] 1d6]].
  • Inline rolls parsed by sendChat() from within the API no longer fail for leading spaces, for example [[ 1d6]].
  • Nested Inline Rolls are properly processed to prevent mis-substitution of results.
  • Sending multiline API commands no longer drops some of them at random, for example Walls API script input.
  • Setting a status marker on multiple tokens reusing the same object no longer replaces all existing status, for example:

let opt = {status_blue: true}; 
tokens.forEach(t=>t.set(opt));


 A few of these bug fixes are especially near and dear to me =D:


New Features

getSheetItem() and setSheetItem() provide abstractions around getting and setting attributes or computeds on Legacy and Beacon Sheets.  Note that these are both async functions, so you will need to await them, or capture the Promise they return and use it appropriately. 

Documentation for the New Features above will be added next week, so this is a bit of a preview:
getSheetItem()

This function provides an abstraction around getting the value of a property on a sheet, and works similarly to getAttrByName().  It is available in Production and Experimental, meaning you can write scripts against just this interface and they will work everywhere.

async getSheetItem( character_id, property, value_type)
    • character_id – This is the ID for a character in the game.
    • property – This is the name of either an attribute or a computed on the character.
    • value_type (optional) – This is an optional string that specifies a sub property.  In the case of an attribute it can be either "current" (the default) or "max".  For a computed, it is sheet dependent, but "current" and "max" should exist for properties expected to be used as bars on a token.


setSheetItem()

This function provides an abstraction around setting the value of a property on a sheet, and works similarly to .setWithWorker().  It is available in Production and Experimental, meaning you can write scripts against just this interface and they will work everywhere.

async setSheetItem( character_id, property, value, value_type)
    • character_id – This is the ID for a character in the game.
    • property – This is the name of either an attribute or a computed on the character.
    • value – This is the value that will be set to the property on the character.
    • value_type (optional) – This is an optional string that specifies a sub property.  In the case of an attribute it can be either "current" (the default) or "max".  For a computed, it is sheet dependent, but "current" and "max" should exist for properties expected to be used as bars on a token.


Please let me know if you experience any issues with the API, or have any questions about the above!   

March 01 (1 month ago)
Andrew R.
Pro
Sheet Author

Huzzah! Thank you!

March 01 (1 month ago)
This is fantastic news to see some progress being made on the API side for the new sheets. 

Quick question, does this fix the GroupInitiative issue in the Default server or do we still need to use Experimental for that?

Keep up the good work. It is greatly appreciated.
March 02 (1 month ago)
Joe
Pro

Great work, Aaron! Benefits of being on the inside of the system. :D But your excellent quality & documentation benefit everyone!

March 02 (1 month ago)
The Aaron
Roll20 Production Team
API Scripter


Steverhud said:

Quick question, does this fix the GroupInitiative issue in the Default server or do we still need to use Experimental for that?

Beacon Sheets (like the D&D 2024 Sheet) are currently only exposed to the Experimental API server, so you'll still need to use it if you're using a Beacon sheet in your game.  The issue that was happening with Beacon sheets and the Experimental API was fixed by Nicole the week before last (sorry, I was on vacation and didn't get the chance to call it out specifically!), so nothing should be preventing full functionality there at this point.

Please let me know though if you are still hitting any issues!

March 03 (1 month ago)


The Aaron said:


Steverhud said:

Quick question, does this fix the GroupInitiative issue in the Default server or do we still need to use Experimental for that?

Beacon Sheets (like the D&D 2024 Sheet) are currently only exposed to the Experimental API server, so you'll still need to use it if you're using a Beacon sheet in your game.  The issue that was happening with Beacon sheets and the Experimental API was fixed by Nicole the week before last (sorry, I was on vacation and didn't get the chance to call it out specifically!), so nothing should be preventing full functionality there at this point.

Please let me know though if you are still hitting any issues!

I can confirm that the GroupInitiative API does work in the Experimental server on Beacon sheets and that is great. However, I have noticed that my game keeps reverting back to the Default server and I have to switch it back. I just looked today, for example and it is back to Default. 

Is this normal? Will I need to switch it back before every session?



March 03 (1 month ago)


The Aaron said:


Steverhud said:

Quick question, does this fix the GroupInitiative issue in the Default server or do we still need to use Experimental for that?

Beacon Sheets (like the D&D 2024 Sheet) are currently only exposed to the Experimental API server, so you'll still need to use it if you're using a Beacon sheet in your game.  The issue that was happening with Beacon sheets and the Experimental API was fixed by Nicole the week before last (sorry, I was on vacation and didn't get the chance to call it out specifically!), so nothing should be preventing full functionality there at this point.

Please let me know though if you are still hitting any issues!


The Aaron, can we get it so that if we set a game to the experimental API server that that particular game will always open up into that server until changed?  



March 04 (4 weeks ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Oginme said:


The Aaron said:


Steverhud said:

Quick question, does this fix the GroupInitiative issue in the Default server or do we still need to use Experimental for that?

Beacon Sheets (like the D&D 2024 Sheet) are currently only exposed to the Experimental API server, so you'll still need to use it if you're using a Beacon sheet in your game.  The issue that was happening with Beacon sheets and the Experimental API was fixed by Nicole the week before last (sorry, I was on vacation and didn't get the chance to call it out specifically!), so nothing should be preventing full functionality there at this point.

Please let me know though if you are still hitting any issues!


The Aaron, can we get it so that if we set a game to the experimental API server that that particular game will always open up into that server until changed?  




That's actually the way it is supposed to work. There is a bug that sometimes reverts the server. It seems to have become less often over time, at least.

March 04 (4 weeks ago)
The Aaron
Roll20 Production Team
API Scripter

Unfortunately, that's not part of the code I'm currently set up to work on.  As Keith said, that's how it's supposed to work, but something (I'm speculating the restart logic from sleep) isn't working quite right.  I'll make sure there's a ticket for that so that someone with access can take a look at it.

March 04 (4 weeks ago)
Kurt J.
Pro
API Scripter

Thanks Aaron! Using the information above I was able (after converting everything to async) to get these working and access beacon values from ScriptCards. It is experimental right now, but after testing I'll work on packing it up for eventual release.

March 04 (4 weeks ago)
The Aaron
Roll20 Production Team
API Scripter

Awesome!!!

I've been waiting for the getSheetItem as it will be useful for me. where can I find the documentation for it? All I can find is this - https://help.roll20.net/hc/en-us/articles/30377793782423-How-to-Update-Mod-API-Scripts-for-D-D-2024-Beacon#h_01JNEWKNQ4KMFSK07X41ZDZNHT. a script I've written keeps returning stale data until I restart the API, I have updated the hp in the character sheet but the log does not show this change. I'm really no expert with this so forgive me if I've missed something simple. 

March 11 (3 weeks ago)
The Aaron
Roll20 Production Team
API Scripter

That's the right documentation.  One thing to check is that you are seeing the EXPERIMENTAL console output from this update: https://app.roll20.net/forum/permalink/12256475/  There's an existing bug with how the Mod (API) Server restarts that can leave it running DEFAULT despite choosing EXPERIMENTAL.

I'd suggest starting a new thread in the Mod (API Scripts) forum with your script and the community (including me) can help with digging into the problem.