Fixed bugs in purchasing/upgrading hacknet nodes in Netscript. Fixed documentation for them as well

This commit is contained in:
Daniel Xie 2017-05-23 12:49:26 -05:00
parent 73c07841a3
commit ea17334792
4 changed files with 4 additions and 5 deletions

@ -281,9 +281,9 @@ CONSTANTS = {
"a new hacknet node then the function will return an empty string. Does NOT work offline<br><br>" +
"<i>upgradeHacknetNode(name)</i><br> Upgrades the level of a Hacknet Node. The argument passed in must be a string with the name of the Hacknet Node to upgrade. " +
"If the Hacknet Node is successfully upgraded the function will return true. It will return false otherwise. Does NOT work offline. Example: <br>" +
"var node = purchaseHacknetNode();<br>" +
"node = purchaseHacknetNode();<br>" +
"if (node != '') {<br>" +
"&nbsp;&nbsp;&nbsp;&nbsp;var i = 0;<br>" +
"&nbsp;&nbsp;&nbsp;&nbsp;i = 0;<br>" +
"&nbsp;&nbsp;&nbsp;&nbsp;while(i < 10) {<br>" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (upgradeHacknetNode(node)) {i = i + 1;}<br>" +
"&nbsp;&nbsp;&nbsp;&nbsp;}; <br>" +

@ -436,7 +436,7 @@ processSingleHacknetNodeEarnings = function(numCycles, nodeObj) {
getHacknetNode = function(name) {
for (var i = 0; i < Player.hacknetNodes.length; ++i) {
if (Player.hacknetNodes[i].name == name) {
return player.hacknetNodes[i];
return Player.hacknetNodes[i];
}
}
return null;

@ -219,7 +219,6 @@ function Parser(input) {
var tok = input.next();
if (tok.type == "var" || tok.type == "num" || tok.type == "str")
console.log("encountered var in parse_atom");
return tok;
unexpected();
});

@ -31,7 +31,7 @@ function runScriptsLoop() {
if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == false) {
try {
var ast = Parser(Tokenizer(InputStream(workerScripts[i].code)));
console.log(ast);
//console.log(ast);
} catch (e) {
dialogBoxCreate("Syntax ERROR in " + workerScripts[i].name + ":", e, "", "");
workerScripts[i].env.stopFlag = true;