
I've already built a bunch of API scripts for my campaign to automate repetitive tasks. Currently, I'm trying to build a script to automatically set up all the stats on a new token when I drag and drop it from my list of characters. I already have something similar to the script to set token defaults . However, I can't get it to handle some of the tasks I would like. Current (manual) process steps: 1) Drag a character sheet from the journal to the map (it creates the token) 2) Edit the token to set the "represents" field back to the same character sheet 3) Edit bar1 to link it to the character sheet's "hp" field 4) Edit bar1 (again) to UNLINK it from the character sheet's "hp" field (so it won't link back for generic bad guys) 5) Edit bar3 to link it to the character sheet's "move" field (NOTE: this is a calculated field on the character sheet!) This usually comes up when I'm adding a bunch of bad guys to the map. Say I suddenly need to add five Sathar grenadiers to the map. Naturally, I would like to combine tasks 2 through 5 into an API script fired by step 1. In fact, I'm surprised step 2 isn't already part of Roll20 as a built-in feature. Obstacles: step 2) First off, I can't find a reference in the API for which character a token was added from. So my code can't identify which character to use. Even if it could, the API object reference says that the token's "references" field is read-only. step 3) I can do this. No problem. step 4) I can't do this at the same time (in one script). Idea: set the value, don't link it to begin with. I think that should work. No help needed. step 5) I can't figure out how to reference calculated attributes (or values) from the character sheet in the API.