Kraynic in your sheet worker, at the top you set mep and mei as constants with both the same value. You could just set a me value with that score, and use it instead of either of those, like so: on("change:me sheet:opened", function () { getAttrs(['me'], function (values) { const me = parseInt(values['me'])||0; let me_psionic = 0; if (me > 30) me_psionic = 8; else if (me > 15) me_psionic = Math.round((me -15)*.5); let me_insanity = 0; if (me > 30) me_insanity = 13; else if (me > 20) me_insanity = Math.round(me -17); else if (me > 15) me_insanity = Math.round((me-15)*.5); setAttrs({ me_psionic: me_psionic, me_insanity: me_insanity }); }); }); If you;re interested in how to streamline things further with the ternary operator I know you've seen me mention many times, I'll do that, but first, lets handle the first if statement in a different way. You have this: if (me > 30) me_psionic = 8; else if (me > 15) me_psionic = Math.round((me -15)*.5); The max value can also be set this way: me_psionic = Math.min(8, Math.round((me -15)*.5)); Math.min is just like the roll20 keep-lowest or drop-highest operators. So if the calculated value is above 8, it gets set as 8. There's also Math.max, which returns the highest value, you you could use that to get rid of any values below 0. Like this: const me_psionic = Math.max(0, Math.min(8, Math.round((me -15) * 0.5)); There, the whole calculation is handled without an if statement. But I said we'd be using ternary operators. Your second calculation is a touch more complex. So we do this: const me_insanity = (me > 20) ? Math.min(13, Math.round(me -17)) : Math.max(0, Math.round((me-15)*.5)); Notice we are using the same technique, but split into two sections. If me > 20, we use the larger calculation: Math . min ( 13 , Math . round ( me - 17 )) which is basically doing, in roll20 terms: { @{me}-17, 13}dh1 The else section (if me not >20), handles the 0 part: Math . max ( 0 , Math . round (( me - 15 )* .5 )) which in roll20 terms is { round((@{me}-15)/2), 0}kh1 Putting all that together, we get: on("change:me sheet:opened", function () { getAttrs(['me'], function (values) { const me = parseInt(values['me'])||0; const me_psionic = Math.max(0, Math.min(8, Math.round((me -15) * 0.5)); const me_insanity = (me > 20) ? Math.min(13, Math.round(me -17)) : Math.max(0, Math.round((me-15)*.5)); setAttrs({ me_psionic: me_psionic, me_insanity: me_insanity }); }); });