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

Some attributes look blank but aren't

1632855488

Edited 1632855590
I'm tinkering with macros, attributes, and abilities, and I'm trying to understand some confusing behavior. I'm using the Roll 20 5e character sheets. If I look at an NPC, say, "Bat", I find an empty attribute: But if I check the value of that attribute, it has somehow computed it from other fields. If I type @{Bat|npc_str_save} in chat, it gives a value of "-4." What is happening here? (I think it might have to do with something going on behind the scenes with the character sheet, but I thought the character sheet populated the attributes with values, which wouldn't explain the discrepancy I'm seeing.) 
1632859291
GiGs
Pro
Sheet Author
API Scripter
Are you looking at the attributes list on the Attributes & Abilities tab? Be aware that many character sheet attributes dont show up properly there, and if you have a character sheet active, you should not mess with any attributes that come from the character sheet. You should only use that list for creating your own attributes that are completely separate from the character sheet, and deal with the fact it is horribly cluttered. Now, to your question: the character sheet can compute attribute values from other attributes, using code that is hidden from the user of the sheet. I'm not following what you mean when you sau, "if you check the value of that attribute". Are you saying the correct value is available in macros, but isnt showing on the character sheet? (Remember that the attributes & abilities tab should be ignored when trying to ascertain whether attribute values are correct.)
I'm not sure why, but you are correct that the value is coming from a different attribute, specifically from the 'strength_mod' attribute.  I've noticed some changes on the D&D 5E by Roll20 sheet recently, so I'm pretty sure this is all a part of those changes to the sheetworkers and how some rolls are being processed and calculated.  I think that some attributes are slowly being deprecated and removed, and this is all just in preparation for that to happen.
GiGs said: Are you looking at the attributes list on the Attributes & Abilities tab? Be aware that many character sheet attributes dont show up properly there, and if you have a character sheet active, you should not mess with any attributes that come from the character sheet. You should only use that list for creating your own attributes that are completely separate from the character sheet, and deal with the fact it is horribly cluttered. Now, to your question: the character sheet can compute attribute values from other attributes, using code that is hidden from the user of the sheet. I'm not following what you mean when you sau, "if you check the value of that attribute". Are you saying the correct value is available in macros, but isnt showing on the character sheet? (Remember that the attributes & abilities tab should be ignored when trying to ascertain whether attribute values are correct.) Yes, the screen capture was from the Attributes & Abilities tab, where the value is empty, and the correct value is available if I use a macro. It has not caused me any problems explicitly---I'm just trying to understand. I think I have a misunderstanding about how the Character Sheet interacts with the A&A tab. I thought that the sheet would automatically populate the attributes values (and understand that I shouldn't edit them directly), but I didn't think that the attribute values would look  empty on that tab but have some hidden value ready to be calculated. This behavior makes trying to write macros feel much stranger and less predictable to me.
Jarren said: I'm not sure why, but you are correct that the value is coming from a different attribute, specifically from the 'strength_mod' attribute.  I've noticed some changes on the D&D 5E by Roll20 sheet recently, so I'm pretty sure this is all a part of those changes to the sheetworkers and how some rolls are being processed and calculated.  I think that some attributes are slowly being deprecated and removed, and this is all just in preparation for that to happen. Or is it coming from the 'strength_save_bonus' attribute? *shrug* If things are being changed and deprecated, that makes me feel a little better about why there are quite so many apparently redundant attributes.
1632863334

Edited 1632863348
GiGs, here's what I think I'm asking. Where can I go see what generates @{npc_str_save} when I use it? Where can I see what %{selected|npc_str_save} does? (Maybe this requires a pro subscription...)
1632867575
GiGs
Pro
Sheet Author
API Scripter
Kevin H. said: GiGs, here's what I think I'm asking. Where can I go see what generates @{npc_str_save} when I use it? Where can I see what %{selected|npc_str_save} does? (Maybe this requires a pro subscription...) For this, you'd need to look at the sheet code. For most sheets that would mean going to roll20's github repository, but the official D&D By Roll20 sheet isnt on there. There's no way to look at it directly. If you know what you are doing, you could use a browser's inspector tools to analyse a sheet, but I don't know if there's a way to get complete html + script code from it. I think for this sheet, and other By roll20 sheets, we can only find this kind of information by the kind of experimentation you and others in this thread are doing. A pro subscription would allow you to use api scripts which allow you to inspect a sheet in more detail, but I honestly don't know how to get the information you want using it. Aaron, Scott or Tim might.
1632873793
The Aaron
Roll20 Production Team
API Scripter
Without looking into it at all, I'm guessing the value used to be stored in that attribute, but is now being calculated on the fly with some of the new tech for sheet workers.  If that's the case, the API wouldn't be able to see it at all.  That said, I defer to Scott regarding what's going on as I haven't worked on a character sheet since ~2014. =D
1632875090

Edited 1632877889
Oosh
Sheet Author
API Scripter
What's happening here, is the sheet is using the Default Attribute as the current Attribute value is undefined. An adult black dragon, for example, has nothing in its npc_str_save current value. This is true both on the A&A tab, and in the data Object from firebase: When you try to grab an Attribute from the character sheet and it doesn't exist/is undefined, it will have a look at the Default Attributes defined by the sheet. Here's a snippet of the many defaults defined by the 5e sheet: As you can see, @{npc_str_save} is a passthrough to the strength_mod - essentially, if the save/skill has not been specified in the monster design, it defaults to using the same rules a player would - add your relevant mod to the skill. The Default Attributes are not stored on a character sheet instance (like the Black Dragon's character sheet in this case), as the defaults are system-wide, it would be a waste of database. So they're not generally visible to a player or GM, and the internal parsing makes the process pretty much invisible as you get the parsed value of @{strength_mod} coming out the other end. You need to use the API or browser console to get an unparsed value. You can stop the default process (if for some reason you want to) by putting a value into npc_str_save . Go to the A&A tab, and put a single space in there. The whitespace will mean the attribute value is no longer undefined, and the Default Attribute will not be fetched. tldr version:  SHEET MAGIC! The Aaron said:  I haven't worked on a character sheet since ~2014. =D They had computers back then???
1632876460
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
They were made with stone knives and bear skins.
Thanks, all, for the help. In particular, Oosh, thank you for the peek at the dark arts of sheet magic.
Kevin H. said: I'm tinkering with macros, attributes, and abilities, and I'm trying to understand some confusing behavior. I'm using the Roll 20 5e character sheets. If I look at an NPC, say, "Bat", I find an empty attribute: But if I check the value of that attribute, it has somehow computed it from other fields. If I type @{Bat|npc_str_save} in chat, it gives a value of "-4." What is happening here? (I think it might have to do with something going on behind the scenes with the character sheet, but I thought the character sheet populated the attributes with values, which wouldn't explain the discrepancy I'm seeing.)  NPC sheets only show a proficiency in a save when they have proficiency in it.  So a proficiency button only needs to add a modifier to an existing attribute which is just the strength_mod or npc_str or something.  So instead of having to go in and retroactively adjust a bajillion fields everytime wizards decides to errata the monster manual, the npc sheets all amend off each other like that.  So because bats have no str save proficiency, its nil or empty, then when a sheet calls a strength save it will try to add strength mod+save+globals+jack and show the result.  
1632926441
timmaugh
Pro
API Scripter
The Aaron said: Without looking into it at all, I'm guessing the value used to be stored in that attribute, but is now being calculated on the fly with some of the new tech for sheet workers.  If that's the case, the API wouldn't be able to see it at all.  That said, I defer to Scott regarding what's going on as I haven't worked on a character sheet since ~2014. =D That makes me interested to see what XRay would show for that attribute... I'll have to test and report back.
1632926856

