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 error: Infinite loop or long running process detected.

I only have two scripts in my sandbox. any ideas what might be going on? Script one: on("change:graphic", function(obj) { if(obj.get("bar1_max") === "") return; if(obj.get("bar1_value") <= obj.get("bar1_max") / 2) { obj.set({ status_redmarker: true }); } else{ obj.set({ status_redmarker: false }) } if(obj.get("bar1_value") <= 0) { obj.set({ status_dead: true }); } else { obj.set({ status_dead: false }); } }); Script two: on('chat:message', function(msg) { if (msg.type != 'api') return; if (msg.content.indexOf('!cphr ') != 0) return; var text = msg.content.substring(6); for (var i = 0; i < msg.inlinerolls.length; i++) { if (msg.inlinerolls[i].expression == '1t[Catch-Phrase]') { text = text.replace('$[[' + i + ']]', msg.inlinerolls[i].results.rolls[0].results[0].tableItem.name); } else { text = text.replace('$[[' + i + ']]', '[[' + msg.inlinerolls[i].expression + ']]'); } } var sendAs; var chr = findObjs({ _type: 'character', name: msg.who})[0]; if (chr) { sendAs = 'character|' + chr.id; } else { sendAs = 'player|' + msg.playerid; } sendChat(sendAs, text); });
I had the exact same thing happen to me about two hours ago. The API console locked up and had the same message. I have now come back online and it is now working fine. Very strange.
1394684471
Lithl
Pro
Sheet Author
API Scripter
This occasionally happens, even with scripts that work perfectly fine. I don't know what causes it. Usually, hitting "Save Script" will solve the problem.
1394696107
Alex L.
Pro
Sheet Author
I have always assumed it was the "long running" bit, as in for what ever reason your script is taking more than x number of seconds or milliseconds to do something.
Brian said: This occasionally happens, even with scripts that work perfectly fine. I don't know what causes it. Usually, hitting "Save Script" will solve the problem. Yeah. It usually does fix it. I have noticed just in the last couple of days that it has not always fixed the problem immediately and I have had to come back 20 minutes later before it is working again.
I dunno what causes it... but I have a 250 line, 293 line, a 63 line, a 128 line, and another 128 line script all running in my D&D 4e campaign and I rarely get the long running / infinite loop error.
1394704013
Alex L.
Pro
Sheet Author
HoneyBadger said: I dunno what causes it... but I have a 250 line, 293 line, a 63 line, a 128 line, and another 128 line script all running in my D&D 4e campaign and I rarely get the long running / infinite loop error. I have seen it happen with a 3 line script but then never happen with my 5k+ like script. I think its more that sometimes the server that runs this stuff gets overloaded.
thanks for the inputs. Saving did not do anything last night, I'll check in a bit
It's doing it again right now.
I disabled all scripts 15 minutes ago and it still has the same infinite loop error message.