
Okay! So I have been working on this for 2 days and I actually have my first working bit of code! No matter what number you put in to modify the number of dice in your pool, you get the minimum of 0, a value from 1 to 5, or the maximum of 6! This may not be much in the grand scheme of things, but damn did I have to fight for it! I'm open to constructive criticism, I want to get better at this. I'm specifically looking for ways I could save the values in token health bars or GM notes. That or to find a way to make the code more concise. var dicePool = 0; function addDice(diceMod){ ++dicePool; changeResolve(--diceMod); } function removeDice(diceMod){ --dicePool; changeResolve(++diceMod); } function changeResolve(diceMod){ if (diceMod == 0){ if (dicePool <= 0){ dicePool -= dicePool; sendChat("Resolve","Your Resolve Pool is empty."); } else if (dicePool >= 6){ dicePool -= dicePool; dicePool += 6; sendChat("Resolve","You feel full of Resolve!"); } else { sendChat("Resolve","You have " + dicePool + " Resolve."); } } else if (diceMod > 0) { addDice(diceMod); } else if (diceMod < 0) { removeDice(diceMod); } } on("chat:message",function(msg){ if(msg.type == "api" && msg.content.indexOf("!resolve") == 0){ var args = msg.content.split(/\s+/); var diceMod = args[1] changeResolve(diceMod); } });