Hello everyone, I've been trying to replicate something using the Wiki, but I'm stuck because JavaScript is still new to me, and many things in Roll20 don't work the same way as they would elsewhere. I'm attempting to create a select menu to assign a +1 to an attribute... Specifically, I'm trying to implement "Euphoria" (mod +1 to selected attribute). <select name='attr_selecteuphoria'> <option value='str'>STR</option> <option value='con'>CON</option> <option value='wis'>WIS</option> <option value='mag'>MAG</option> <option value='dex'>DEX</option> <option value='int'>INT</option> <option value='cha'>CHA</option> </select> and: <input name="attr_str_euphoria" type="hidden" value="0"> <input name="attr_dex_euphoria" type="hidden" value="0"> <input name="attr_con_euphoria" type="hidden" value="0"> <input name="attr_wis_euphoria" type="hidden" value="0"> <input name="attr_int_euphoria" type="hidden" value="0"> <input name="attr_cha_euphoria" type="hidden" value="0"> My Javascript looks something like this: on ( "change:selecteuphoria" , () => {
getAttrs ([ "selecteuphoria" ], values => {
const selectedStat = values. selecteuphoria ;
let stat_mod = 0 ;
if (selectedStat === "str" || selectedStat === "con" || selectedStat === "wis" || selectedStat === "mag" || selectedStat === "dex" || selectedStat === "int" || selectedStat === "cha" ) {
stat_mod = "1" ;
}
setAttrs ({
[ `attr_ ${selectedStat} _mod_euphoria` ]: stat_mod
});
log ( `Mod for ${selectedStat} set to: ${stat_mod} .` );
});
}); I tried to rewrite it from the wiki-one... But nothing happens. What's wrong? Are there any sources to learn R20-specific JS? Second question: Actually, our roll-buttons look like this: The roll button: <button type='roll' name="attr_rollWisdom" value='@{isgmroll} &{template:d20skillroll} {{rollheader=Wisdom}} {{whoroll=@{spokename}}} {{skillname=Wisdom}} {{rollresult=[[1d20 + @{LevelWisdom} [Base] + @{CalActWisdom} [Calculated Modifiers] + ?{Modifiers?|0} [dyn. Modifiers] ]]}}'> Wisdom</button> calculations: <input type='number' name='attr_CalActWisdom' value='@{wis_euphoria} + @{addJealous} + @{addHurt} + @{addInjury}' disabled /> Are there any options or possibilities to dynamically add or hide the options from my first question? In future, these calculations could be very long... And every roll gets lots of "0" in the mouseover-result-thing. Any suggestions or best practices are appreciated :) Thanks for help! :)