Hello Community, Really sorry to start a third link on a very close subject, but as I follow my head banging journey to compendium integration, the right question to ask the community seems to change. Link to the 2 other threads if you want to follow my journey <a href="https://app.roll20.net/forum/post/11120503/sheetworkers-getting-the-attribute-id-in-the-sheetworker/?pageforid=11121989#post-11121989" rel="nofollow">https://app.roll20.net/forum/post/11120503/sheetworkers-getting-the-attribute-id-in-the-sheetworker/?pageforid=11121989#post-11121989</a> <a href="https://app.roll20.net/forum/post/11113833/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/11113833/slug%7D</a> OK, my objective is pretty simple : I am working on a compendium and its integration with a custom sheet. The custom sheet has a companion API, so if necessary I can reach my objective through an API function. When dropping a character from the compendium, the system already assigns it a default token, and what i would like is for either a sheetworker or an API function to set the barX_link of the default token to 3 attributes (Karma,Wounds,Damage)... No customization from the user, always these 3 attributes. Few points following my journey: 1- I have seen several people in several threads stating that setDefaultToken was initially an API function, so when I had difficulties with the sheetworker, I tried putting the routine in the API... But setDefaultToken is not recognized when I load my API... Do I do something wrong ? 2- I have had the discussions with another user (Ooosh), that while he was giving an example from DnD 5e that worked to set the links via setDefaultToken in the sheetworker, when I was trying the same it was not creating any link ( inspecting the Objects showed me that it was writing the attribute name in the Token Object, while it was expecting a Token Id) 3- I ended up figuring out that DnD routine was triggered by on("sheet:compendium-drop", () => { while mine was triggered by on("change:drop-name" so I figured it was the cause, and wrote a new routine, very similar to the DnD routine: on("sheet:compendium-drop", () => {
const tokenOutput = {"bar1_link":"Karma",
"bar2_link":"Wounds",
"bar3_link":"Damage"};
setDefaultToken(tokenOutput);
});
This looks like a step forward because I finally have the default token showing the links but this is still not the end of it. Note that there is no value, nor max despite the link ( I also tried to add value and max in the same setdefault token but it didn't solve the second problem), and when a character is dropped, its token normally appears on the VTT, but here it doesn't. Also if I try to drop the token from the journal, nothing happens. Looking at the JS console, I have the following Finally, if I go back in the default token property, and change any of the links, all the linked value suddenly appear, and the default token seems "repaired" (i.e. I can drop it from the journal)... Help from fellow API / Sheet /Compendium people would be very appreciated, because I don't know where to move from here ? Seems the sheetworker is a better way to go (will support people that don't have a Pro Account), but what am I doing wrong that ends up in a broken default token ?