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

API changes to linked token bar values not propagated to other pages

1479131235
Laurent
Pro
Sheet Author
API Scripter
The situation is the following: I have 2 tokens, with bar1 value linked to the same character attribute. When I change the bar1 value of one of the tokens, the bar1 value of the other token changes too. This happens regardless of the pages the tokens are in. Now, if I use an API script to modify the bar1 value (e.g. TokenMod), the bar1 value of the second token does not get modified when it is not in the same page. It only works correctly when the 2 tokens are on the same page. Do other users experience the same bug? Is it a known issue, is there any work around?
1479134453

Edited 1479134551
Tetsuo
Forum Champion
I'm pretty sure this has to do with API scripts not triggering sheet workers, so the sheet doesn't get updated, and the token on the other page doesn't get updated as a result. Charsetatt may be a script that does what you want, as it sets the attribute directly to the sheet. I could be COMPLETELY wrong, and I'm sure The Aaron will be by shortly to correct me, but this is just my best guess.
1479147823
The Aaron
Pro
API Scripter
Not as shortly as I would like.. Mondays are busy. =D So, if I understand the situation correctly, you have 1 token that represents character on one page, and another on a different page.  The bar1 of each token is linked to the same character attribute.  When you use TokenMod to change the bar on on page, the bar does not update for the token on the other page. If you check, you'll likely see that the attribute on the character has been updated, so the situation pre command is: Token 1 :: bar1 :: Value Token 2 :: bar1 :: Value Character :: Attribute :: Value and then after the command it is: Token 1 :: bar1 :: New Value Token 2 :: bar1 :: Value Character :: Attribute :: New Value Probably there is an event that triggers Token 2 to update it's bar when the attribute is changed.  In the past, I'm pretty sure this worked with the API just fine.  However, I noticed it not working for another script I worked on saturday (having to do with Mana calculations).   As for if this should or shouldn't work and if I'll need to add logic to look through all tokens and change every represents of that attribute, I can't really say at present.
1479200524
Laurent
Pro
Sheet Author
API Scripter
Thanks to Franky, I've got a work-around, now. But the results are a bit surprising. The work-around is to set the character attribute directly. The strange thing is that, if the bar value of one token is first set, and then the attribute is set to the same value, then the token on the other page is not changed. Should I write a message in the Bug Reports forum, or do roll20 developers read this thread?
1479210299
The Aaron
Pro
API Scripter
I figure the extra visibility of a bug report never hurts.