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?] accessing _max fields and attributes by character_id

1728309918

Edited 1728314138
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
Hi, I am unsure if these are bugs or if there was some change in the codebase, but since I cannot find anything in the documentation, I am asking it here. 1. For some reason, maximum attributes always return 0. If I try to access a _max value using the format: @{character_name|attributename_max} I always get 0. However, the correct value is returned if I use getAttrs(`attributename_max`). This seems to affect both strings passed to startRoll and Chat.  UPDATE: Thanks to Vince and Scott. I leave it here if someone else ends up with the same issue. In the chat, you need to use the format: @{name|attributename|max} in the sheet workers you use: attributename_max  2. The attributes are only accessible by name, while the abilities are accessible by name and id. I am pretty sure it was possible to access attributes by name and id; I even found some old forum posts showing it. Is it a bug or a change I missed from the changelog? Even more important: if it's not a bug, does roll20 plan to remove the functionality for abilities? Most of the rolls in my sheet use character_ids to avoid continuously resetting them and to avoid any issues if two sheets have the same name. Removing this functionality could break completely the current sheet so I would love to know it to find a different way to deal with it.
1728310708
vÍnce
Pro
Sheet Author
Can you access with the format: @{character_name|attributename|max}?
1728313740
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
@vince yes, Scott already helped me with that thanks :) I don't understand why only abilities can be called by name, not attributes. I tried to follow the code for the rawChat, and I found that the code initially looks if a character or a keyword is mentioned using RegEx. If it fails to find a keyword or an existing name, it tries to catch the error d20.journal.customSheets.advanced || (we.content = we.content.replace(qe, ui => { ... } The rest is not particularly important. The two important things are: 1. d20.journal.customSheets.advances is undefined (and read as false by js), so the code will always go into the second function. Here `qe` is the regular expression for an ability, and UI substitutes the character_id for a name, and after that, the function looking for it is called again (interestingly, the function uses the name to retrieve the id) 2. After the first function, there are other dealing with other formats that are never called from the chat (since the advanced is not defined) d20.journal.customSheets.advanced && he !== "quickdice" ? we.content = yield(...) : we.content = we.content.replace(Ee, ui => {...}) here Ee is the regular expression for the attribute. So it seems that roll20 has the functionality to look for a character_id and use it, but it's only allowed for abilities. I remember this functionality was available for both attributes and abilities, and I even found a previous forum post highlighting it. Sadly, I'm unsure if roll20 removed it for some reason (maybe something related with Jumpgate or beacon) or if it's some bug. And if it's not a bug, I would like to know if it's something they plan to remove also for the abilities, cause I need to extensively rewrite most of my sheet otherwise, or learn beacon better to be able to port it asap