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

Default character sheet values

I'm managing to get really confused about how this is working. I know attributes aren't set on a character until they're changed from the default, so I'm using getAttrByName() to read the default value for an attribute within my API script if it's not in the list of attributes for that character. However, it's not bringing back the correct default value. Except - it does in the character sheet sandbox. Some time ago (several weeks, and several commits since then) I pushed a patch for the Mongoose Traveller 2e character sheet to change the default characteristic for skills to be something more suitable for that skill rather than defaulting to "Strength" for everything. That's now live, and if I create a new character, the characteristics default correctly on the character sheet. However, if I call getAttrByName() from an API  script, the value that gets pulled back is always "Strength" still, even though on the character sheet it defaults to something else (such as "Intellect", or "Dexterity"). The strange thing is, if I run things in the character sheet sandbox, with either an older, or latest, version of the character sheet, then it behaves as expected - it returns the actual default value for that skill. So I'm not sure why it's returning the wrong thing in live, and I can't see why it's working in the sandbox. The applicable part of the character sheet is this: <select type="text" class="sheet-input" name="attr_skillCharacteristicDM-Survival" value="0" style="width:95px" />     <option value="@{mod-Strength}" data-i18n="skillstrengthoption-u">Strength</option>     <option value="@{mod-Dexterity}" data-i18n="skilldexterityoption-u">Dexterity</option>     <option value="@{mod-Endurance}" data-i18n="skillenduranceoption-u">Endurance</option>     <option value="@{mod-Intellect}" selected data-i18n="skillintellectoption-u">Intellect</option>     <option value="@{mod-Education}" data-i18n="skilleducationoption-u">Education</option>     <option value="@{mod-Social}" data-i18n="skillsocialoption-u">Social</option> </select> It seems wrong to me that the <select/> element is closed, but it was like that before I patched it (I'm not the original author), and it behaves okay in the sandbox. My change was to add a 'selected' attribute to the default option, and that change went live weeks ago. My API script command is: char = getAttrByName(characterId, "skillCharacteristicDM-"+skillName); And that always brings back "@{mod-Strength}" regardless of what the actual default value is. Unless it runs in the sandbox. That's probably not enough to figure out what the problem is, but I'm stuck about where to go from here. I've tried with completely new characters in case something was being cached on a character, the only thing I haven't tried is creating a new game. Any suggestions about what I could try next would be greatly appreciated. Thanks. Sam.
1616021842
GiGs
Pro
Sheet Author
API Scripter
Does it only work this way with characters created before you updated the sheet? For completely new characters, does it grab the new updated default?
It's not working for new characters. Most of my old characters have had the defaults changed manually (so it's actually working for them).
1619505376
vÍnce
Pro
Sheet Author
I think this was brought up 4 years ago... getAttrByName() is not behaving as documented when value is a dropdown list. Is displaying an error message when operating on a value in a repeating section.
That looks like it. I guess there's little chance of it being fixed after four years. A work around might be to put the default option first, but that means the attribute lists are out of order for the players, which is nasty.