v0.34.5. Also adding webpack config and package-lock.json

This commit is contained in:
danielyxie
2018-02-24 16:55:06 -06:00
parent 85ccb294dd
commit 779ce25ae5
49 changed files with 5537 additions and 1475 deletions
+1
View File
@@ -23,3 +23,4 @@ to reach out to the developer!
Hacknet Node API <netscripthacknetnodeapi>
Trade Information eXchange (TIX) API <netscriptixapi>
Singularity Functions <netscriptsingularityfunctions>
Miscellaneous <netscriptmisc>
+61 -14
View File
@@ -12,7 +12,7 @@ hack
.. js:function:: hack(hostname/ip)
:param string hostname/ip: IP or hostname of the target server to hack
:returns: True if the hack is successful, false otherwise
:returns: The amount of money stolen if the hack is successful, and zero otherwise
Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends
on your hacking level and the target server's security level. In order to hack a server you must first gain root access
@@ -72,10 +72,9 @@ weaken
sleep
^^^^^
.. js:function:: sleep(n[, log=true])
.. js:function:: sleep(n)
:param number n: Number of milliseconds to sleep
:param boolean log: Optional boolean specifying whether or not to log the action
Suspends the script for n milliseconds.
@@ -97,6 +96,39 @@ tprint
Prints a value or a variable to the Terminal
clearLog
^^^^^^^^
.. js:function:: clearLog()
Clears the script's logs
disableLog
^^^^^^^^^^
.. js:function:: disableLog(fn)
:param string fn: Name of function for which to disable logging
Disables logging for the given function. Logging can be disabled for
all functions by passing 'ALL' as the argument.
Note that this does not completely remove all logging functionality.
This only stops a function from logging
when the function is successful. If the function fails, it will still log the reason for failure.
Notable functions that cannot have their logs disabled: run, exec, exit
enableLog
^^^^^^^^^
.. js:function:: enableLog(fn)
:param string fn: Name of function for which to enable logging
Re-enables logging for the given function. If 'ALL' is passed into this function
as an argument, then it will revert the effects of disableLog('ALL')
scan
^^^^
@@ -304,7 +336,8 @@ killall
:param string hostname/ip: IP or hostname of the server on which to kill all scripts
Kills all running scripts on the specified server. This function will always return true.
Kills all running scripts on the specified server. This function returns true if any scripts were killed, and
false otherwise. In other words, it will return true if there are any scripts running on the target server.
exit
@@ -346,9 +379,10 @@ scp
ls
^^
.. js:function:: ls(hostname/ip)
.. js:function:: ls(hostname/ip, [grep])
:param string hostname/ip: Hostname or IP of the target server
:param string grep: a substring to search for in the filename
Returns an array with the filenames of all files on the specified server (as strings). The returned array
is sorted in alphabetic order
@@ -639,15 +673,6 @@ getPurchasedServers
Returns an array with either the hostnames or IPs of all of the servers you have purchased.
round
^^^^^
.. js:function:: round(n)
:param number n: Number to round
Returns the argument *n* rounded to the nearest integer. If the argument passed in is not a number, then the function will return 0.
write
^^^^^
@@ -684,6 +709,18 @@ read
If the argument *port/fn* is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If
the text file does not exist, an empty string will be returned.
peek
^^^^
.. js:function:: peek(port)
:param number port: Port to peek. Must be an integer between 1 and 10
This function is used to peek at the data from a port. It returns the first element in the specified port
without removing that element. If the port is empty, the string "NULL PORT DATA" will be returned.
Read about how `Netscript Ports work here <http://bitburner.wikia.com/wiki/Netscript_Ports>`_.
clear
^^^^^
@@ -697,6 +734,16 @@ clear
If the *port/fn* argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.
rm
^^
.. js:function:: rm(fn)
:param string fn: Filename of file to remove. Must include the extension
:returns: True if it successfully deletes the file, and false otherwise
Removes the specified file from the current server. This function works for every file type except message (.msg) files.
scriptRunning
^^^^^^^^^^^^^
@@ -2,9 +2,6 @@ Netscript Loops and Conditionals
================================
Loops and Conditionals
----------------------
Netscript loops and conditionals are the same as Javascript. However, the one caveat is that when declaring variables such as the
iterator for traversing a loop, you should not use the 'var' or 'let' keyword. For reference, you can see the Javascript
documentation for loops/conditionals here:
+37
View File
@@ -0,0 +1,37 @@
Netscript Miscellaneous
=======================
Comments
--------
Netscript supports comments using the same syntax as `Javascript comments <https://www.w3schools.com/js/js_comments.asp>`_.
Comments are not evaluated as code, and can be used to document and/or explain code::
//This is a comment and will not get executed even though its in the code
/* Multi
* line
* comment */
print("This code will actually get executed");
Javascript Math Module
----------------------
The `Javascript Math Module <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math>`_ is
supported in Netscript and is used in the same way::
numThreads = Math.floor(getServerRam("foodnstuff")[1] / 3.4);
Javascript Date Module
----------------------
The `Javascript Date Module <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date>`_ is supported in Netscript.
However, since the 'new' operator does not work in Netscript, only the Date module's static functions can be used:
* now()
* UTC()
* Parse()
* Maybe some others I don't know about
Example::
time = Date.now();
+14 -4
View File
@@ -102,6 +102,8 @@
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#clear">clear() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#clearLog">clearLog() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#createProgram">createProgram() (built-in function)</a>
</li>
@@ -112,6 +114,10 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#deleteServer">deleteServer() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#disableLog">disableLog() (built-in function)</a>
</li>
</ul></td>
</tr></table>
@@ -119,10 +125,12 @@
<h2 id="E">E</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#exec">exec() (built-in function)</a>
<li><a href="netscriptfunctions.html#enableLog">enableLog() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#exec">exec() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#exit">exit() (built-in function)</a>
</li>
</ul></td>
@@ -317,16 +325,18 @@
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#peek">peek() (built-in function)</a>
</li>
<li><a href="netscriptixapi.html#placeOrder">placeOrder() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#print">print() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#prompt">prompt() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#purchaseAugmentation">purchaseAugmentation() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptsingularityfunctions.html#purchaseAugmentation">purchaseAugmentation() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#purchaseHacknetNode">purchaseHacknetNode() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#purchaseProgram">purchaseProgram() (built-in function)</a>
@@ -347,7 +357,7 @@
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#round">round() (built-in function)</a>
<li><a href="netscriptfunctions.html#rm">rm() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#run">run() (built-in function)</a>
</li>
+12 -5
View File
@@ -75,10 +75,7 @@ secrets that you've been searching for.</p>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a><ul>
<li class="toctree-l3"><a class="reference internal" href="netscriptloopsandconditionals.html#loops-and-conditionals">Loops and Conditionals</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a><ul>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#hack">hack</a></li>
@@ -87,6 +84,9 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#sleep">sleep</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#print">print</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#tprint">tprint</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#clearlog">clearLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#disablelog">disableLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#enablelog">enableLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#scan">scan</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#nuke">nuke</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#brutessh">brutessh</a></li>
@@ -123,10 +123,11 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#purchaseserver">purchaseServer</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#deleteserver">deleteServer</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#getpurchasedservers">getPurchasedServers</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#round">round</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#write">write</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#read">read</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#peek">peek</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#clear">clear</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#rm">rm</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#scriptrunning">scriptRunning</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#scriptkill">scriptKill</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#getscriptram">getScriptRam</a></li>
@@ -194,6 +195,12 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#javascript-math-module">Javascript Math Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#javascript-date-module">Javascript Date Module</a></li>
</ul>
</li>
</ul>
</li>
</ul>
+13 -5
View File
@@ -76,10 +76,7 @@ to reach out to the developer!</p>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a><ul>
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html#loops-and-conditionals">Loops and Conditionals</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a></li>
<li class="toctree-l1"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
<li class="toctree-l1"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#hack">hack</a></li>
@@ -88,6 +85,9 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#sleep">sleep</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#print">print</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#tprint">tprint</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#clearlog">clearLog</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#disablelog">disableLog</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#enablelog">enableLog</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#scan">scan</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#nuke">nuke</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#brutessh">brutessh</a></li>
@@ -124,10 +124,11 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#purchaseserver">purchaseServer</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#deleteserver">deleteServer</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#getpurchasedservers">getPurchasedServers</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#round">round</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#write">write</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#read">read</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#peek">peek</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#clear">clear</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#rm">rm</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#scriptrunning">scriptRunning</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#scriptkill">scriptKill</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#getscriptram">getScriptRam</a></li>
@@ -195,6 +196,12 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#javascript-math-module">Javascript Math Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#javascript-date-module">Javascript Date Module</a></li>
</ul>
</li>
</ul>
</div>
</div>
@@ -218,6 +225,7 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>
</ul>
+112 -26
View File
@@ -70,7 +70,7 @@ This includes information such as function signatures, what they do, and their r
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if the hack is successful, false otherwise</p>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The amount of money stolen if the hack is successful, and zero otherwise</p>
</td>
</tr>
</tbody>
@@ -158,14 +158,13 @@ root access to the target server, but there is no required hacking level to run
<h2>sleep<a class="headerlink" href="#sleep" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">sleep</code><span class="sig-paren">(</span><em>n</em><span class="optional">[</span>, <em>log=true</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<code class="descname">sleep</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>n</strong> (<em>number</em>) -- Number of milliseconds to sleep</li>
<li><strong>log</strong> (<em>boolean</em>) -- Optional boolean specifying whether or not to log the action</li>
</ul>
</td>
</tr>
@@ -214,6 +213,61 @@ root access to the target server, but there is no required hacking level to run
<p>Prints a value or a variable to the Terminal</p>
</dd></dl>
</div>
<div class="section" id="clearlog">
<h2>clearLog<a class="headerlink" href="#clearlog" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="clearLog">
<code class="descname">clearLog</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#clearLog" title="Permalink to this definition"></a></dt>
<dd><p>Clears the script's logs</p>
</dd></dl>
</div>
<div class="section" id="disablelog">
<h2>disableLog<a class="headerlink" href="#disablelog" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="disableLog">
<code class="descname">disableLog</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span><a class="headerlink" href="#disableLog" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>fn</strong> (<em>string</em>) -- Name of function for which to disable logging</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Disables logging for the given function. Logging can be disabled for
all functions by passing 'ALL' as the argument.</p>
<p>Note that this does not completely remove all logging functionality.
This only stops a function from logging
when the function is successful. If the function fails, it will still log the reason for failure.</p>
<p>Notable functions that cannot have their logs disabled: run, exec, exit</p>
</dd></dl>
</div>
<div class="section" id="enablelog">
<h2>enableLog<a class="headerlink" href="#enablelog" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="enableLog">
<code class="descname">enableLog</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span><a class="headerlink" href="#enableLog" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>fn</strong> (<em>string</em>) -- Name of function for which to enable logging</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Re-enables logging for the given function. If 'ALL' is passed into this function
as an argument, then it will revert the effects of disableLog('ALL')</p>
</dd></dl>
</div>
<div class="section" id="scan">
<h2>scan<a class="headerlink" href="#scan" title="Permalink to this headline"></a></h2>
@@ -544,7 +598,8 @@ is not the same as <em>foo.script</em> run with the argument 2, even though they
</tr>
</tbody>
</table>
<p>Kills all running scripts on the specified server. This function will always return true.</p>
<p>Kills all running scripts on the specified server. This function returns true if any scripts were killed, and
false otherwise. In other words, it will return true if there are any scripts running on the target server.</p>
</dd></dl>
</div>
@@ -599,13 +654,14 @@ then this function will return true if at least one of the files in the array is
<h2>ls<a class="headerlink" href="#ls" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">ls</code><span class="sig-paren">(</span><em>hostname/ip</em><span class="sig-paren">)</span></dt>
<code class="descname">ls</code><span class="sig-paren">(</span><em>hostname/ip</em><span class="optional">[</span>, <em>grep</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of the target server</li>
<li><strong>grep</strong> (<em>string</em>) -- a substring to search for in the filename</li>
</ul>
</td>
</tr>
@@ -1078,26 +1134,6 @@ then IPs will be returned. If this argument is omitted then it is true by defaul
<p>Returns an array with either the hostnames or IPs of all of the servers you have purchased.</p>
</dd></dl>
</div>
<div class="section" id="round">
<h2>round<a class="headerlink" href="#round" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">round</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>n</strong> (<em>number</em>) -- Number to round</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the argument <em>n</em> rounded to the nearest integer. If the argument passed in is not a number, then the function will return 0.</p>
</dd></dl>
</div>
<div class="section" id="write">
<h2>write<a class="headerlink" href="#write" title="Permalink to this headline"></a></h2>
@@ -1152,6 +1188,28 @@ will remove the first element from that queue and return it. If the queue is emp
the text file does not exist, an empty string will be returned.</p>
</dd></dl>
</div>
<div class="section" id="peek">
<h2>peek<a class="headerlink" href="#peek" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">peek</code><span class="sig-paren">(</span><em>port</em><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>port</strong> (<em>number</em>) -- Port to peek. Must be an integer between 1 and 10</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function is used to peek at the data from a port. It returns the first element in the specified port
without removing that element. If the port is empty, the string &quot;NULL PORT DATA&quot; will be returned.</p>
<p>Read about how <a class="reference external" href="http://bitburner.wikia.com/wiki/Netscript_Ports">Netscript Ports work here</a>.</p>
</dd></dl>
</div>
<div class="section" id="clear">
<h2>clear<a class="headerlink" href="#clear" title="Permalink to this headline"></a></h2>
@@ -1174,6 +1232,29 @@ the text file does not exist, an empty string will be returned.</p>
<p>If the <em>port/fn</em> argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.</p>
</dd></dl>
</div>
<div class="section" id="rm">
<h2>rm<a class="headerlink" href="#rm" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">rm</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>fn</strong> (<em>string</em>) -- Filename of file to remove. Must include the extension</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if it successfully deletes the file, and false otherwise</p>
</td>
</tr>
</tbody>
</table>
<p>Removes the specified file from the current server. This function works for every file type except message (.msg) files.</p>
</dd></dl>
</div>
<div class="section" id="scriptrunning">
<h2>scriptRunning<a class="headerlink" href="#scriptrunning" title="Permalink to this headline"></a></h2>
@@ -1505,6 +1586,9 @@ you create in functions such as <a class="reference external" href="https://deve
<li class="toctree-l3"><a class="reference internal" href="#sleep">sleep</a></li>
<li class="toctree-l3"><a class="reference internal" href="#print">print</a></li>
<li class="toctree-l3"><a class="reference internal" href="#tprint">tprint</a></li>
<li class="toctree-l3"><a class="reference internal" href="#clearlog">clearLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="#disablelog">disableLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="#enablelog">enableLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="#scan">scan</a></li>
<li class="toctree-l3"><a class="reference internal" href="#nuke">nuke</a></li>
<li class="toctree-l3"><a class="reference internal" href="#brutessh">brutessh</a></li>
@@ -1541,10 +1625,11 @@ you create in functions such as <a class="reference external" href="https://deve
<li class="toctree-l3"><a class="reference internal" href="#purchaseserver">purchaseServer</a></li>
<li class="toctree-l3"><a class="reference internal" href="#deleteserver">deleteServer</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getpurchasedservers">getPurchasedServers</a></li>
<li class="toctree-l3"><a class="reference internal" href="#round">round</a></li>
<li class="toctree-l3"><a class="reference internal" href="#write">write</a></li>
<li class="toctree-l3"><a class="reference internal" href="#read">read</a></li>
<li class="toctree-l3"><a class="reference internal" href="#peek">peek</a></li>
<li class="toctree-l3"><a class="reference internal" href="#clear">clear</a></li>
<li class="toctree-l3"><a class="reference internal" href="#rm">rm</a></li>
<li class="toctree-l3"><a class="reference internal" href="#scriptrunning">scriptRunning</a></li>
<li class="toctree-l3"><a class="reference internal" href="#scriptkill">scriptKill</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getscriptram">getScriptRam</a></li>
@@ -1566,6 +1651,7 @@ you create in functions such as <a class="reference external" href="https://deve
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>
</ul>
+2 -7
View File
@@ -53,8 +53,6 @@
<div class="section" id="netscript-loops-and-conditionals">
<h1>Netscript Loops and Conditionals<a class="headerlink" href="#netscript-loops-and-conditionals" title="Permalink to this headline"></a></h1>
<div class="section" id="loops-and-conditionals">
<h2>Loops and Conditionals<a class="headerlink" href="#loops-and-conditionals" title="Permalink to this headline"></a></h2>
<p>Netscript loops and conditionals are the same as Javascript. However, the one caveat is that when declaring variables such as the
iterator for traversing a loop, you should not use the 'var' or 'let' keyword. For reference, you can see the Javascript
documentation for loops/conditionals here:</p>
@@ -86,7 +84,6 @@ Otherwise, the money available on the server will be grown using the grow() Nets
<span class="p">}</span>
</pre></div>
</div>
</div>
</div>
@@ -101,16 +98,14 @@ Otherwise, the money available on the server will be grown using the grow() Nets
<li class="toctree-l1 current"><a class="reference internal" href="netscript.html"> Netscript</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="netscriptdatatypes.html"> Data Types and Variables</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptoperators.html"> Operators</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"> Loops and Conditionals</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#loops-and-conditionals">Loops and Conditionals</a></li>
</ul>
</li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"> Loops and Conditionals</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptadvancedfunctions.html"> Advanced Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>
</ul>
+161
View File
@@ -0,0 +1,161 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="English">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Netscript Miscellaneous &#8212; Bitburner 1.0 documentation</title>
<link rel="stylesheet" href="_static/agogo.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Netscript Singularity Functions" href="netscriptsingularityfunctions.html" />
</head>
<body>
<div class="header-wrapper" role="banner">
<div class="header">
<div class="headertitle"><a
href="index.html">Bitburner 1.0 documentation</a></div>
<div class="rel" role="navigation" aria-label="related navigation">
<a href="netscriptsingularityfunctions.html" title="Netscript Singularity Functions"
accesskey="P">previous</a> |
<a href="genindex.html" title="General Index"
accesskey="I">index</a>
</div>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="netscript-miscellaneous">
<h1>Netscript Miscellaneous<a class="headerlink" href="#netscript-miscellaneous" title="Permalink to this headline"></a></h1>
<div class="section" id="comments">
<h2>Comments<a class="headerlink" href="#comments" title="Permalink to this headline"></a></h2>
<p>Netscript supports comments using the same syntax as <a class="reference external" href="https://www.w3schools.com/js/js_comments.asp">Javascript comments</a>.
Comments are not evaluated as code, and can be used to document and/or explain code:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">//</span><span class="n">This</span> <span class="ow">is</span> <span class="n">a</span> <span class="n">comment</span> <span class="ow">and</span> <span class="n">will</span> <span class="ow">not</span> <span class="n">get</span> <span class="n">executed</span> <span class="n">even</span> <span class="n">though</span> <span class="n">its</span> <span class="ow">in</span> <span class="n">the</span> <span class="n">code</span>
<span class="o">/*</span> <span class="n">Multi</span>
<span class="o">*</span> <span class="n">line</span>
<span class="o">*</span> <span class="n">comment</span> <span class="o">*/</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;This code will actually get executed&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="javascript-math-module">
<h2>Javascript Math Module<a class="headerlink" href="#javascript-math-module" title="Permalink to this headline"></a></h2>
<p>The <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math">Javascript Math Module</a> is
supported in Netscript and is used in the same way:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">numThreads</span> <span class="o">=</span> <span class="n">Math</span><span class="o">.</span><span class="n">floor</span><span class="p">(</span><span class="n">getServerRam</span><span class="p">(</span><span class="s2">&quot;foodnstuff&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="mf">3.4</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="javascript-date-module">
<h2>Javascript Date Module<a class="headerlink" href="#javascript-date-module" title="Permalink to this headline"></a></h2>
<p>The <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date">Javascript Date Module</a> is supported in Netscript.
However, since the 'new' operator does not work in Netscript, only the Date module's static functions can be used:</p>
<ul class="simple">
<li>now()</li>
<li>UTC()</li>
<li>Parse()</li>
<li>Maybe some others I don't know about</li>
</ul>
<p>Example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">time</span> <span class="o">=</span> <span class="n">Date</span><span class="o">.</span><span class="n">now</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sidebar">
<h3>Table Of Contents</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="netscript.html"> Netscript</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="netscriptdatatypes.html"> Data Types and Variables</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptoperators.html"> Operators</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptadvancedfunctions.html"> Advanced Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"> Miscellaneous</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#comments">Comments</a></li>
<li class="toctree-l3"><a class="reference internal" href="#javascript-math-module">Javascript Math Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#javascript-date-module">Javascript Date Module</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<div role="search">
<h3 style="margin-top: 1.5em;">Search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
<div class="footer-wrapper">
<div class="footer">
<div class="left">
<div role="navigation" aria-label="related navigaton">
<a href="netscriptsingularityfunctions.html" title="Netscript Singularity Functions"
>previous</a> |
<a href="genindex.html" title="General Index"
>index</a>
</div>
<div role="note" aria-label="source link">
<br/>
<a href="_sources/netscriptmisc.rst.txt"
rel="nofollow">Show Source</a>
</div>
</div>
<div class="right">
<div class="footer" role="contentinfo">
&#169; Copyright 2017, Bitburner.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.4.
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</body>
</html>
+6
View File
@@ -24,6 +24,7 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Netscript Miscellaneous" href="netscriptmisc.html" />
<link rel="prev" title="Netscript Trade Information eXchange (TIX) API" href="netscriptixapi.html" />
</head>
<body>
@@ -34,6 +35,8 @@
<div class="rel" role="navigation" aria-label="related navigation">
<a href="netscriptixapi.html" title="Netscript Trade Information eXchange (TIX) API"
accesskey="P">previous</a> |
<a href="netscriptmisc.html" title="Netscript Miscellaneous"
accesskey="N">next</a> |
<a href="genindex.html" title="General Index"
accesskey="I">index</a>
</div>
@@ -696,6 +699,7 @@ This script will be run with no arguments and 1 thread. It must be located on yo
<li class="toctree-l3"><a class="reference internal" href="#installaugmentations">installAugmentations</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>
</ul>
@@ -720,6 +724,8 @@ This script will be run with no arguments and 1 thread. It must be located on yo
<div role="navigation" aria-label="related navigaton">
<a href="netscriptixapi.html" title="Netscript Trade Information eXchange (TIX) API"
>previous</a> |
<a href="netscriptmisc.html" title="Netscript Miscellaneous"
>next</a> |
<a href="genindex.html" title="General Index"
>index</a>
</div>
BIN
View File
Binary file not shown.
+1 -1
View File
File diff suppressed because one or more lines are too long