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

setDefaultToken functionally?

1577110382
Tealk
Pro
Sheet Author
Hello, with this function you should be able to influence the standard values of a token or did i get that wrong? If that is true, I cannot get the function to work. I use the following script and the fields are all there but when I drop the token it has none of the given values. on("sheet:compendium-drop", function() { getAttrs(["live", "live_max", "edge", "def"], function(values) { var default_attr = {}; default_attr["playersedit_name"] = false; default_attr["playersedit_aura1"] = false; default_attr["playersedit_aura2"] = false; default_attr["bar1_value"] = values.live; default_attr["bar1_max"] = values.live_max; default_attr["bar2_value"] = values.edge; default_attr["bar3_value"] = values.def; setDefaultToken(default_attr); }); });
1577111065
The Aaron
Roll20 Production Team
API Scripter
That's an API function. It does not work in Sheet Workers. 
1577111197

Edited 1577112131
Tealk
Pro
Sheet Author
The Aaron said: That's an API function. It does not work in Sheet Workers.  Then why is it listed here ? Why is it not mentioned that api xy is needed? This is the only charsheet I found that uses the function, unfortunately I don't see any reference to a required API there either.
1577116858
Kraynic
Pro
Sheet Author
That is for creating properly linked tokens from something dragged out of a compendium (not from the journal), as far as I can tell.  Are you creating a sheet for a game that has a compendium in Roll20?
1577118276
Tealk
Pro
Sheet Author
Kraynic said: That is for creating properly linked tokens from something dragged out of a compendium (not from the journal), as far as I can tell.  Are you creating a sheet for a game that has a compendium in Roll20? No, sorry, I must have misinterpreted that. Thought it could also be used to standardize tokens from the journal.
1577137933
The Aaron
Roll20 Production Team
API Scripter
Tealk said: The Aaron said: That's an API function. It does not work in Sheet Workers.  Then why is it listed here ? Why is it not mentioned that api xy is needed? Oh!  I stand corrected.  I had no idea they added that for the Compendium stuff.  I'll have to go read that section again.  Sorry for the confusion!
1577139074
Tealk
Pro
Sheet Author
The Aaron said: Oh!  I stand corrected.  I had no idea they added that for the Compendium stuff.  I'll have to go read that section again.  Sorry for the confusion! No problem I got it wrong myself too :)