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

Sandbox Restart Required Every Day

Hi All, To get my API's to work it seems I need to log into the game, come out and restart the sandbox. It needs to be done every day. Can anyone tell me what I need to do to fix this? Thanks
1651182587
Kraynic
Pro
Sheet Author
Not sure about the daily need for restarting, but I would say that rather than exit your game, just open the api settings in another tab.  Then you don't have to reload your game and you can check to be sure everything is working while still having your api settings page open.
The API always stops running when there are no players in the game, but should spin up automatically once a player has entered the game. You might have a script that does something on startup and is causing an error, or you might just need to wait a minute for it to finish spinning up when you first enter the game. What scripts are you using? Do you usually see an error message in the API Output Console? You don't need to exit the game to restart the sandbox. I recommend simply keeping the API Script Page open in a separate window (I shrink the window down so I only see the API Output Console in the corner of the screen) so you can see if an error is thrown at some point.&nbsp;&nbsp; I also suggest using the API Heartbeat script &nbsp;if you want a visual indication in-game &nbsp;when the API stops working. This is also very useful for 'silent' errors that don't show up on the API Output Console. I also use this small scriptlet to notify me in-game when the API has finished spinning up (I modified it from the link listed on the first line). You can uncomment line 14 if you want a message in game when the API is starting to spin up as well.&nbsp; // <a href="https://app.roll20.net/forum/post/9379560/script-help-new-to-scripting-need-help-on-one-started#post-9412121" rel="nofollow">https://app.roll20.net/forum/post/9379560/script-help-new-to-scripting-need-help-on-one-started#post-9412121</a> const APIStartup = (()=&gt;{ &nbsp; &nbsp; const scriptName = "API Startup"; &nbsp; &nbsp; const version = '0.1'; &nbsp; &nbsp; const OuterStyleStart = `width: 75%; margin: auto; padding: 0px; border-radius: 4px;&nbsp; box-shadow: 1px 1px 1px #707070;`; &nbsp; &nbsp; const InnerStyleStart = `text-align: center; vertical-align: middle; padding: 0px 0px; margin: 0px auto; border: 1px solid #000; border-radius: 4px; color: #000; background-image: -webkit-linear-gradient(-45deg, #a7c7dc 0%,#85b2d3 100%); text-shadow: 0px 0px #222, 0px 0px #222, 0px 0px #222, 0px 0px #222 , 0px 0px #222;`; &nbsp; &nbsp; let timestamp = (new Date()).toLocaleString("en-US", {timeZone: "America/Los_Angeles"}); &nbsp; &nbsp; const checkInstall = function() { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log('-=&gt; ' + scriptName + ' v' + version + ' &lt;=-'); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setTimeout(()=&gt;log(`API Wakeup Complete at ` +timestamp),0); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat("API Startup", `/w gm &lt;div style='${OuterStyleStart}'&gt;&lt;div style='${InnerStyleStart}'&gt;API Wakeup Complete&lt;/div&gt;&lt;/div&gt;`,null,{noarchive:true}); &nbsp; &nbsp; }; &nbsp; &nbsp; log(`API Wakeup Begun...`); //&nbsp; &nbsp; sendChat("API Startup", `/w gm &lt;div style='${OuterStyleStart}'&gt;&lt;div style='${InnerStyleStart}'&gt;API Starting Up&lt;/div&gt;&lt;/div&gt;`,null,{noarchive:true}); &nbsp; &nbsp; on("ready",() =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; checkInstall(); &nbsp; &nbsp; }); })();
1651187907
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I can verify that the API doesn't always start along with the game, but requires getting out into the cold winter air and turning the crank by hand. This happens for me quite often, even in a game with very few scripts. I nearly always run the API window in a separate tab, for quick access.
1651192502
Andrew R.
Pro
Sheet Author
So do I. API console in one tab, launched game in another tab, restart the API immediately after the game has finished launching, etc.,&nbsp;
Me three. It now is part of my workflow at the start of my games.
I'll check into this. How often is this happening for everyone?
The silent crash also still exists similar to the no startup spin up.&nbsp; The page where we can see the sandbox just looks normal to us but the second you go to use an api feature nothing, and then when you look at sandbox nothing, and then when you restart the sandbox you see there was some error like it had no active sandbox running and is restarting.&nbsp;&nbsp;
I can say this anecdotally happens to me about 1/3 of the time I launch a game.
1651300204
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Sydney S. said: I'll check into this. How often is this happening for everyone? I don't have any hard numbers for you, but similarly to Adam, I'd say that it's somewhere between a third and half the time I start a game up that the API is nonresponsive when I try to send an API command. I recommend bump, or another simple command with an easily visible effect to test.
Sydney S. said: I'll check into this. How often is this happening for everyone? I'd say 1/3 to 1/2 the time, like others I have the API page bookmarked for my games and absent mindedly restart it if anything even feels off about the APIs/game. I generally use 9 APIs and I've just assumed one of them is the issue but after a restart it works and I never bothered to try and track down a possible underlying cause.&nbsp; &nbsp;
Scott C. said: Sydney S. said: I'll check into this. How often is this happening for everyone? I don't have any hard numbers for you, but similarly to Adam, I'd say that it's somewhere between a third and half the time I start a game up that the API is nonresponsive when I try to send an API command. I recommend bump, or another simple command with an easily visible effect to test. Teleport API or MoTD are great ones as they will message the DM on startup/resets.&nbsp; This is also how you can spot the silent crashes that are apparently sandbox not present bugs.&nbsp; As you don't see the sandbox restart at all till you manually restart.&nbsp;&nbsp;
1651337754
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I use the Aaron's API Heartbeat script. It updates a macro name in your macro bar at regular intervals. If the button name stops "animating" your API is down. But that's mostly for in session crashes, which could be caused by anything. The startup problem is the real headscratcher. And yeah, it feels like it occurs 1/3 to 1/2 the time. I'll start counting, to avoid confirmation bias.
Opening in in a new window - today we have; After restarting;
1651345048
GiGs
Pro
Sheet Author
API Scripter
I get the Possible Infinite Loop detected causing shutdowns, with only scripts installed that should not be causing that - it does seem to be a Roll20 bug.
I also get the Possible Infinite Loop message and shutdown, but almost always after having the interface open for more than a day. It's been relatively stable for me lately.&nbsp; I removed some older scripts for which I now have better solutions -- maybe one of those was a cause of previous in-game crashes.
1651371028

Edited 1651371217
Same situation with the possible infinite loop here in my game since two weeks. A sandbox restart was required each (three) times for the actual game and right now when testing the API operability at startup again. After restarting the sandbox and logging in the game: Installed scripts:&nbsp; G &nbsp;MapLock G &nbsp;Vector Math G &nbsp;MatrixMath G &nbsp;Path Math G &nbsp;Door Knocker G &nbsp;Teleport G &nbsp;TokenNameNumber G &nbsp;TokenMod G &nbsp;TokenMarker
I am running the API Hearbeat and it is now working every time. Thanks.......
1656887342

Edited 1656887554
It has stopped working again... Sigh. Scrips disabled due to an error detected; Possible infinite Loop detected, Shutting Down
1656900500
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hazarding some guesswork. Looking at the list you posted, I think you can rule out: Vector Math MatrixMath Path Math They are function libraries and don't typically do anything on their own. I use these and don't get an infinite loop error: MapLock Door Knocker TokenNameNumber TokenMod I'd start with disabling these, and see if the error doesn't clear up: Teleport TokenMarker