diff --git a/css/menupages.css b/css/menupages.css index 2284324b0..11e198ef8 100644 --- a/css/menupages.css +++ b/css/menupages.css @@ -184,7 +184,7 @@ background-color: #555; .active-scripts-server-panel { margin: 0px 6px 6px 6px; - padding: 6px; + padding: 0px 6px 6px 6px; width: 55%; margin-left: 5%; display: none; diff --git a/src/Constants.js b/src/Constants.js index b04b2479a..538b41c93 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -34,7 +34,7 @@ CONSTANTS = { /* Script related things */ //Time (ms) it takes to run one operation in Netscript. - CodeInstructionRunTime: 750, + CodeInstructionRunTime: 500, //RAM Costs for different commands ScriptWhileRamCost: 0.2, @@ -538,7 +538,7 @@ CONSTANTS = { "v0.20.0
" + "-Refactored Netscript Interpreter code. Operations in Netscript should now run significantly faster (Every operation " + "such as a variable assignment, a function call, a binary operator, getting a variable's value, etc. used to take up to several seconds, " + - "now each one should only take 750 milliseconds).

" + + "now each one should only take ~500 milliseconds).

" + "-Percentage money stolen when hacking lowered to compensate for faster script speeds

" + "-Hacking experience granted by grow() halved

" + "-Weaken() is now ~11% faster, but only grants 3 base hacking exp upon completion instead of 5

" + @@ -560,7 +560,7 @@ CONSTANTS = { "-Server growth no longer happens naturally

" + "-Servers now have a maximum limit to their money. This limit is 50 times it's starting money

" + "-Hacking now grants 10% less hacking experience

" + - "-You can now edit scripts that are running

+ " + + "-You can now edit scripts that are running

" + "-Augmentations cost ~11% more money and 25% more faction reputation

" + "v0.19.7
" + "-Added changelog to Options menu
" + @@ -648,7 +648,7 @@ CONSTANTS = { "v0.20.0
" + "-Refactored Netscript Interpreter code. Operations in Netscript should now run significantly faster (Every operation " + "such as a variable assignment, a function call, a binary operator, getting a variable's value, etc. used to take up to several seconds, " + - "now each one should only take 750 milliseconds).

" + + "now each one should only take ~500 milliseconds).

" + "-Percentage money stolen when hacking lowered to compensate for faster script speeds

" + "-Hacking experience granted by grow() halved

" + "-Weaken() is now ~11% faster, but only grants 3 base hacking exp upon completion instead of 5

" + @@ -670,6 +670,6 @@ CONSTANTS = { "-Server growth no longer happens naturally

" + "-Servers now have a maximum limit to their money. This limit is 50 times it's starting money

" + "-Hacking now grants 10% less hacking experience

" + - "-You can now edit scripts that are running

+ " + + "-You can now edit scripts that are running

" + "-Augmentations cost ~11% more money and 25% more faction reputation

", } \ No newline at end of file diff --git a/src/Message.js b/src/Message.js index c650e5e6a..64c1fa533 100644 --- a/src/Message.js +++ b/src/Message.js @@ -43,7 +43,6 @@ function addMessageToServer(msg, serverHostname) { //Checks if any of the 'timed' messages should be sent function checkForMessagesToSend() { - console.log("checkForMessagesToSend() called"); var jumper0 = Messages[MessageFilenames.Jumper0]; var jumper1 = Messages[MessageFilenames.Jumper1]; var jumper2 = Messages[MessageFilenames.Jumper2]; diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index 78623ed88..d478a4240 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -280,15 +280,16 @@ function evaluate(exp, workerScript) { return reject(makeRuntimeRejectMsg(workerScript, "Invalid IP or hostname passed into kill() command")); } - for (var i = 0; i < server.runningScripts.length; ++i) { - if (filename == server.runningScripts[i].filename) { - killWorkerScript(filename, server.ip); - workerScript.scriptRef.log("Killing " + scriptName + ". May take up to a few minutes for the scripts to die..."); - return resolve(true); - } + var res = killWorkerScript(filename, server.ip); + if (res) { + workerScript.scriptRef.log("Killing " + filename + ". May take up to a few minutes for the scripts to die..."); + return Promise.resolve(true); + } else { + workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname); + return Promise.resolve(false); } - workerScript.scriptRef.log("kill() failed. No such script "+ scriptName + " on " + server.hostname); - return resolve(false); + }).then(function(res) { + resolve(res); }).catch(function(e) { reject(e); }); @@ -304,7 +305,7 @@ function evaluate(exp, workerScript) { workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip); return reject(makeRuntimeRejectMsg(workerScript, "Invalid IP or hostname passed into killall() command")); } - workerScript.scriptRef.log("killall(): Killing all scrips on " + server.hostname); + workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die"); for (var i = server.runningScripts.length; i >= 0; --i) { killWorkerScript(server.runningScripts[i], server.ip); } @@ -344,7 +345,7 @@ function evaluate(exp, workerScript) { } if (sourceScript == null) { workerScript.scriptRef.log(scriptname + " does not exist. scp() failed"); - return resolve(false); + return Promise.resolve(false); } //Overwrite script if it already exists @@ -355,8 +356,7 @@ function evaluate(exp, workerScript) { var oldScript = destServer.scripts[i]; oldScript.code = sourceScript.code; oldScript.ramUsage = sourceScript.ramUsage; - resolve(true); - return; + return Promise.resolve(true); } } @@ -368,7 +368,10 @@ function evaluate(exp, workerScript) { newScript.server = destServer.ip; destServer.scripts.push(newScript); workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); - return resolve(true); + return Promise.resolve(true); + return; + }).then(function(res) { + resolve(res); }).catch(function(e) { reject(e); }); @@ -431,7 +434,7 @@ function evaluate(exp, workerScript) { workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip); return reject(makeRuntimeRejectMsg(workerScript, "Invalid IP or hostname passed into getServerRequiredHackingLevel() command")); } - workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + formatNumber(server.requiredHackingSkill, 0) + " for " + server.hsostname); + workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + formatNumber(server.requiredHackingSkill, 0) + " for " + server.hostname); resolve(server.requiredHackingSkill); }, function(e) { reject(e); diff --git a/src/NetscriptWorker.js b/src/NetscriptWorker.js index fc0c9aeb0..d3fee5a5d 100644 --- a/src/NetscriptWorker.js +++ b/src/NetscriptWorker.js @@ -111,6 +111,8 @@ function runScriptsLoop() { return; } } + } else { + dialogBoxCreate("An unknown script died for an unknown reason. This is a bug please contact game dev"); } }); } @@ -152,8 +154,10 @@ function killWorkerScript(scriptName, serverIp) { for (var i = 0; i < workerScripts.length; i++) { if (workerScripts[i].name == scriptName && workerScripts[i].serverIp == serverIp) { workerScripts[i].env.stopFlag = true; + return true; } } + return false; } //Queues a script to be run