Small UI changes, adding RAM cost for new script commands.

This commit is contained in:
Daniel Xie 2017-05-20 22:45:36 -05:00
parent 4d0ee212be
commit 9e2344919f
8 changed files with 58 additions and 27 deletions

@ -35,11 +35,5 @@ Tasks TODO:
Private beta feedback
I'd suggest putting a "Back" button in the tutorial
window,
6) - Maybe show total $ somewhere onscreen at all (or most) times. $/sec would also be good to know, depending on if you want the player to know that. Bottom of the menu on the left is an empty enough place to keep these.
Donate to faction for reputatino
Quick overview screen
test for open beta

@ -1,14 +1,17 @@
/* interactivetutorial.css */
#interactive-tutorial-wrapper {
position:relative;
}
#interactive-tutorial-container {
display: none;
position: fixed; /* Stay in place */
position: absolute; /* Stay in place */
right: 0;
top: 0;
height: 100%; /* Full height */
margin: 30% auto;
height: 400px; /* Full height */
padding: 10px;
border: 5px solid #FFFFFF;
width: 35%;
width: 25%;
overflow: auto; /* Enable scroll if needed */
background-color: #444; /* Fallback color */
color: white;

@ -39,7 +39,7 @@
#script-editor-save-and-close-button,
#script-editor-netscript-doc-button {
float: right;
display: inline-block;
display: block;
width: 50%;
margin-right: 25%;
}
@ -56,7 +56,7 @@
float: left;
resize: none;
color: #66ff33;
width: 75%;
width: 70%;
margin: 10px;
padding: 5px;
@ -79,7 +79,7 @@
#script-editor-text {
color: #66ff33;
width: 75%;
width: 70%;
height: 100%;
margin: 10px;
padding: 5px;
@ -112,7 +112,7 @@
}
#active-scripts-text {
width: 80%;
width: 70%;
margin: 6px;
padding: 4px;
}
@ -155,7 +155,7 @@
#hacknet-nodes-text,
#hacknet-nodes-money {
width: 80%;
width: 70%;
margin: 10px;
padding: 10px;
}
@ -224,7 +224,7 @@
}
#create-program-page-text {
width: 80%;
width: 70%;
}
.create-program-a-link-button {
@ -392,7 +392,7 @@ div.faction-clear {
}
#tutorial-text {
width: 80%;
width: 70%;
margin: 10px;
}

@ -214,26 +214,37 @@ tr:focus {
position:fixed;
top:0px;
-webkit-animation:status-text 3s 1;
background-color: transparent;
}
#status-text-container {
background-color: transparent;
}
#status-text {
font-size: 20px;
color: #FFFFFF;
right: 0;
bottom: 0;
bottom: 0;
padding: 4px;
background-color: transparent;
z-index: 2;
}
/* Character Overview */
#character-overview-wrapper {
position: relative;
}
#character-overview-container {
display: none;
position: fixed; /* Stay in place */
position: absolute; /* Stay in place */
right: 0;
top: 0;
height: 100%; /* Full height */
margin: 45% auto;
height: 250px; /* Full height */
/*margin: 50% auto;*/
padding: 5px;
border: 2px solid #66ff33;
width: 20%;
width: 18%;
overflow: auto; /* Enable scroll if needed */
background-color: #444; /* Fallback color */
z-index: 1;
@ -241,7 +252,7 @@ tr:focus {
#character-overview-text {
padding: 4px;
margin: 4px;
margin: 12px;
color: white;
background-color: #444;
}

@ -716,17 +716,21 @@
</div>
<!-- Interactive Tutorial Text Screen -->
<div id="interactive-tutorial-wrapper">
<div id="interactive-tutorial-container">
<p id="interactive-tutorial-text"> </p>
<span id="interactive-tutorial-exit"> Exit Tutorial </span>
<span id="interactive-tutorial-next"> Next </span>
<span id="interactive-tutorial-back"> Back </span>
</div>
</div>
<!-- Character Overview Screen -->
<div id="character-overview-wrapper">
<div id="character-overview-container">
<p id="character-overview-text"> </p>
</div>
</div>
<!-- Status text -->
<div id="status-text-container">

