
I get the error in the title when I run the script, but I'm not sure what's returning the error, since it's occuring in the updateStatusMarker protocol and thus obscured from view. Here is my code, if that helps:
on('chat:message', function(msg) { if (msg.type != 'api') return; var parts = msg.content.split(' '); var command = parts.shift().substring(1); if (command == 'staff') { if (parts.length < 2) { sendChat('SYSTEM', 'You must provide a selected token id and a target token id.'); return; } var selectedId = parts[0]; var targetId = parts[1]; var selectedToken = getObj('graphic', selectedId); var targetToken = getObj('graphic', targetId); if (!selectedToken) { sendChat('SYSTEM', 'Selected token id not provided.'); return; } if (!targetToken) { sendChat('SYSTEM', 'Target token id not provided.'); return; } var who = getObj('character', selectedToken.get('represents')); if (!who) { who = selectedToken.get('name'); } else { who = 'character|' + who.id; } var staffer = getObj('character', selectedToken.get('represents')); var target = getObj('character', targetToken.get('represents')); //...objects and stats; I don't think any of these are causing the error and seem to be perfectly fine //They're referenced elsewhere in the code, though, so I wouldn't recommend running it anywhere //example object const Silence = { name : "Silence", type : "status", target: [Magbd], effect : Number(MagB.get("current")) * -1, status: "status_interdiction", chatmsg: targetToken.get("name") + " cannot use magic for the next turn!" }; //list of objects const staveslist = [Heal,Mend,Physic,Recover,Fortify,Bloom_Festal,Sun_Festal,Wane_Festal,Moon_Festal,Great_Festal,Freeze,Enfeeble,Entrap,Rescue,Silence,Hexing_Rod]; //I'm pretty sure the error occurs somewhere here if (WTypeA != "Staves/Rods"){ chatstr += "\n Weapon is not a staff!" } else { for (var i in staveslist){ if (staveslist[i].name == WNameA){ j = staveslist[i]; //check for range if (((Range1A) <= (diff/70)) && ((diff/70) <= (Range2A))){ if (j.type == "healing"){ //Set with workers in respect to total caps HPVal = Number(CurrHPB.get("current")) + j.effect CurrHPB.setWithWorker({current: HPVal}) chatstr += "\n" + targetToken.get("name") + " is healed for " + String(j.effect) + " HP!" } if (j.type == "status"){ for (var a in j.target){ j.target[a].setWithWorker("current",j.effect) } target.set(j.status); chatstr += j.chatmsg } } else { chatstr += "\n Staff is not in range!" } } } } sendChat(who, chatstr);