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

[bug] getAttrs inside a sheet:opened listener unable to see character attributes when opened for a player for the first time via Show to Players

June 21 (3 years ago)

Edited June 21 (3 years ago)
Rich R.
Marketplace Creator
Sheet Author
Compendium Curator

...phew, that was a long title, but I figured completeness was important.

This is a possible underlying Roll20 bug that I found while troubleshooting an issue I found on the official Blades in the Dark sheet (that bug report is here).

The repetition steps from that thread that seem to be a general problem are:

  • GM and at least one player belong to and are logged into a campaign.
  • The character sheet for this campaign has an event listener for sheet:opened, and the callback for that listener calls getAttrs for some arbitrary attributes (ex: version and character_sheet), and console.logs them out.
  • GM makes a character, adds it to All Players' journals, gives All Players edit access.
  • GM sets values on the sheet for the Attributes & Abilities that the sheet:opened listener tries to fetch.
  • GM closes  and reopens the character (not sure if this is necessary, but I've been doing it).
  • (crucially) at least one player does not open the character sheet.
  • GM opens the character to the character sheet and hits Show to Players.
  • Result: the console.log statement inside the listener will show undefined values for the attributes it fetches.

There may be other ways to reproduce; I haven't tried every possible permutation of it.
My guess is that there's an async issue, in which, when a player opens a sheet themselves, Roll20 fires off the sheet:opened event only after waiting to fetch attributes from the server, but that wait doesn't happen when Show to Players happens.

June 22 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter

What exactly is happening in this step?:

  • GM sets values on the sheet for the Attributes & Abilities that the sheet:opened listener tries to fetch.

Are you entering values manually on that sheet? It's unclear to me from the above statement what specifically you're actually doing there.


Btw, I'm a big proponent of never using the Attributes list on that tab if you're using a character sheet. (At least, never edit attribute values that also exist in the character sheet.)

In the past there were issues with changing a value there that also existed in the character sheet - they could easily become disconencted, and effectively become two completely separate attributes. Is something like that happening here?

June 22 (3 years ago)
Rich R.
Marketplace Creator
Sheet Author
Compendium Curator

Oh, no, I'm not manually entering there...in the case where I found it, those two values (and others) are set on the character by its own sheet workers when the GM creates it. I'm putting it here in a much more generalized context though, because it appears to be happening no matter how the values got there initially.

GiGs said:

What exactly is happening in this step?:

  • GM sets values on the sheet for the Attributes & Abilities that the sheet:opened listener tries to fetch.

Are you entering values manually on that sheet? It's unclear to me from the above statement what specifically you're actually doing there.


Btw, I'm a big proponent of never using the Attributes list on that tab if you're using a character sheet. (At least, never edit attribute values that also exist in the character sheet.)

In the past there were issues with changing a value there that also existed in the character sheet - they could easily become disconencted, and effectively become two completely separate attributes. Is something like that happening here?




June 22 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter

In that case, it's an interesting bug you've found. Your guess about it being an async issue makes sense to me, too.

Does the issue apply for sheets using legacy code as well as CSE?

June 22 (3 years ago)
Rich R.
Marketplace Creator
Sheet Author
Compendium Curator


GiGs said:

In that case, it's an interesting bug you've found. Your guess about it being an async issue makes sense to me, too.

Does the issue apply for sheets using legacy code as well as CSE?


I haven't done enough troubleshooting to know for sure. I might make a quick few example sheets to demo this; I'll post if/when I have those to share