
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!