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

Token bubbles and character sheets only updating one way

1645374025

Edited 1645374368
Joel
Pro
I'm using a pretty straight-forward custom character sheet. If I change a token-linked attribute on the sheet itself, it will update the associated token bubble. But if I update the token bubble, it does not update the sheet. I've discovered that every now and then the token change WILL update the sheet, but not normally, not regularly, not consistently, which is obviously less than ideal. I suppose there could be a thousand possible reasons, but I thought I'd start with anything obvious, some syntax that must be complied with, etc.  The token bubbles are assigned to attributes like so: Bubble 1 is tied to <input name="attr_current_health" class="ability_score" type="text"> Bubble 2 is tied to <input name="attr_defense_screen_points" type="number" style="text-align:center; font-size:16px; font-weight:bold; width:60px; border-left:1px solid black;">  Bubble 3 is tied to <input name="attr_defense_suit_points" type="number" style="text-align:center; font-size:16px; font-weight:bold; width:45px; border-left:1px solid black"> There are no scripts acting on these attributes except the attr_current_health_max, which gets calculated by a script like this (which for its part, it functioning as expected) // calculate stamina and max current health on("change:sta_base change:sta_mod change:sta_xp sheet:opened", function() { getAttrs(["sta_base","sta_mod","sta_xp"], function(values) { let foo_sta_base = parseInt(values.sta_base)||0; let foo_sta_mod = parseInt(values.sta_mod)||0; let foo_sta_xp = parseInt (values.sta_xp)||0; let foo_sta = foo_sta_base + foo_sta_mod + foo_sta_xp; setAttrs({ sta: foo_sta, current_health_max: foo_sta }); }); });
I found the reason, but not the cause. After having all the token's bubbles assigned to attributes and saving those token changes, then going to the character sheet and assigning that token to its character sheet, the next time I open the token the bubbles have lost their assignments and are reset back to "none". This is all on one map, not across different maps.  After setting this token up and saving it like so.... When the token stops updating the sheet, I go back into the token and it looks like this...
deleting my cache and there are no extensions that should be interacting with this. Still, if you suspect a reason, if there is something wrong with the way I set up my attributes, let me know.  Thanks
1645377493
GiGs
Pro
Sheet Author
API Scripter
Have you saved the token as the character's default token? This is a step that is easy to overlook, but must be done last, after all changes to the token have been made. Also, as a Pro user, you can use TokenMod which makes this easy.
1645443549

Edited 1645443679
Andreas J.
Forum Champion
Sheet Author
Translator
<a href="https://wiki.roll20.net/Default_Token" rel="nofollow">https://wiki.roll20.net/Default_Token</a> Using TokenMod , it's much quicker to update the default token of a character. Make the setting changes to the token you want make sure the token is already set to represent the character Selected token, and do this command: !token-mod --set defaulttoken If the token isn't set to represent a character, you can do this command: !token-mod --set represents|@{Bob|character_id} defaulttoken Replace Bob with the name of the character(in the N Journal -tab) you want to update the default token for.
1645447991

Edited 1645448823
Joel
Pro
Yes the tokens were all saved to their sheets. Sorry, that's what I meant by "then going to the character sheet and assigning that token to its character sheet," I should have been more specific about saving it as well. It was very odd behavior. I was trying to set up my five players' sheets and tokens in a new game with my new sheet, no APIs at all yet, I noticed the strange behavior (one-way communication) and finally got one fixed, saved, would drag out a fresh copy onto the map to make sure it had really saved, all good, would move on to the next one. But after a couple more had been fixed, the ones that had already been fixed were messed up again. And stranger still was the fact that after they had reset themselves to None, updating the sheet still updated the token, just not the other way around (one-way communication). If the token bubbles were really reset to None, I would not expect any action on the character sheet to make any changes on the token. I'm quite baffled. In one case I removed the value="0" from the sheet HTML and that seemed to fix it, I thought "ah ha, I found the problem" but no, soon the problem was back.&nbsp;After repeated attempts to fix them all, I finally got all five working correctly, but it was very hit-or-miss, unpredictable, I could not find a pattern for their behavior. So even though the attribute naming seemed quite straight forward, I thought I'd check with the forum to see if I'd made some dumb mistake. Maybe just a temporary glitch, I just checked this morning and they are working, so I'm hoping it was just a temporary snafu. First game on the new sheets is tonight, so I guess we'll find out.
1645461411
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
This seems to be a case where bubbles are being set via sheet code ? Bubble 1 is tied to &lt;input name="attr_current_health" class="ability_score" type="text"&gt; I did not even know that was possible, or if possible, desirable. You listed this on the Character Sheets forum, so my assumption was that this was what you are trying to do. I only bring it up to clarify for the type of help people are posting.
1645461857
GiGs
Pro
Sheet Author
API Scripter
You might have to post your entire sheet code (html and css, but not here -post in a gist or pastebin and link them here), because the problem you're describing in the 1st post shouldnt be happening, and it's hard to imagine what's causing it. Being able to look at your shete, and replicate your setup, is the only way forward IMO.
Point taken, I probably could of should of posted in a different forum, then? Sorry, still learning my way around the forums. I assumed I'd done something stupid to my character sheet code, so I guess when I saw a forum called Character Sheets that's where I finally ended up looking for help. But no, if I understand your comment correctly, I was not putting sheet code inside the bubbles. In that post I was just trying to answer some anticipated questions by showing what the syntax of my token-linked attributes looked like. I assigned the token bubbles in the completely normal drop-down-list way in the token settings. I'm still baffled by what was happening, but it happened repeatedly. It was such strange behavior that it's hard to easily describe. The tokens and their sheets would work fine for a while, as in a few seconds or minutes, then some would develop a one-way connection where changes to the token bubbles would not get passed to the sheet, but changes to the sheet would get passed to the token. It was like a one-way street. When I would re-check the broken token's settings, some or all of the bubbles were reset back to None, but the one-way connection still existed, which was extra baffling. I wish I would have made a screen-grab video. If it happens again, I will. At some point after changing and saving them a few times, and after clearing my cache, they all seem to be working ok now. No idea what was going on. Just thought I should ask, since I'm still learning how to make my own sheet, I thought that might be where the error was made.
1645463196

Edited 1645475862
GiGs
Pro
Sheet Author
API Scripter
Since you are building your own sheet, and likely the only solution to the issue is examining your sheet, you posted in the right place. But if its fixed itsefl, its also possible that roll20 was just a bit glitchy this time - it happens sometimes.
1645470559
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Joel. Like GiGs said, you posted in the right place. The wording was just unusual enough that I wanted to make sure questions and answers were coming from the same understanding of the issue. Glad it's working.