Don't worry about being a pain. Learning this stuff is painful! We have all been there, and are here to help. Your function has a few problems. you have dmgoutputmiss being set as dmgoutput/2 but before dmgoutput is defined, and then dmgoutput is a string, so dmgoutput/2 doesnt work. Both of those will likely cause your script to crash. I would combine the sendChats and build it more like this: function MelfAcidArrow(spellLevel, tokenName){ var start = `&{template:default} {{name=Melf's Acid Arrow}}`; var attack = `{{Attack=[[1d20+@{${tokenName}|spell_attack_bonus} ]]}}`; var hit = `{{Hit=[[(4+(${spellLevel}-2)/2)d4]] Acid Damage}}`; var miss = `{{Miss=[[(4+(${spellLevel}-2)/4)d4]] Acid Damage}}`; var nextturn = `{{Next Turn=[[(4+(${spellLevel}-2)/2)d4]] Acid Damage (if Hit)}}`; var outputMessage = `/w GM ${start} ${attack} ${hit} ${miss} ${nextturn}`; sendChat("API",outputMessage); } I had to guess at the damage because I think there's an error in your code. Yours says [[(2+(${spellLevel}-2))d4]] But that looks like two many brackets, making me think there should be a divisor in there, probably 2.