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

API Shutdown during game

Hello all, occasionally when we are playing the API's I am running crash. I am wondering two things. 1) Is there anyway to be notified when your scripts stop working and 2) Are there any ways to restart the API's without stopping the game? What I have done is open another browser and go to the API screen and restart that sandbox and that seems to start it back up in the game. Are there any other tips?
1614266130
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There are some watchdog type scripts. They are a little finicky to install. I often load the API into another tab (no need for a whole different browser) and consult it when things get suspicious. If you have multiple monitors, keeping a second window open to the API page, made very small and scrolled to the point where you can see the pink crash warning box should it appear, is very helpful.
keithcurtis said: There are some watchdog type scripts. They are a little finicky to install. I often load the API into another tab (no need for a whole different browser) and consult it when things get suspicious. If you have multiple monitors, keeping a second window open to the API page, made very small and scrolled to the point where you can see the pink crash warning box should it appear, is very helpful. Keith, Thank you, I think having another tab (that is what I mean) open is the way to go.
You could also try this script by TheAaron. HeartBeat What it does is while the sandbox is up and running. Player colors (the color next to the player and go online in the bottom left corner) cycles between two colors. If the colors are cycling, the sandbox is up. If it is a solid unchanging color, the sandbox crashed. Read TheAaron's notes on that as it does increase bandwidth usage. 
1614268086
The Aaron
Roll20 Production Team
API Scripter
I actually have a new version of the API Heartbeat script on the cusp of being finished. I should just wrap it up and push it...
Nice, i am eagerly awaiting. Now i use a version of API Heartbeat that also shows a heartbeat in the API log (every 30 seconds) and logs all (? i hope) on() events. Maybe that is something that can be consolidated - and made really nice as my coding is of the 'make it work get  a bigger hammer style. i basically added three functions:  mylog = function(msg) {         let d = new Date();         let lines = new Error().stack.split("\n");         log(d.toUTCString() + " " + lines[2].trim() + " " + msg);     }, logTimestamp = function() {         mylog('beat');     },     logOnEvent = function(event, obj, prev){ mylog(`${event} ${obj.id}`); for (var p in prev) { if (p !== 'bio' && p !== 'notes' && p !== '_defaulttoken' & p !== 'gmnotes') { if( prev[p] !== obj.get(p)) { mylog(`${event} ${obj.id} ${p} : ${prev[p]} => ${obj.get(p)}`); } } } }, and then added in startStopBeat() setInterval(logTimestamp,30000); and finally updated registerEventHandlers() to       registerEventHandlers = function() {         on('change:campaign:playerpageid', (obj,prev) => { logOnEvent("change:campaign:playerpageid",obj,null); });         on('change:campaign:turnorder', (obj,prev) => { logOnEvent("change:campaign:turnorder",obj,null); }); // prev generates too much logging         on('change:campaign:initiativepage', (obj,prev) => { logOnEvent("change:campaign:initiativepage",obj,prev); });         on("change:player", (obj,prev) => { logOnEvent("change:player",obj,prev); });         on('add:page', (obj) => { logOnEvent("add:page",obj.id,null); });         on("change:page", (obj,prev) => { logOnEvent("change:page",obj,prev); });         on('destroy:page', (obj) => { logOnEvent("destroy:page",obj.id,null); });                 on('add:path', (obj) => { logOnEvent("add:path",obj.id,null); });         on("change:path", (obj,prev) => { logOnEvent("change:path",obj,prev); });         on('destroy:path', (obj) => { logOnEvent("destroy:path",obj.id,null); });                 on('add:text', (obj) => { logOnEvent("add:text",obj.id,null); });         on("change:text", (obj,prev) => { logOnEvent("change:text",obj,prev); });         on('destroy:text', (obj) => { logOnEvent("destroy:text",obj.id,null); });                         on('add:graphic', (obj) => { logOnEvent("add:graphic",obj.id,null); });         on("change:graphic", (obj,prev) => { logOnEvent("change:graphic",obj,prev); });         on('destroy:graphic', (obj) => { logOnEvent("destroy:graphic",obj.id,null); });                 on('remove:graphic', (obj) => { logOnEvent("destroy:graphic",obj.id,null); });                 on('add:token', (obj) => { logOnEvent("add:token",obj.id,null); });         on("change:token", (obj,prev) => { logOnEvent("change:token",obj,prev); });         on('destroy:token', (obj) => { logOnEvent("destroy:token",obj.id,null); });                 on('add:card', (obj) => { logOnEvent("add:card",obj.id,null); });         on("change:card", (obj,prev) => { logOnEvent("change:card",obj,prev); });         on('destroy:card', (obj) => { logOnEvent("destroy:card",obj.id,null); });                 on('add:deck', (obj) => { logOnEvent("add:deck",obj.id,null); });         on("change:deck", (obj,prev) => { logOnEvent("change:deck",obj,prev); });         on('destroy:deck', (obj) => { logOnEvent("destroy:deck",obj.id,null); });                 on('add:character', (obj) => { logOnEvent("add:character",obj.id,null); });         on("change:character", (obj,prev) => { logOnEvent("change:character",obj,prev); });         on('destroy:character', (obj) => { logOnEvent("destroy:character",obj.id,null); });                 on('add:handout', (obj) => { logOnEvent("add:handout",obj.id,null); });         on("change:handout", (obj,prev) => { logOnEvent("change:handout",obj,prev); });         on('destroy:handout', (obj) => { logOnEvent("destroy:handout",obj.id,null); });                         on('add:attribute', (obj) => { logOnEvent("add:attribute",obj.id,null); });         on("change:attribute", (obj,prev) => { logOnEvent("change:attribute",obj,prev); });         on('destroy:attribute', (obj) => { logOnEvent("destroy:attribute",obj.id,null); });                         on('chat:message', handleInput);         on('change:player:_online', startStopBeat);     }; Maybe this should be two scripts. Nah.... Roll20 rolls it into one large script anyways.