
Is there a script that will allow me to change which option is selected on a character sheet's dropdown by macro? Thanks in advance!
Is there a script that will allow me to change which option is selected on a character sheet's dropdown by macro? Thanks in advance!
Probably ChatSetAttr can write whatever value you want in there, but would require testing with whatever specific sheet and field you are interested in working with.
Thanks for the reply.
I played around with ChatSetAttr, but unless I'm missing something it does not have any effect on an attribute that's set up in the sheet as a dropdown menu; only those set up as text or number fields.
Let me clarify what I'm asking. Let's say you have a dropdown menu in the character sheet labelled 'Proficient?', with options 'Yes' or 'No'. The default is set to 'No'. If you adjust it, it changes some attribute on which other rolls rely.
Using chatsetattr, I can adjust that attribute to whatever it should be if 'Yes' was selected, but on the character sheet it will still look like 'No' is selected.
It sounds like that dropdown triggers a sheet worker that changes some other things, which gives you options:
The second part should just work, but in my experience it doesn't always.
I'm using Axel Mellgren's sheet for WFRP 2e. It has a lot of dropdown selects. Here's an example; selecting if you're trained in the Charm skill.
<select class="sheet-select-no-arrow-center" name="attr_Skill_Charm">
<option value="floor((@{Fellowship})/2)" selected="selected">—</option>
<option value="@{Fellowship}" data-i18n="TRAINED">Trained</option>
<option value="@{Fellowship}+10">+10%</option>
<option value="@{Fellowship}+20">+20%</option>
</select>
It's easy enough to modify the value of the attribute, but I don't see how to change what the dropdown displays.
Ah thats tricky. The option value is what you need to set, and you need to set the exact text an item has: "@{Fellowship}" or "floor((@{Fellowship})/2)", etc.
Don't set the score, set that exact text.
I had tried that to no avail, but I think I have figured out the problem, if not the solution. It's the @. Chatsetattr does not input that into the value but acts as if I'm using it to reference something else.
It probably isnt chatsetAtrrs doing that, but roll20 standard parsing, which always tries to convert attribute calls to their values.
You can try entering the html entity @ instead of @, like
@{Fellowship}
Chatsetattr might itself have syntax for handling this, but i can't remember.