This is the code. I'm trying to get rollsoakdot to count as a variable for the math after the dice roll, but it didn't work with your suggestion. on("clicked:turn", function() {
getAttrs(["dot1","dot2","dot3","stamtax","offbal","heart","stammax","paraltier","paral","speedmax","stamtaxmod","stamtaxinstantmod","bulkcheck","hearttemp","soakenviroreroll","soakenvirototal","driskdr","drisk","absorption","damredbuffdot"], function(values) {
let dot1 = parseInt(values.dot1)||0;
let dot2 = parseInt(values.dot2)||0;
let dot3 = parseInt(values.dot3)||0;
let speedmax = parseInt(values.speedmax)||0;
let stamtax = parseInt(values.stamtax)||0;
let offbal = parseInt(values.offbal)||0;
let stammax = parseInt(values.stammax)||0;
let heart = parseInt(values.heart)||0;
let hearttemp = parseInt(values.hearttemp)||0;
let paraltier = parseInt(values.paraltier)||0;
let soakenvirototal = parseInt(values.soakenvirototal)||0;
let soakenviroreroll = parseInt(values.soakenviroreroll)||0;
let driskdr = parseInt(values.driskdr)||0;
let drisk = parseInt(values.drisk)||0;
let absorption = parseInt(values.absorptionarb)||0;
let damredbuffdot = parseInt(values.damredbuffdot)||0;
if ((dot1 == "0") & (dot2 == "0") & (dot3 == "0")) {
let paraldebuff = (paraltier >= 1) ? 1 : 0;
let offbalfinal = (offbal != 0) ? offbal - 1 : 0;
let stammath = stammax - offbal - paraldebuff;
let stamfinal = (stammath < 0) ? 0 : stammath;
setAttrs({
"offbal": offbalfinal
});
setAttrs({
"stam": stamfinal
});
setAttrs({
"speed": speedmax
});
}
if ((dot1 >= "1") && (soakenvirototal >= "1")) {
if (soakenviroreroll >= "0") {
let rollString = "&{template:soakdot} {{name=SoakDot}} {{rollsoakdot=[[[[floor(@{soakenvirototal})]]d6s>@{setsuccesssoak}]]}}";
rollString += "{{rollsoakdotr1=[[@{soakenviroreroll}d6>5]]}}";
startRoll(rollString, results => {
const roll = results.results.rollsoakdot.result;
const reroll_calculated = results.results.rollsoakdotr1.result;
const rerollmin = (soakenvirototal - roll <= 0) ? 0 : soakenvirototal - roll;
const reroll = (rerollmin - reroll_calculated <= 0) ? rerollmin : reroll_calculated;
const total = dot1 - roll - reroll;
const absconst = ((total <= 0) || (absorption <= 0)) ? 0 : 1;
const totalfinal = (total <= 0) ? 0 : total;
const absorbfinal = (absorption >= 1) ? absorption : 1;
const totalabs1 = Math.floor(totalfinal / absorbfinal) + absconst;
finishRoll(results.rollId, {
rollsoakdot: totalabs1
let rollsoakdot1 = parseInt(rollsoakdot)||0;
});
});
}
}
let totalabs1 = rollsoakdot1;
let dotdr1 = ((dot1 - damredbuffdot) >= 1) ? damredbuffdot : 0;
let dotdr2 = ((dot2 - damredbuffdot) >= 1) ? damredbuffdot : 0;
let dotdr3 = ((dot3 - damredbuffdot) >= 1) ? damredbuffdot : 0;
let dotdr = dotdr1 + dotdr2 + dotdr3;
let paraldebuff = (paraltier >= 1) ? 1 : 0;
let offbalfinal = (offbal != 0) ? offbal - 1 : 0;
let dot1final = (dot1 != 0) ? dot1 - 1 : 0;
let dot2final = (dot2 != 0) ? dot2 - 1 : 0;
let dot3final = (dot3 != 0) ? dot3 - 1 : 0;
let heartmath = heart - totalabs1 - dot2 - dot3 + dotdr;
let heartmath2 = heart + hearttemp - totalabs1 - dot2 - dot3 + dotdr;
let heartfinal = (heartmath < 0) ? 0 : heartmath;
let stammath = stammax - offbal - paraldebuff;
let stamfinal = (stammath < 0) ? 0 : stammath;
setAttrs({
"offbal": offbalfinal
});
setAttrs({
"dot1": dot1final
});
setAttrs({
"dot2": dot2final
});
setAttrs({
"dot3": dot3final
});
if(hearttemp > "0") {
let heartfinal = (heartmath2 < 0) ? 0 : heartmath2;
if((hearttemp - totalabs1 - dot2 - dot3) <= 0) {
setAttrs({
"hearttemp": 0
});
setAttrs({
"heart": heartfinal
});
} else {
setAttrs({
"hearttemp": hearttemp - totalabs1 - dot2 - dot3
});
}
}
else {
let heartfinal = (heartmath < 0) ? 0 : heartmath;
setAttrs({
"heart": heartfinal
});
}
setAttrs({
"stam": stamfinal
});
setAttrs({
"speed": speedmax
});
});
});