Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Error line? SyntaxError: Unexpected token }

I am using TurnMarker.js TokenNameNumber.js StatusTracker.js IsGM.js Health Colour.js ItsATrap.js VecMath.js TokenCollisions.js PowerCards.js PersonalView.js New Script The newest script is PersonalView, listed below.... as posted recently....is there a coding error?  I can't see an extra } but I am not a coder... on("change:campaign:turnorder", function(current, previous) { var CharacterIDs = ["-JgkH8hme8IcXgSo8F9f", "-JgkGs07oHSprISJutLR", "-JgkGrQvhn0XNpK4Vubk", "-Ji_M_ygUiza_oZ3wUyF", "-JgkH-DQxm6bYGRb2jWH", "-JgkGm0ANzfNR3Wdfcrm", "-JgkH2ttgf_oNlBi-pgE"]; // eg var CharacterIDs = ["-KHWScTHo_oHinvteAqm", "-KGucJWiVEW9vZhF7_eM", "-KHWSkIxLWXyGIO5A4dJ"]; var CurrentTO = JSON.parse(current.get("turnorder")); var PreviousTO = JSON.parse(previous["turnorder"]); var Token; var Character; // Save F2F data... if (!state.f2f) state.f2f = {}; if (_.isEmpty(state.f2f)) { _.each(CharacterIDs, function(charid) { Character = getObj("character", charid); state.f2f[charid] = { CharacterID: charid, ControlledBy: Character.get("controlledby") } }); } // Process the turn order... if (CurrentTO.length > 0) { _.each(state.f2f, function(a) { getObj("character", a["CharacterID"]).set("controlledby", ""); }); if (CurrentTO[0].id != -1) Token = getObj("graphic", CurrentTO[0].id); if (CurrentTO[0].id != -1 && Token.get("represents") !== "") Character = getObj("character", Token.get("represents")); if (CurrentTO[0].id != -1 && Token.get("represents") !== "" && Character.id in state.f2f) { Character.set("controlledby", state.f2f[Character.id]["ControlledBy"]); } else { // Return control to all players during npc and custom item turns... _.each(state.f2f, function(b) { getObj("character", b["CharacterID"]).set("controlledby", b["ControlledBy"]); }); } } else { // Turn order tracker is empty. Return control to all players... _.each(state.f2f, function(z) { getObj("character", z["CharacterID"]).set("controlledby", z["ControlledBy"]); }); state.f2f = {}; } // Simple Initiative Tracker (Green Dot)... if (CurrentTO.length === 0 && PreviousTO[0].id != -1) getObj("graphic", PreviousTO[0].id).set("status_green", false); if (CurrentTO.length > 0 && CurrentTO[0].id != -1) getObj("graphic", CurrentTO[0].id).set("status_green", true); if (PreviousTO.length > 0 && PreviousTO[0].id != -1) getObj("graphic", PreviousTO[0].id).set("status_green", false); });
on("change:campaign:turnorder", function(current, previous) {     var CharacterIDs = ["-JgkH8hme8IcXgSo8F9f", "-JgkGs07oHSprISJutLR", "-JgkGrQvhn0XNpK4Vubk", "-Ji_M_ygUiza_oZ3wUyF", "-JgkH-DQxm6bYGRb2jWH", "-JgkGm0ANzfNR3Wdfcrm", "-JgkH2ttgf_oNlBi-pgE"];     // eg var CharacterIDs = ["-KHWScTHo_oHinvteAqm", "-KGucJWiVEW9vZhF7_eM", "-KHWSkIxLWXyGIO5A4dJ"];     var CurrentTO = JSON.parse(current.get("turnorder"));     var PreviousTO = JSON.parse(previous["turnorder"]);     var Token;     var Character;          // Save F2F data...     if (!state.f2f) state.f2f = {};     if (_.isEmpty(state.f2f)) {         _.each(CharacterIDs, function(charid) {             Character = getObj("character", charid);             state.f2f[charid] = {                 CharacterID: charid,                 ControlledBy: Character.get("controlledby")             }         });     }          // Process the turn order...     if (CurrentTO.length > 0) {         _.each(state.f2f, function(a) {             getObj("character", a["CharacterID"]).set("controlledby", "");         });         if (CurrentTO[0].id != -1) Token = getObj("graphic", CurrentTO[0].id);         if (CurrentTO[0].id != -1 && Token.get("represents") !== "") Character = getObj("character", Token.get("represents"));         if (CurrentTO[0].id != -1 && Token.get("represents") !== "" && Character.id in state.f2f) {             Character.set("controlledby", state.f2f[Character.id]["ControlledBy"]);         } else {             // Return control to all players during npc and custom item turns...             _.each(state.f2f, function(b) {                 getObj("character", b["CharacterID"]).set("controlledby", b["ControlledBy"]);             });         }     } else {         // Turn order tracker is empty. Return control to all players...         _.each(state.f2f, function(z) {             getObj("character", z["CharacterID"]).set("controlledby", z["ControlledBy"]);         });         state.f2f = {};     }          // Simple Initiative Tracker (Green Dot)...     if (CurrentTO.length === 0 && PreviousTO[0].id != -1) getObj("graphic", PreviousTO[0].id).set("status_green", false);     if (CurrentTO.length > 0 && CurrentTO[0].id != -1) getObj("graphic", CurrentTO[0].id).set("status_green", true);     if (PreviousTO.length > 0 && PreviousTO[0].id != -1) getObj("graphic", PreviousTO[0].id).set("status_green", false); });
And in a similar vein, so maybe related: TurnMarker.js TokenNameNumber.js StatusTracker.js IsGM.js Health Colour.js ItsATrap.js VecMath.js TokenCollisions.js PowerCards.js Reset.js PersonalView.js New Script Where reset.js is on("chat:message", function(msg) {     // Exit if not an api command     if (msg.type != "api") return;          // Get the API Chat Command     msg.who = msg.who.replace(" (GM)", "");     msg.content = msg.content.replace("(GM) ", "");     var command = msg.content.split(" ", 1);     // Removes all status markers from selected tokens...     // Usage: !clear     if (command == "!clear") {         _.each(msg.selected, function(obj) {             var Token = getObj("graphic", obj._id);             var DefaultIcons = "";             if (Token.get("represents") !== "") {                 DefaultIcons = findObjs({_type: "attribute", name: "DefaultIcons", _characterid: Token.get("represents")})[0];                 DefaultIcons = (DefaultIcons !== undefined) ? DefaultIcons.get("current") : "";             }             Token.set("statusmarkers", DefaultIcons);         });     }     // Resets selected tokens to their fully healed state...     // Usage: !resetDef     if (command == "!resetDef") {         _.each(msg.selected, function(obj) {             // Get the Token and its max bar values...             var Token = getObj("graphic", obj._id);             //var Bar1Max = Token.get("bar1_max");             var Bar2Max = Token.get("bar2_max");             //var Bar3Max = Token.get("bar3_max");             var DefaultIcons = "";                          // If the Token represents a character, check to see if the Token             // has any default icons to set. Usage should be markername@value             // Example: grenade@2             if (Token.get("represents") !== "") {                 DefaultIcons = findObjs({_type: "attribute", name: "DefaultIcons", _characterid: Token.get("represents")})[0];                 DefaultIcons = (DefaultIcons !== undefined) ? DefaultIcons.get("current") : "";             }                          // Reset bar values and remove all status markers except those              // marked as default icons...             //if (Bar1Max !== null) Token.set("bar1_value", Bar1Max);             if (Bar2Max !== null) Token.set("bar2_value", Bar2Max);             //if (Bar3Max !== null) Token.set("bar3_value", Bar3Max);             Token.set("statusmarkers", DefaultIcons);         });     }          // Resets selected tokens to their fully healed state...     // Usage: !reset     if (command == "!reset") {         _.each(msg.selected, function(obj) {             // Get the Token and its max bar values...             var Token = getObj("graphic", obj._id);             var Bar1Max = Token.get("bar1_max");             var Bar2Max = Token.get("bar2_max");             var Bar3Max = Token.get("bar3_max");             var DefaultIcons = "";                          // If the Token represents a character, check to see if the Token             // has any default icons to set. Usage should be markername@value             // Example: grenade@2             if (Token.get("represents") !== "") {                 DefaultIcons = findObjs({_type: "attribute", name: "DefaultIcons", _characterid: Token.get("represents")})[0];                 DefaultIcons = (DefaultIcons !== undefined) ? DefaultIcons.get("current") : "";             }                          // Reset bar values and remove all status markers except those              // marked as default icons...             if (Bar1Max !== null) Token.set("bar1_value", Bar1Max);             if (Bar2Max !== null) Token.set("bar2_value", Bar2Max);             if (Bar3Max !== null) Token.set("bar3_value", Bar3Max);             Token.set("statusmarkers", DefaultIcons);         });     }     });
1465981730

Edited 1465983609
Although the second one sometimes gives: SyntaxError: Illegal return statement Its very annoying as it was working.... ??
OK I worked it out, got a new copy of Powercards and it seems to be fine now....
Glad you figured it out... the interaction of scripts when they're combined in one big script can be weird.