
Hello all, Awhile back I was looking for a simple player-side command to end their character's turn and found this bit of code . It worked perfectly, did exactly what I needed it to do, but it seems it was broken by the recent turn tracker update. The intended behavior is that, after a player ends their turn, it's supposed to push their token to the back of the initiative order. Now, after the update, it instead removes the token from the turn tracker entirely, so in the last game I ran I had to manually select and re-add all participants in the combat at the end of every round. Not insurmountable, but less than ideal. The code is below; is there an easy fix here to allow me to go back to the intended behavior? on("chat:message", function(msg) {
if (msg.type == "api" && msg.content.indexOf("!eot") !== -1) {
var c = Campaign();
var pre_turnorder = c.get('turnorder');
if (!pre_turnorder) { return; }
var turn_order = JSON.parse(c.get('turnorder'));
if (!turn_order.length) { return; };
var turn = turn_order.shift();
var stop = 0; // Since I will be checking the player inside of another function return; wont work.
var obj = findObjs({ _id:turn.id });
_.each(obj, function(obj) {
});
if (stop == 1) { return; };
turn_order.push({
id: turn.id,
pr: turn.pr,
custom: "Turn Counter"
});
Campaign().set("turnorder", JSON.stringify(turn_order));
turn_order = JSON.parse(c.get('turnorder'));
turn = turn_order.shift();
sendChat(msg.who, "/em has ended their turn!");
var obj = findObjs({ _id:turn.id });
_.each(obj, function(obj) {
if (obj.get("name") != "") {
sendChat(" ", "/em " + obj.get("name") + " it is your turn!")
};
if (obj.get("name") == "") {
sendChat("(Game)", "Enemys Turn!")
};
});
}
}); Very much appreciate any help and insight; thank you!