diff --git a/css/menupages.css b/css/menupages.css
index b6c71bf34..72c6fc9e6 100644
--- a/css/menupages.css
+++ b/css/menupages.css
@@ -9,14 +9,10 @@
padding-left: 10px;
margin-left: 10%;
width: 99%;
- overflow-y: scroll;
+ overflow: auto;
+ overflow-y: scroll;
}
-#character-info {
- overflow-y: scroll;
-}
-
-
/* Script Editor */
/* This temp element is used for auto adjusting filename field */
.tmp-element {
@@ -340,13 +336,19 @@ div.faction-clear {
/* Tutorial */
#tutorial-container {
- color: #66ff33;
position: fixed;
+ height: 100%;
padding-top: 10px;
padding-left: 10px;
- height: 100%;
margin-left: 10%;
- width: 85%;
+ width: 99%;
+ overflow: auto;
+ overflow-y: scroll;
+}
+
+#tutorial-text {
+ width: 80%;
+ margin: 10px;
}
/* Location */
diff --git a/css/workinprogress.css b/css/workinprogress.css
index a071c6357..2ce130425 100644
--- a/css/workinprogress.css
+++ b/css/workinprogress.css
@@ -12,7 +12,7 @@
#work-in-progress-cancel-button {
color: #aaa;
- float: right;
+ float: left;
font-size: 20px;
font-weight: bold;
-webkit-border-radius: 12px;
diff --git a/index.html b/index.html
index d0c4e71ed..1ed332870 100644
--- a/index.html
+++ b/index.html
@@ -130,7 +130,9 @@
@@ -473,6 +475,7 @@
Networking
Hacking
Scripts
+ Netscript Programming Language
Traveling
Jobs
Factions
@@ -530,7 +533,7 @@
Purchase 256GB Server - $100,000,000
Purchase 512GB Server - $250,000,000
Purchase 1TB Server - $750,000,000
- Purchase TOaR Router - $100,000
+ Purchase TOR Router - $100,000
Purchase RAM for Home computer
diff --git a/src/Constants.js b/src/Constants.js
index 54c7da397..0fe1422dc 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -156,10 +156,11 @@ CONSTANTS = {
"encounter diminishing returns in your hacking (since you are only hacking a certain percentage). A server " +
"will regain money at a slow rate over time. ",
- TutorialScriptsText: "Scripts can be used to automate the hacking process. Scripts must be written in the Netscript language " +
- "and are saved as a file. Running a script requires RAM. The more complex a script is, the more RAM " +
+ TutorialScriptsText: "Scripts can be used to automate the hacking process. Scripts must be written in the Netscript language. " +
+ "Documentation about the Netscript language can be found in the 'Netscript Programming Language' " +
+ "section of the 'Tutorial' tab. Running a script requires RAM. The more complex a script is, the more RAM " +
"it requires to run. Scripts can be run on any server you have root access to.
" +
- "Here are some commands that are useful when working with scripts:
" +
+ "Here are some Terminal commands that are useful when working with scripts:
" +
"free - Shows the current server's RAM usage
" +
"kill [script] - Stops a script that is running
" +
"nano [script] - Edit a script
" +
@@ -167,13 +168,64 @@ CONSTANTS = {
"run [script] - Run a script
" +
"tail [script] - Displays a script's logs
" +
"top - Displays all active scripts and their RAM usage
",
- TutorialTravelingText:"There are six major cities in the world that you are able to travel to:
" +
+ TutorialNetscriptText: "Netscript is a very simple programming language implemented for this game. The language has " +
+ "your basic programming constructs and several built-in commands that are used to hack.
" +
+ " Variables and data types
" +
+ "The following data types are supported by Netscript:
" +
+ "numeric - Integers and floats (6, 10.4999)
" +
+ "string - Encapsulated by single or double quotes ('this is a string')
" +
+ "boolean - True or False
" +
+ "To create a variable, use the assign (=) operator. The language is not strongly typed. Examples:
" +
+ "i = 5;
" +
+ "s = 'this game is awesome!';
" +
+ "In the first example above, we are creating the variable i and assigning it a value of 5. In the second, " +
+ "we are creating the variable s and assigning it the value of a string. Note that all expressions must be " +
+ "ended with a semicolon.
" +
+ " Operators
" +
+ "The following operators are supported by Netscript:
" +
+ " +
" +
+ " -
" +
+ " *
" +
+ " /
" +
+ " %
" +
+ " &&
" +
+ " ||
" +
+ " <
" +
+ " >
" +
+ " <=
" +
+ " >=
" +
+ " ==
" +
+ " !=
" +
+ " Functions
" +
+ "You can NOT define you own functions in Netscript (yet), but there are several built in functions that " +
+ "you may use:
" +
+ "hack(hostname/ip)
Core function that is used to hack servers to steal money and gain hacking experience. The argument passed in must be a string with " +
+ "either the IP or hostname of the server you want to hack.
Examples: hack('foodnstuff'); or hack('148.192.0.12');
" +
+ "sleep(n)
Suspends the script for n milliseconds.
Example: sleep(5000);
" +
+ "grow(hostname/ip)
Use your hacking skills to increase the amount of money available on a server. The argument passed in " +
+ "must be a string with either the IP or hostname of the target server.
Example: grow('foodnstuff');
" +
+ "While loop
" +
+ "A while loop is a control flow statement that repeatedly executes code as long as a condition is met.
" +
+ "while ([cond]) {
[code]
}
" +
+ "As long as [cond] remains true, the code block [code] will continuously execute. Example:
" +
+ "i = 0;
while (i < 10) {
hack('foodnstuff');
i = i + 1;
};
" +
+ "Note that a semicolon is needed at closing bracket of the while loop, UNLESS it is at the end of the code
" +
+ "For loop
" +
+ "A for loop is another control flow statement that allows code to by repeated by iterations. The structure is:
" +
+ "for ([init]; [cond]; [post]) {
code
}
" +
+ "The [init] expression evaluates before the for loop begins. The for loop will continue to execute " +
+ "as long as [cond] is met. The [post] expression will evaluate at the end of every iteration " +
+ "of the for loop. The following example shows code that will do the same thing as the while loop example above, " +
+ "except using a for loop instead:
" +
+ "for (i = 0; i < 10; i = i+1) {
hack('foodnstuff');
};
",
+
+ TutorialTravelingText:"There are six major cities in the world that you are able to travel to:
" +
" Aevum
" +
" Chongqing
" +
" Sector-12
" +
" New Tokyo
" +
" Ishima
" +
- " Volhaven
" +
+ " Volhaven
" +
"To travel between cities, visit your current city's travel agency through the 'World' page. " +
"From the travel agency you can travel to any other city. Doing so costs money.
" +
"Each city has its own set of companies and unique locations. ",
diff --git a/src/Netscript/Evaluator.js b/src/Netscript/Evaluator.js
index d619d3a73..1af0897ff 100644
--- a/src/Netscript/Evaluator.js
+++ b/src/Netscript/Evaluator.js
@@ -55,7 +55,7 @@ function evaluate(exp, workerScript) {
} catch (e) {
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|" + e.toString());
}
- resolve("assignFinished");
+ resolve(false);
}, function(e) {
reject(e);
});
@@ -244,6 +244,7 @@ function evaluate(exp, workerScript) {
var expGainedOnSuccess = scriptCalculateExpGain(server);
var expGainedOnFailure = (expGainedOnSuccess / 4);
if (rand < hackChance) { //Success!
+ if (env.stopFlag) {reject(workerScript); return;}
var moneyGained = scriptCalculatePercentMoneyHacked(server);
moneyGained = Math.floor(server.moneyAvailable * moneyGained);
@@ -259,7 +260,8 @@ function evaluate(exp, workerScript) {
console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
resolve("Hack success");
- } else {
+ } else {
+ if (env.stopFlag) {reject(workerScript); return;}
//Player only gains 25% exp for failure? TODO Can change this later to balance
Player.gainHackingExp(expGainedOnFailure);
workerScript.scriptRef.onlineExpGained += expGainedOnFailure;
@@ -359,7 +361,6 @@ function evaluate(exp, workerScript) {
workerScript.scriptRef.log("Calling grow() on server " + server.hostname + " in 120 seconds");
var p = new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
- console.log("Executing grow on " + server.hostname + " in 2 minutes ");
setTimeout(function() {
var growthPercentage = processSingleServerGrowth(server, 450);
resolve(growthPercentage);
diff --git a/src/Player.js b/src/Player.js
index 4a9e3d80c..1da5cfd28 100644
--- a/src/Player.js
+++ b/src/Player.js
@@ -641,7 +641,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." +
- "You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "
" +
+ " You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "
" +
"You have earned:
" +
"$" + formatNumber(this.workMoneyGained, 2) + " (" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)
" +
formatNumber(this.workRepGained, 4) + " (" + formatNumber(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this faction
" +
diff --git a/src/Prestige.js b/src/Prestige.js
index 8c9911fd1..7813dc1c2 100644
--- a/src/Prestige.js
+++ b/src/Prestige.js
@@ -53,7 +53,7 @@ function prestigeAugmentation() {
Player.agility_exp = 0;
Player.charisma_exp = 0;
- Player.money = 0;
+ Player.money = 1000;
Player.homeComputer = "";
diff --git a/src/engine.js b/src/engine.js
index 796e89ebe..c092c877d 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -22,6 +22,7 @@ var Engine = {
tutorialNetworkingButton: null,
tutorialHackingButton: null,
tutorialScriptsButton: null,
+ tutorialNetscriptButton: null,
tutorialTravelingButton: null,
tutorialJobsButton: null,
tutorialFactionsButton: null,
@@ -270,7 +271,7 @@ var Engine = {
'Salary multiplier: ' + formatNumber(Player.work_money_mult * 100, 2) + '%
' +
'Misc
' +
'Servers owned: ' + Player.purchasedServers.length + '
' +
- 'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '
').replace( / /g, " " );
+ 'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '
').replace( / /g, " " );
},
@@ -470,6 +471,7 @@ var Engine = {
Engine.Clickables.tutorialNetworkingButton.style.display = "block";
Engine.Clickables.tutorialHackingButton.style.display = "block";
Engine.Clickables.tutorialScriptsButton.style.display = "block";
+ Engine.Clickables.tutorialNetscriptButton.style.display = "block";
Engine.Clickables.tutorialTravelingButton.style.display = "block";
Engine.Clickables.tutorialJobsButton.style.display = "block";
Engine.Clickables.tutorialFactionsButton.style.display = "block";
@@ -485,6 +487,7 @@ var Engine = {
Engine.Clickables.tutorialNetworkingButton.style.display = "none";
Engine.Clickables.tutorialHackingButton.style.display = "none";
Engine.Clickables.tutorialScriptsButton.style.display = "none";
+ Engine.Clickables.tutorialNetscriptButton.style.display = "none";
Engine.Clickables.tutorialTravelingButton.style.display = "none";
Engine.Clickables.tutorialJobsButton.style.display = "none";
Engine.Clickables.tutorialFactionsButton.style.display = "none";
@@ -810,6 +813,11 @@ var Engine = {
Engine.displayTutorialPage(CONSTANTS.TutorialScriptsText);
});
+ Engine.Clickables.tutorialNetscriptButton = document.getElementById("tutorial-netscript-link");
+ Engine.Clickables.tutorialNetscriptButton.addEventListener("click", function() {
+ Engine.displayTutorialPage(CONSTANTS.TutorialNetscriptText);
+ });
+
Engine.Clickables.tutorialTravelingButton = document.getElementById("tutorial-traveling-link");
Engine.Clickables.tutorialTravelingButton.addEventListener("click", function() {
Engine.displayTutorialPage(CONSTANTS.TutorialTravelingText);