@ -48,10 +48,12 @@ CONSTANTS = {
ScriptRelaysmtpRamCost: 0.05,
ScriptHttpwormRamCost: 0.05,
ScriptSqlinjectRamCost: 0.05,
ScriptRunRamCost: 0.75,
ScriptRunRamCost: 0.8,
ScriptGetHackingLevelRamCost: 0.1,
ScriptGetServerMoneyRamCost: 0.1,
ScriptOperatorRamCost: 0.01,
ScriptPurchaseHacknetRamCost: 1.0,
ScriptUpgradeHacknetRamCost: 1.0,
//Server growth rate
ServerGrowthRate: 1.00075,
@ -266,6 +268,19 @@ CONSTANTS = {
"<i>getHackingLevel() </i><br> Returns the Player's current hacking level <br><br> " +
"<i>getServerMoneyAvailable(hostname/ip)</i><br> Returns the amount of money available on a server. The argument passed in must be a string with either the " +
"hostname or IP of the target server. <br> Example: getServerMoneyAvailable('foodnstuff');<br><br>" +
"<i>purchaseHacknetNode()</i><br> Purchases a new Hacknet Node. Returns a string with the name of the new Hacknet Node. If the player cannot afford to purchase " +
"a new hacknet node then the function will return an empty string<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. Example: <br>" +
"var node = purchaseHacknetNode();<br>" +
"if (node != '') {<br>" +
"&nbsp;&nbsp;&nbsp;&nbsp;var 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>" +
"};<br><br>" +
"The example code above will attempt to purchase a new Hacknet Node. If the Hacknet Node is purchased, then it will " +
"continuously try to level it up until it is leveled up 10 times. <br><br>" +
"<u><h1>While loops </h1></u><br>" +
"A while loop is a control flow statement that repeatedly executes code as long as a condition is met. <br><br> " +
"<i>while (<i>[cond]</i>) {<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>[code]</i><br>}</i><br><br>" +

@ -720,7 +720,7 @@ function evaluate(exp, workerScript) {
}
if (cost > Player.money) {
workerScript.scriptRef.log("Could not afford to purchase new Hacknet Node");
resolve(-1);
resolve("");
}
//Auto generate a name for the node for now...TODO
@ -732,7 +732,7 @@ function evaluate(exp, workerScript) {
Player.loseMoney(cost);
Player.hacknetNodes.push(node);
workerScript.scriptRef.log("Purchased new Hacknet Node with name: " + name);
resolve(numOwned);
resolve(name);
}, CONSTANTS.CodeInstructionRunTime);
} else if (exp.func.value == "upgradeHacknetNode") {
if (exp.args.length != 1) {

@ -184,6 +184,8 @@ Script.prototype.updateRamUsage = function() {
var getHackingLevelCount = numOccurrences(codeCopy, "getHackingLevel(");
var getServerMoneyAvailableCount = numOccurrences(codeCopy, "getServerMoneyAvailable(");
var numOperators = numNetscriptOperators(codeCopy);
var purchaseHacknetCount = numOccurrences(codeCopy, "purchaseHacknetNode(");
var upgradeHacknetCount = numOccurrences(codeCopy, "upgradeHacknetNode(");
this.ramUsage = baseRam +
((whileCount * CONSTANTS.ScriptWhileRamCost) +
@ -200,7 +202,9 @@ Script.prototype.updateRamUsage = function() {
(runCount * CONSTANTS.ScriptRunRamCost) +
(getHackingLevelCount * CONSTANTS.ScriptGetHackingLevelRamCost) +
(getServerMoneyAvailableCount * CONSTANTS.ScriptGetServerMoneyRamCost) +
(numOperators * CONSTANTS.ScriptOperatorRamCost));
(numOperators * CONSTANTS.ScriptOperatorRamCost) +
(purchaseHacknetCount * CONSTANTS.ScriptPurchaseHacknetRamCost) +
(upgradeHacknetCount * CONSTANTS.ScriptUpgradeHacknetRamCost));
console.log("ram usage: " + this.ramUsage);
if (isNaN(this.ramUsage)) {
dialogBoxCreate("ERROR in calculating ram usage. This is a bug, please report to game develoepr");