From 15f9ef1a8581f76387d2e272283708159635df90 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Sun, 18 Jun 2017 16:01:23 -0500 Subject: [PATCH] temp changes --- src/Constants.js | 2 +- src/Script.js | 11 +++++++---- src/Terminal.js | 11 ++++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Constants.js b/src/Constants.js index 40c5b837d..7ce76c819 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -654,7 +654,7 @@ CONSTANTS = { "-grow() and weaken() now give hacking experience based on the server's base security level, rather than a flat exp amount
" + "-Slightly reduced amount of exp gained from hack(), weaken(), and grow()
" + "-Rebalanced formulas that determine crime success
" + - "-Reduced RAM cost for multithreading a script. The RAM multiplier for each thread was reduced from 1.02 to 1.01
" + "-Reduced RAM cost for multithreading a script. The RAM multiplier for each thread was reduced from 1.02 to 1.01
" + "v0.21.1
" + "-IF YOUR GAME BREAKS, DO THE FOLLOWING: Options -> Soft Reset -> Save Game -> Reload Page. Sorry about that!
" + "-Autocompletion for aliases - courtesy of Github user LTCNugget

" + diff --git a/src/Script.js b/src/Script.js index f8ef9a510..d4ea22ac5 100644 --- a/src/Script.js +++ b/src/Script.js @@ -423,12 +423,15 @@ RunningScript.fromJSON = function(value) { } //Creates an object that creates a map/dictionary with the IP of each existing server as -//a key, and 0 as the value. This is used to keep track of how much money a script -//hacks from that server -function AllServersMap() { +//a key. Initializes every key with a specified value that can either by a number or an array +function AllServersMap(init = 0) { + if (init.constructor === Array || init instanceof Array) { + this.initValue = init.splice(); + } + for (var ip in AllServers) { if (AllServers.hasOwnProperty(ip)) { - this[ip] = 0; + this[ip] = init; } } } diff --git a/src/Terminal.js b/src/Terminal.js index 7459fb3c4..03612336d 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -551,12 +551,13 @@ var Terminal = { case iTutorialSteps.ActiveScriptsToTerminal: if (commandArray.length == 2 && commandArray[0] == "tail" && commandArray[1] == "foodnstuff.script") { - var currScripts = Player.getCurrentServer().scripts; - for (var i = 0; i < currScripts.length; ++i) { - if ("foodnstuff.script" == currScripts[i].filename) { - currScripts[i].displayLog(); - } + //Check that the script exists on this machine + var runningScript = findRunningScript("foodnstuff.script", [], Player.getCurrentServer()); + if (runningScript == null) { + post("Error: No such script exists"); + return; } + logBoxCreate(runningScript); iTutorialNextStep(); } else {post("Bad command. Please follow the tutorial");} break;