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 .
×
May your rolls be chill this holiday season!
Create a free account

APIs suddenly stopped working.

/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Cannot call method 'get' of undefined at TurnOrderAgent (evalmachine. :85:95) at evalmachine. :55:9 at eval ( And thats the error I'm getting.
1447382149

Edited 1447382215
Gen Kitty
Forum Champion
Moving this to API for now. Additionally, a list of your scripts and a description of what you were doing at the time the error popped up is needed.
I wasn't doing anything at the time the error popped up. I have that script that puts the bloodied and death tokens on automatically. The script that lets you go !EOT to end turn, three variations of the log note script, snaptile and table exporter.
1447442490

Edited 1447442569
DK Heinrich
Marketplace Creator
Sheet Author
Check to make sure that the blood script is most current. Old one had issues (that Aaron corrected) and a new version  Blood Spatter and Status Markers  is up to date also and is the one I am using.
Without the actual script(s), there isn't much that we can do on this end, but given that the function in which things are going wrong is called TurnOrderAgent, I'd suggest looking at the script that involves turn order operations.  It looks like something in that function is looking for a token, character, or some other Roll20 object, but isn't getting it for some reason.  Likely candidates include tokens not being linked to characters, the selected token not being in the turn order, or the script requiring some special action to initialize which didn't happen.
1447476179

Edited 1447495280
Mod edit to enclose code in code box // VARIABLE & FUNCTION DECLARATION var TurnOrderAgent = TurnOrderAgent || {}; // AnnounceNewRound - Set to TRUE if you want the script to announce // the beginning of each new round. var AnnounceNewRound = true; 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); if (command == "!eot") { if (!Campaign().get('turnorder')) return; // Exit if the turn order tracker is not open var turn_order = JSON.parse(Campaign().get('turnorder')); // Parse the turn order information into JSON if (!turn_order.length) return; // Exit if there are no tokens on the tracker var turn = turn_order.shift(); // Grab the info for the top of initiative turn_order.push({ // Add the info to the bottom of initiative id: turn.id, pr: turn.pr, custom: turn.custom }); Campaign().set("turnorder", JSON.stringify(turn_order)); // Send the turn order back to the tracker TurnOrderAgent(); } }); on("change:campaign:turnorder", function(obj) { TurnOrderAgent(); }); function TurnOrderAgent () { if (!Campaign().get("turnorder")) return; var turn_order = JSON.parse(Campaign().get("turnorder")); if (!turn_order.length) return; if (typeof turn_order[0].pr == "string") { if (turn_order[0].pr.substring(0, 5) == "Round") { var RoundTracker = turn_order[0].pr; var CurrentRound = parseInt(RoundTracker.substring(5)); turn_order[0].pr = "Round " + (CurrentRound + 1); Campaign().set({turnorder: JSON.stringify(turn_order)}); if(AnnounceNewRound == true) { sendChat("", "/desc "); sendChat("", "/direct <div style='width: 100%; color: #C8DE84; border: 1px solid #91bd09; background-color: #749a02; box-shadow: 0 0 15px #91bd09; display: block; text-align: center; font-size: 20px; padding: 5px 0; margin-bottom: 0.25em; font-family: Garamond;'>" + turn_order[0].pr + "</div>"); } } } // Exit script if custom item on turn order tracker instead of a token... if (turn_order[0].id == -1) return; var current_token = getObj("graphic", turn_order[0].id); var initiative_highlighter = findObjs({name: "InitiativeHighlight", pageid: current_token.get("pageid")}, {caseInsensitive: true})[0]; if (initiative_highlighter == undefined) { // sendChat("ERROR", "/w gm Cannot find an initiative highlight token on this page."); return; } if (initiative_highlighter.get("layer") == "gmlayer" && current_token.get("layer") != "gmlayer") { initiative_highlighter.set({ "top": current_token.get("top"), "left": current_token.get("left"), "height": current_token.get("height"), "width": current_token.get("width") }); setTimeout(function() { initiative_highlighter.set({ "layer": current_token.get("layer") }); }, 500); } else { initiative_highlighter.set({ "layer": current_token.get("layer"), "top": current_token.get("top"), "left": current_token.get("left"), "height": current_token.get("height"), "width": current_token.get("width") }); } toFront(current_token); };
1447797103
The Aaron
Pro
API Scripter
Probably this is failing on line 49 where it tries to get the pageid of the current token.  Line 48 makes the assumption that whatever is in the turnorder at row 0 is a token, which won't be the case if there are any custom turn entries.  If you insert something like: if(!current_token){ return; } between line 48 and 49, it should prevent the crash.
Thanks