
Hi all, I've just pushed an update to the Default Mod (API) Server and the Experimental Server. New Features API Access to showing the numbers on Graphic bars, Character and Handout Tags in Default, and Node and Sandbox versions on the Campaign object. Campaign The Campaign object now has two more read-only Javascript Properties: nodeVersion and sandboxVersion . Note that these are properties of the Javascript Object, not Roll20 Object properties. What that means is you just read them off the object directly, not using .get(). ( The reason for this distinction, if you're curious, is that they are provided by the sandbox, about the sandbox, not stored in the backend and shared with the VTT Client. ) nodeVersion Knowing the Node version is useful for seeing what Javascript constructs are supported. on('ready',()=>{
log(`Node Version: ${Campaign().nodeVersion}`);
}); "Node Version: 18.19.0" sandboxVersion Getting the Sandbox Version will similarly let you know what Roll20 Features are available. Right now, it will either return 'default' or 'experimental' which you can use to segregate functionality that only works on a given platform. on('ready',()=>{
log(`Sandbox Version: ${Campaign().sandboxVersion}`);
}); "Sandbox Version: experimental" Some of the primary uses for this will be choosing to draw PathV2 objects, or Path objects, manipulating Page Folders, accessing Beacon Sheets, etc. Handouts and Characters Handouts and Characters through the Journal panel have always had tags you can associate with them to provide fast filtering. These are useful for doing thinks like categorizing handouts for plot or mechanics, searching for creatures by subtype, etc. Access to tags has always been supported in the Experimental sandbox, but now it has been backported to the Default sandbox. Tags are stored as a JSON encoded array of strings, and can be set as such. tags let tags = JSON.parse(character.get('tags'));
tags.push("things");
character.set('tags',JSON.stringify(tags)); You can of course include these when creating character or handout objects, or as part of a set using the object syntax. let handout = createObj('handout',{
name: "Tagged Mysterious Note",
tags: "['tags','mysterious','note','things']"
}); (You can just provide a valid JSON Array string directly also, as shown above.) Graphic Graphic objects now have the bar1_num_permission , bar2_num_permission , and bar3_num_permission properties. These can have 3 possible values: 'hidden', 'everyone', and '' (the empty string). '' or empty string is the default, and represents visible to the editor. 'hidden' means nobody sees numbers, and 'everyone' means numbers are always visible. bar1_num_permission, bar2_num_permission, bar3_num_permission const SetUpToken = (token) => {
token.set({
bar1_num_permission: '', // only the editor sees health
bar2_num_permission: 'everyone', // everybody can see the elevation
bar3_num_permission: 'hidden' // nobody knows exactly how much time is left...
});
}; Note that there is a small display bug in the Token Properties UI where the dropdown for the permission won't reflect what the API changed it to until a refresh happens. This should get cleared up pretty quickly and doesn't effect the behavior of the bar permissions. That's all for now! Definitely let me know if you have any questions or other issues with the API!