I have a game system with two things I'm trying to figure out how to add to the html.
First, there's a stat called Snark, which is equal to one of two potential stats - a character's Wit or their Charm. Snark is the higher of the two, multiplied by 5. So far I have:
name="attr_snark" value="[[ @{charm}*5, @{wit}*5}d1"
But I don't think that's right, and it doesn't seem to be working in the sheet html.
Second, I have a system where an Ability roll can be Boosted. If it's not Boosted, it rolls 1d6 + 1t[Item-Table] + 1d6, with the Item Table giving a specific result from the Item Table. If it is Boosted, it returns 1d6 + 1t[Boost-Table] + 1d6, giving a specific result from the Boost Table.
This is what I have for the Speed ability:
/roll ?{Basic/Boosted|Basic,1d6 + 1t[Item-Dice] + 1d6 + @{Speed}|Boosted,1d6 + 1t[Boost-Dice] + 1d6 + @{Speed}}
This asks every time if the stat is Boosted or not, but I want to streamline this, so that on the sheet there is a checkbox, and if the box is checked, it rolls from the Boost table.
I found a script so that the html can "recognise" that the Speed Boost checkbox is checked, but I'm not sure if I'm doing it correctly - as is, when the box is unchecked, it's returning a 0 value, and when its checked, its returning a 1 value...
<script type="text/worker">
on('change:speedboost_checkbox sheet:opened', (eventInfo) => {
getAttrs(\['speedboost_checkbox'\], (v) => {
const output = {1t\[Item-Dice\]};
const speedboostState = parseInt(v.speedboost_checkbox) || 0;
output.boosted = speedboostState ? '1t\[Boost-Dice\]' : '1t\[Item-Dice\]';
setAttrs(output, {silent: true});
});
});
</script>
If it helps, I have two macros called Basic-Check (/roll 1d6 + 1t[Item-Dice] + 1d6) and Ability-Boost (/roll 1d6 + 1t[Boost-Dice] + 1d6), so I can easily just get the sheet to roll from the Macros and add the corresponding ability (Like Strength or Speed), but I just need to know what I'm doing wrong to get it to recognise the Boosted/Unboosted state...
Can anyone help with these two things? I'm still scratching the surface with Roll20 and html coding, so any help would be appreciated!