Open csis0247 opened 6 years ago
I made some makeshift adjustments to the code, and it has been running for 9 hours without any major issue. There may still be difficulty exiting the planet once it has been conquered, but it is very likely that it is Steam's issue rather than the script's, as I cannot manually leave the planet either, for minutes.
Step 1: Add a global error catching function in an empty space just below the header comments and above the first line of real code "(function() {..." , to allow recovery after the occurrence of the above exception (or in fact any uncatched exception).
window.onerror = function(msg, url, line, col, error) {
// Basically I copied the original reload method to a "global" level.
setTimeout(function() {
if (typeof unsafeWindow !== "undefined")
unsafeWindow.location.reload();
else
window.location.reload();
}, 750);
var suppressErrorAlert = true;
// If you return true, then error alerts (like in older versions of
// Internet Explorer) will be suppressed.
return suppressErrorAlert;
};
Step 2: I am not certain if it really is useful. But the rate of error was reduced after I increased the interval of the "loop".
Change all
setInterval(gameCheck, 100)
into
setInterval(gameCheck, 200)
Effectively doubling the timer interval, whatever it does.
Step 3: This change is irrelevant, but I added it to keep track of my progress (score) in the console.
Look for the line:
console.log('Joining zone:', zoneId);
And add the following line below it:
console.log('Current score: ' + gPlayerInfo.score);
My only worry with overwriting window.onerror
is being able to help users that are saying that they are just constantly refreshing. They could keep "Preserve Log" checked in console, but it adds an extra problem to try support them with.
I am getting this error occasionally whenever a round has ended, but before printing "round done" to console, and the script has been unable to recover from it.