AddCustomTurn shouldn't have an issue with the update as custom turns have no token and thus no page associated with them. Add Invisible Custom Turn needed a fix, I updated the script at the link you pasted a few weeks ago (and made a slightly more efficient change just now). Are you using that version? Here's a fixed version of Sky's script (untested): // VERSION INFO
var SimpleInitiative_Author = "Sky";
var SimpleInitiative_Version = "1.4.0";
var SimpleInitiative_LastUpdated = 1530594275;
// VARIABLE DECLARATIONS
var SHOW_GREEN_DOT = true;
var ANNOUNCE_NEW_TURN = true;
var PC_COLOR = "#073763";
var NPC_COLOR = "#440000";
var PLAYER_COLOR = true;
var HIDE_NPC_NAMES = false;
var PULL_GM_TO_TOKEN = true;
// FUNCTION DECLARATIONS
var HandleTurnOrderChange = HandleTurnOrderChange || {};
var AnnounceNewTurn = AnnounceNewTurn || {};
var getBrightness = getBrightness || {};
var getHex2Dec = getHex2Dec || {};
// HANDLERS
on("ready", function () {
log("-=> SimpleInitiative v" + SimpleInitiative_Version + " <=- [" + (new Date(SimpleInitiative_LastUpdated * 1000)) + "]");
//log (Date.now().toString().substr(0, 10));
});
on("change:campaign:turnorder", function (obj, prev) {
HandleTurnOrderChange(obj, prev, HIDE_NPC_NAMES, PULL_GM_TO_TOKEN);
});
on("chat:message", function(msg) {
if (msg.type !== "api") return;
if (msg.content.split(" ")[0] == "!eot") {
if (!Campaign().get("turnorder")) return;
var turn_order = JSON.parse(Campaign().get("turnorder"));
if (!turn_order.length) return;
if (turn_order.length == 1) return;
var current = turn_order.shift();
var next = turn_order.shift();
if (next.formula == "+1") next.pr = next.pr + 1;
turn_order.unshift(next);
if (!playerIsGM(msg.playerid)) {
if (getObj("graphic", current.id).get("represents") != "") {
if (!getObj("character", getObj("graphic", current.id).get("represents")).get("controlledby").includes(msg.playerid)) return;
}
}
turn_order.push({id: current.id, pr: current.pr, _pageid: current.get('pageid'), custom: current.custom, formula: current.formula});
Campaign().set("turnorder", JSON.stringify(turn_order));
if (current.id != -1 && SHOW_GREEN_DOT) getObj("graphic", current.id).set("status_green", false);
if (next.id != -1 && SHOW_GREEN_DOT) getObj("graphic", next.id).set("status_green", true);
if (ANNOUNCE_NEW_TURN) AnnounceNewTurn([next], [current], HIDE_NPC_NAMES, PULL_GM_TO_TOKEN);
}
if (msg.content.split(" ")[0] == "!roll-init" && playerIsGM(msg.playerid)) {
if (!msg.selected) return;
var turn_order = (!Campaign().get("turnorder")) ? [] : JSON.parse(Campaign().get("turnorder"));
var token, mod, index;
_.each(msg.selected, function (a) {
token = getObj("graphic", a._id);
if (token.get("name") == "Round") {
turn_order.push({id: a._id, pr: 999, _pageid: token.get('pageid'), formula: "+1"});
} else {
mod = (token.get("represents") != "") ? parseInt(Math.floor((getAttrByName(token.get("represents"), "dexterity") - 10) / 2)) + parseInt(getAttrByName(token.get("represents"), "initmod")) + parseInt(getAttrByName(token.get("represents"), "jack_of_all_trades")) : 0;
index = turn_order.findIndex(x => x.id == a._id);
if (index != -1) turn_order[index].pr = Math.floor((Math.random() * 20) + 1) + mod;
else turn_order.push({id: a._id, _pageid: token.get('pageid'), pr: Math.floor((Math.random() * 20) + 1) + mod});
}
});
Campaign().set("initiativepage", true);
Campaign().set("turnorder", JSON.stringify(turn_order));
}
if (msg.content.split(" ")[0] == "!sort-init" && playerIsGM(msg.playerid)) {
if (!Campaign().get("turnorder")) return;
var turn_order = JSON.parse(Campaign().get("turnorder"));
if (!turn_order.length) return;
var method = (msg.content.split(" ")[1] !== undefined && msg.content.split(" ")[1].toLowerCase().indexOf("a") === 0) ? "ascending" : "descending";
var current = turn_order[0];
var sorted_turn_order = (method == "descending") ? _.sortBy(turn_order, "pr").reverse() : _.sortBy(turn_order, "pr");
var next = sorted_turn_order.shift();
if (next.pr == 999) next.pr = 1;
sorted_turn_order.unshift(next);
Campaign().set("turnorder", JSON.stringify(sorted_turn_order));
if (current.id != -1 && SHOW_GREEN_DOT) getObj("graphic", current.id).set("status_green", false);
if (next.id != -1 && SHOW_GREEN_DOT) getObj("graphic", next.id).set("status_green", true);
if (ANNOUNCE_NEW_TURN) AnnounceNewTurn([next], [current], HIDE_NPC_NAMES, PULL_GM_TO_TOKEN);
}
if (msg.content.split(" ")[0] == "!clear-init" && playerIsGM(msg.playerid)) {
var turn_order = JSON.parse(Campaign().get("turnorder"));
if (!turn_order.length) return;
var current = turn_order.shift();
if (current.id != -1) getObj("graphic", current.id).set("status_green", false);
Campaign().set("turnorder", "[]");
Campaign().set("initiativepage", false);
}
});
// FUNCTIONS
var HandleTurnOrderChange = function(obj, prev, HIDE_NPC_NAMES, PULL_GM_TO_TOKEN) {
var current = JSON.parse(obj.get("turnorder") || []);
var previous = JSON.parse(prev["turnorder"]) || [];
if (obj.get("turnorder") && !obj.get("initiativepage")) Campaign().set("initiativepage", true);
if (current.length == 0 && previous[0].id != -1 && SHOW_GREEN_DOT) getObj("graphic", previous[0].id).set("status_green", false);
if (previous.length > 0 && previous[0].id != -1 && SHOW_GREEN_DOT) getObj("graphic", previous[0].id).set("status_green", false);
if (current.length > 0 && current[0].id != -1 && SHOW_GREEN_DOT) getObj("graphic", current[0].id).set("status_green", true);
if (ANNOUNCE_NEW_TURN) AnnounceNewTurn(current, previous, HIDE_NPC_NAMES, PULL_GM_TO_TOKEN);
}
AnnounceNewTurn = function (current, next, HIDE_NPC_NAMES, PULL_GM_TO_TOKEN) {
if (_.isEmpty(next) || _.isEmpty(current) || current[0].id == next[0].id) return;
if (current[0].id != -1 && getObj("graphic", current[0].id).get("layer") != "gmlayer") {
var Token = getObj("graphic", current[0].id);
var AlertTokenName = Token.get("name");
var Character = (Token.get("represents") != "") ? getObj("character", Token.get("represents")) : "";
var AlertColor = NPC_COLOR;
if (Character != "" && getAttrByName(Character.id, "npc") != undefined && getAttrByName(Character.id, "npc") != 1) {
AlertColor = PC_COLOR;
AlertTokenName = (AlertTokenName == "") ? "PC" : AlertTokenName;
if (PLAYER_COLOR && Character.get("controlledby") != "") AlertColor = getObj("player", Character.get("controlledby").split(",")[0]).get("color");
} else {
AlertTokenName = (HIDE_NPC_NAMES == true) ? "NPC" : (Token.get("name") == "") ? "NPC" : Token.get("name");
}
if (AlertTokenName == "Round") AlertTokenName = AlertTokenName + " " + current[0].pr;
var AlertTextColor = (getBrightness(AlertColor) < (255 / 2)) ? "#FFF" : "#000";
var AlertShadowColor = (AlertTextColor == "#000") ? "#FFF" : "#000";
var AlertOuterStyle = "max-height: 40px; width: 100%; margin: 10px 0px 5px -7px; line-height: 40px;";
var AlertInnerStyle = "max-height: 20px; width: 100%; margin: 0px; padding: 0px 0px 2px 0px; clear: both; overflow: hidden; font-family: Candal; font-weight: lighter; font-size: 13px; line-height: 20px; color: " + AlertTextColor + "; background-color: " + AlertColor + "; background-image: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, 0)); border: 1px solid #000; border-radius: 4px; text-shadow: -1px -1px 0 " + AlertShadowColor + ", 1px -1px 0 " + AlertShadowColor + ", -1px 1px 0 " + AlertShadowColor + ", 1px 1px 0 " + AlertShadowColor + ";";
var AlertImageStyle = "height: 40px; width: 40px; float: right; margin: -32px 5px 0px 0px;";
sendChat("", "/desc <div style='" + AlertOuterStyle + "'><div style='" + AlertInnerStyle + "'>" + AlertTokenName + "</div><img src='" + Token.get("imgsrc") + "' style='" + AlertImageStyle + "'></img></div>");
sendPing(-100, -100, Campaign().get("playerpageid"), null, false);
sendPing(Token.get("left"), Token.get("top"), Campaign().get("playerpageid"), null, PULL_GM_TO_TOKEN);
toFront(Token);
}
};
function getBrightness(hex) {
hex = hex.replace('#', '');
var c_r = getHex2Dec(hex.substr(0, 2));
var c_g = getHex2Dec(hex.substr(2, 2));
var c_b = getHex2Dec(hex.substr(4, 2));
return ((c_r * 299) + (c_g * 587) + (c_b * 114)) / 1000;
};
function getHex2Dec(hex_string) {
hex_string = (hex_string + '').replace(/[^a-f0-9]/gi, '');
return parseInt(hex_string, 16);
};