Edited 1632926886
timmaugh
Pro
API Scripter
So, for my 5E sheet, I don't even see that attribute listed on the Attributes & Abilities page. However, I do get a report of "4" when I run @{selected|npc_str_save} from chat. When I XRay that character, the attribute doesn't show in the report, which confirms it is being dynamically created, and isn't really available to the API: Not sure why you're seeing it on the A&A page of the character sheet.
1632963866

Edited 1632964057
Oosh
Sheet Author
API Scripter
Tim, is XRay excluding undefined .current values? What does this turn up from the browser console, replacing regexName with whatever regex string will find your character? Campaign.characters.models.find(c=>c.attributes.name.match(/regexName/i)).attribs.models.filter(a=>a.attributes.name.match(/npc_str_save/i))
1632965953
timmaugh
Pro
API Scripter
That doesn't return anything. I altered it to make sure what I should see when I knew I should be getting a return (looking for the "hp" attribute on a player character), but the check of the npc_str_save on an NPC didn't return anything:
1632966268
timmaugh
Pro
API Scripter
Here is how XRay gets the non-repeating attributes (and abilities -- out of the same function -- but that doesn't matter for this discussion):         v = ['m', 'max'].includes(v) ? 'max' : 'current';   // catch all attributes... and...         v = s === 'ability' ? 'action' : v;                 // correct for abilities (if necessary)         let sheetObjs = findObjs({ type: s, characterid: character.id });         if (s === 'attribute') sheetObjs = sheetObjs.filter(a => !a.get('name').startsWith('repeating'));