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

Sheetworkers - Getting the attribute id in the sheetworker

1664590203
Jiboux
Pro
Sheet Author
Compendium Curator
New post as a follow up of another question regarding sheetworker <a href="https://app.roll20.net/forum/post/11113833/set-default-token-bar-attributes" rel="nofollow">https://app.roll20.net/forum/post/11113833/set-default-token-bar-attributes</a> I am trying to automatically link the token bars to certain attributes on a compendium drop. The wiki post below points the setDefaultToken as the right sheetworker function to do so, but doesn't list bar1_link as a potential property to set... <a href="https://wiki.roll20.net/Sheet_Worker_Scripts#setDefaultToken.28values.29" rel="nofollow">https://wiki.roll20.net/Sheet_Worker_Scripts#setDefaultToken.28values.29</a> Looking at it more closely, on a correctly set token, the bar1_link is not set to the attribute name (say "hp"), but on a unique id for the hp attribute... setdefaultToken actually sets the bar1_link value if asked to, but just with the name, not the id... Googling again the subject, I found instance of people actually able to link this way, and even reporting a bug about it. <a href="https://app.roll20.net/forum/post/4615653/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/4615653/slug%7D</a> Is there any way to get the id of an attribute, to then use it to write the bar1_link with setdefaulttoken?&nbsp; I mean the wiki clearly lists the linking to an attribute as the main goal of setDefaultToken, so there must be a way to make it work
1664591709
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The post you linked to is actually about the API script version of setDefaultToken. I'm not aware of any way for the character sheet to force a bar link.
1664591940
Jiboux
Pro
Sheet Author
Compendium Curator
Oh :( that explains it... Thanks !
1664662121
Jiboux
Pro
Sheet Author
Compendium Curator
The post you linked to is actually about the API script version of setDefaultToken. I'm not aware of any way for the character sheet to force a bar link. Is there really an API version of it ? I tried to move my function to the API (I develop a sheet with a companion API), but setDefaultToken is not a recognized function. I couldn't find it in the Wiki
1664665349
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, sorry, it's setDefaultTokenForCharacter in the api. So, I guess you can link via the chat sheet one? Hmm, didn't realize that.
1664666193
Jiboux
Pro
Sheet Author
Compendium Curator
Well for now, I don't have much success with it... From the documentation, it seems that the sheetworker can set the bars, but not the link... But on the other it does seem DnD sheet does it, so I don't understand why I am unsuccessful with it :(