<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first last">The amount of money stolen if the hack is successful, and zero otherwise</p>
<li><strong>hostname/ip</strong> (<em>string</em>) -- IP or hostname of the target server to grow</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first last">The number by which the money on the server was multiplied for the growth</p>
</td>
</tr>
</tbody>
</table>
<p>Use your hacking skills to increase the amount of money available on a server. The runtime for this command depends on your hacking
level and the target server's security level. When grow() completes, the money available on a target server will be increased by a
certain, fixed percentage. This percentage is determined by the target server's growth rate (which varies between servers) and security level.
Generally, higher-level servers have higher growth rates. The getServerGrowth() function can be used to obtain a server's growth rate.</p>
<p>Like hack(), grow() can be called on any server, regardless of where the script is running. The grow() command requires
root access to the target server, but there is no required hacking level to run the command. It also raises the security level
<li><strong>hostname.ip</strong> (<em>string</em>) -- IP or hostname of the target server to weaken</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first last">The amount by which the target server's security level was decreased. This is equivalent to 0.05 multiplied
by the number of script threads</p>
</td>
</tr>
</tbody>
</table>
<p>Use your hacking skills to attack a server's security, lowering the server's security level. The runtime for this command
depends on your hacking level and the target server's security level. This function lowers the security level of the target
server by 0.05.</p>
<p>Like hack() and grow(), weaken() can be called on any server, regardless of where the script is running. This command requires
root access to the target server, but there is no required hacking level to run the command.</p>
<h2>clearLog<aclass="headerlink"href="#clearlog"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="clearLog">
<codeclass="descname">clearLog</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#clearLog"title="Permalink to this definition">¶</a></dt>
<dd><p>Clears the script's logs</p>
</dd></dl>
</div>
<divclass="section"id="disablelog">
<h2>disableLog<aclass="headerlink"href="#disablelog"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="disableLog">
<codeclass="descname">disableLog</code><spanclass="sig-paren">(</span><em>fn</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#disableLog"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="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>
<divclass="section"id="enablelog">
<h2>enableLog<aclass="headerlink"href="#enablelog"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="enableLog">
<codeclass="descname">enableLog</code><spanclass="sig-paren">(</span><em>fn</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#enableLog"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>script</strong> (<em>string</em>) -- Filename of script to run</li>
<li><strong>numThreads</strong> (<em>number</em>) -- Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer</li>
<li><strong>args...</strong> -- Additional arguments to pass into the new script that is being run. Note that if any arguments are being
passed into the new script, then the second argument <em>numThreads</em> must be filled in with a value.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Run a script as a separate process. This function can only be used to run scripts located on the current server (the server
running the script that calls this function).</p>
<p>Returns true if the script is successfully started, and false otherwise. Requires a significant amount of RAM to run this
command.</p>
<p>The simplest way to use the <em>run</em> command is to call it with just the script name. The following example will run
'foo.script' single-threaded with no arguments:</p>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>script</strong> (<em>string</em>) -- Filename of script to execute</li>
<li><strong>hostname/ip</strong> (<em>string</em>) -- IP or hostname of the 'target server' on which to execute the script</li>
<li><strong>numThreads</strong> (<em>number</em>) -- Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer</li>
<li><strong>args...</strong> -- Additional arguments to pass into the new script that is being run. Note that if any arguments are being
passed into the new script, then the third argument <em>numThreads</em> must be filled in with a value.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Run a script as a separate process on a specified server. This is similar to the <em>run</em> function except
that it can be used to run a script on any server, instead of just the current server.</p>
<p>Returns true if the script is successfully started, and false otherwise.</p>
<p>The simplest way to use the <em>exec</em> command is to call it with just the script name and the target server.
The following example will try to run <em>generic-hack.script</em> on the <em>foodnstuff</em> server:</p>
<p>The following will try to kill a script named <em>foo.script</em> on the current server that was ran with the arguments 1 and "foodnstuff":</p>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>files</strong> (<em>string/array</em>) -- Filename or an array of filenames of script/literature files to copy</li>
<li><strong>source</strong> (<em>string</em>) -- Hostname or IP of the source server, which is the server from which the file will be copied.
This argument is optional and if it's omitted the source will be the current server.</li>
<li><strong>destination</strong> (<em>string</em>) -- Hostname or IP of the destination server, which is the server to which the file will be copied.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Copies a script or literature (.lit) file(s) to another server. The <em>files</em> argument can be either a string specifying a
single file to copy, or an array of strings specifying multiple files to copy.</p>
<p>Returns true if the script/literature file is successfully copied over and false otherwise. If the <em>files</em> argument is an array
then this function will return true if at least one of the files in the array is successfully copied.</p>
<h2>hasRootAccess<aclass="headerlink"href="#hasrootaccess"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="hasRootAccess">
<codeclass="descname">hasRootAccess</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#hasRootAccess"title="Permalink to this definition">¶</a></dt>
<h2>getHostname<aclass="headerlink"href="#gethostname"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getHostname">
<codeclass="descname">getHostname</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getHostname"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a string with the hostname of the server that the script is running on</p>
</dd></dl>
</div>
<divclass="section"id="gethackinglevel">
<h2>getHackingLevel<aclass="headerlink"href="#gethackinglevel"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getHackingLevel">
<codeclass="descname">getHackingLevel</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getHackingLevel"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the player's current hacking level</p>
</dd></dl>
</div>
<divclass="section"id="gethackingmultipliers">
<h2>getHackingMultipliers<aclass="headerlink"href="#gethackingmultipliers"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getHackingMultipliers">
<codeclass="descname">getHackingMultipliers</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getHackingMultipliers"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns an object containing the Player's hacking related multipliers. These multipliers are
<h2>getHacknetMultipliers<aclass="headerlink"href="#gethacknetmultipliers"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getHacknetMultipliers">
<codeclass="descname">getHacknetMultipliers</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getHacknetMultipliers"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns an object containing the Player's hacknet related multipliers. These multipliers are
returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). The object has the following structure:</p>
<h2>getServerMoneyAvailable<aclass="headerlink"href="#getservermoneyavailable"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getServerMoneyAvailable">
<codeclass="descname">getServerMoneyAvailable</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getServerMoneyAvailable"title="Permalink to this definition">¶</a></dt>
<h2>getServerMaxMoney<aclass="headerlink"href="#getservermaxmoney"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getServerMaxMoney">
<codeclass="descname">getServerMaxMoney</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getServerMaxMoney"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of target server</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the maximum amount of money that can be available on a server</p>
</dd></dl>
</div>
<divclass="section"id="getservergrowth">
<h2>getServerGrowth<aclass="headerlink"href="#getservergrowth"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getServerGrowth">
<codeclass="descname">getServerGrowth</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getServerGrowth"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of target server</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the server's instrinsic "growth parameter". This growth parameter is a number
between 1 and 100 that represents how quickly the server's money grows. This parameter affects the
percentage by which the server's money is increased when using the <em>grow()</em> function. A higher
growth parameter will result in a higher percentage increase from <em>grow()</em>.</p>
</dd></dl>
</div>
<divclass="section"id="getserversecuritylevel">
<h2>getServerSecurityLevel<aclass="headerlink"href="#getserversecuritylevel"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getServerSecurityLevel">
<codeclass="descname">getServerSecurityLevel</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getServerSecurityLevel"title="Permalink to this definition">¶</a></dt>
<h2>getServerBaseSecurityLevel<aclass="headerlink"href="#getserverbasesecuritylevel"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getServerBaseSecurityLevel">
<codeclass="descname">getServerBaseSecurityLevel</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getServerBaseSecurityLevel"title="Permalink to this definition">¶</a></dt>
<h2>getServerMinSecurityLevel<aclass="headerlink"href="#getserverminsecuritylevel"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getServerMinSecurityLevel">
<codeclass="descname">getServerMinSecurityLevel</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getServerMinSecurityLevel"title="Permalink to this definition">¶</a></dt>
<h2>getServerRequiredHackingLevel<aclass="headerlink"href="#getserverrequiredhackinglevel"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getServerRequiredHackingLevel">
<codeclass="descname">getServerRequiredHackingLevel</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getServerRequiredHackingLevel"title="Permalink to this definition">¶</a></dt>
<h2>getServerNumPortsRequired<aclass="headerlink"href="#getservernumportsrequired"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getServerNumPortsRequired">
<codeclass="descname">getServerNumPortsRequired</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getServerNumPortsRequired"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of target server</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the number of open ports required to successfully run NUKE.exe on the specified server.</p>
</dd></dl>
</div>
<divclass="section"id="getserverram">
<h2>getServerRam<aclass="headerlink"href="#getserverram"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getServerRam">
<codeclass="descname">getServerRam</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getServerRam"title="Permalink to this definition">¶</a></dt>
<h2>serverExists<aclass="headerlink"href="#serverexists"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="serverExists">
<codeclass="descname">serverExists</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#serverExists"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of target server</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns a boolean denoting whether or not the specified server exists</p>
</dd></dl>
</div>
<divclass="section"id="fileexists">
<h2>fileExists<aclass="headerlink"href="#fileexists"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="fileExists">
<codeclass="descname">fileExists</code><spanclass="sig-paren">(</span><em>filename</em><spanclass="optional">[</span>, <em>hostname/ip</em><spanclass="optional">]</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#fileExists"title="Permalink to this definition">¶</a></dt>
<p>The first example above will return true if the script named <em>foo.script</em> exists on the <em>foodnstuff</em> server, and false otherwise.
The second example above will return true if the current server contains the <em>FTPCrack.exe</em> program, and false otherwise.</p>
</dd></dl>
</div>
<divclass="section"id="isrunning">
<h2>isRunning<aclass="headerlink"href="#isrunning"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="isRunning">
<codeclass="descname">isRunning</code><spanclass="sig-paren">(</span><em>filename</em>, <em>hostname/ip</em><spanclass="optional">[</span>, <em>args...</em><spanclass="optional">]</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#isRunning"title="Permalink to this definition">¶</a></dt>
<h2>getNextHacknetNodeCost<aclass="headerlink"href="#getnexthacknetnodecost"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getNextHacknetNodeCost">
<codeclass="descname">getNextHacknetNodeCost</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getNextHacknetNodeCost"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the cost of purchasing a new Hacknet Node</p>
</dd></dl>
</div>
<divclass="section"id="purchasehacknetnode">
<h2>purchaseHacknetNode<aclass="headerlink"href="#purchasehacknetnode"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="purchaseHacknetNode">
<codeclass="descname">purchaseHacknetNode</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#purchaseHacknetNode"title="Permalink to this definition">¶</a></dt>
<dd><p>Purchases a new Hacknet Node. Returns a number with the index of the Hacknet Node. This index is equivalent to the number at the
end of the Hacknet Node's name (e.g The Hacknet Node named 'hacknet-node-4' will have an index of 4). If the player cannot afford
to purchase a new Hacknet Node then the function will return false.</p>
</dd></dl>
</div>
<divclass="section"id="purchaseserver">
<h2>purchaseServer<aclass="headerlink"href="#purchaseserver"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="purchaseServer">
<codeclass="descname">purchaseServer</code><spanclass="sig-paren">(</span><em>hostname</em>, <em>ram</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#purchaseServer"title="Permalink to this definition">¶</a></dt>
<li><strong>ram</strong> (<em>number</em>) -- Amount of RAM of the purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20)</li>
<p>Purchased a server with the specified hostname and amount of RAM.</p>
<p>The <em>hostname</em> argument can be any data type, but it will be converted to a string and have whitespace removed. Anything that resolves to an empty string will
cause the function to fail. If there is already a server with the specified hostname, then the function will automatically append
a number at the end of the <em>hostname</em> argument value until it finds a unique hostname. For example, if the script calls
<em>purchaseServer("foo", 4)</em> but a server named "foo" already exists, the it will automatically change the hostname to "foo-0". If there is already
a server with the hostname "foo-0", then it will change the hostname to "foo-1", and so on.</p>
<p>Note that there is a maximum limit to the amount of servers you can purchase.</p>
<p>Returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return an
empty string. The function will fail if the arguments passed in are invalid, if the player does not have enough money to purchase
the specified server, or if the player has exceeded the maximum amount of servers.</p>
<h2>deleteServer<aclass="headerlink"href="#deleteserver"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="deleteServer">
<codeclass="descname">deleteServer</code><spanclass="sig-paren">(</span><em>hostname</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#deleteServer"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>hostname</strong> (<em>string</em>) -- Hostname of the server to delete</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Deletes one of your purchased servers, which is specified by its hostname.</p>
<p>The <em>hostname</em> argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from
the string. This function will not delete a server that still has scripts running on it.</p>
<p>Returns true if successful, and false otherwise.</p>
</dd></dl>
</div>
<divclass="section"id="getpurchasedservers">
<h2>getPurchasedServers<aclass="headerlink"href="#getpurchasedservers"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getPurchasedServers">
<codeclass="descname">getPurchasedServers</code><spanclass="sig-paren">(</span><spanclass="optional">[</span><em>hostname=true</em><spanclass="optional">]</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getPurchasedServers"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>hostname</strong> (<em>boolean</em>) -- Specifies whether hostnames or IP addresses should be returned. If it's true then hostnames will be returned, and if false
then IPs will be returned. If this argument is omitted then it is true by default</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns an array with either the hostnames or IPs of all of the servers you have purchased.</p>
</dd></dl>
</div>
<divclass="section"id="write">
<h2>write<aclass="headerlink"href="#write"title="Permalink to this headline">¶</a></h2>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>port/fn</strong> (<em>string/number</em>) -- Port or text file that will be written to</li>
<li><strong>data</strong> (<em>string</em>) -- Data to write</li>
<li><strong>mode</strong> (<em>string</em>) -- Defines the write mode. Only valid when writing to text files.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function can be used to either write data to a port or to a text file (.txt).</p>
<p>If the first argument is a number between 1 and 10, then it specifies a port and this function will write <em>data</em> to that port. Read
about how <aclass="reference external"href="http://bitburner.wikia.com/wiki/Netscript_Ports">Netscript Ports work here</a>. The third argument, <em>mode</em>, is not used
when writing to a port.</p>
<p>If the first argument is a string, then it specifies the name of a text file (.txt) and this function will write <em>data</em> to that text file. If the
specified text file does not exist, then it will be created. The third argument <em>mode, defines how the data will be written to the text file. If *mode</em>
is set to "w", then the data is written in "write" mode which means that it will overwrite all existing data on the text file. If <em>mode</em> is set to
any other value then the data will be written in "append" mode which means that the data will be added at the end of the text file.</p>
</dd></dl>
</div>
<divclass="section"id="read">
<h2>read<aclass="headerlink"href="#read"title="Permalink to this headline">¶</a></h2>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>port/fn</strong> (<em>string/number</em>) -- Port or text file to read from</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function is used to read data from a port or from a text file (.txt).</p>
<p>If the argument <em>port/fn</em> is a number between 1 and 10, then it specifies a port and it will read data from that port. Read
about how <aclass="reference external"href="http://bitburner.wikia.com/wiki/Netscript_Ports">Netscript Ports work here</a>. A port is a serialized queue. This function
will remove the first element from that queue and return it. If the queue is empty, then the string "NULL PORT DATA" will be returned.</p>
<p>If the argument <em>port/fn</em> 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.</p>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>port/fn</strong> (<em>string/number</em>) -- Port or text file to clear</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function is used to clear data in a <aclass="reference external"href="http://bitburner.wikia.com/wiki/Netscript_Ports">Netscript Ports</a> or a text file.</p>
<p>If the <em>port/fn</em> argument is a number between 1 and 10, then it specifies a port and will clear it (deleting all data from the underlying queue).</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>
<li><strong>fn</strong> (<em>string</em>) -- Filename of file to remove. Must include the extension</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="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>
<h2>scriptRunning<aclass="headerlink"href="#scriptrunning"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="scriptRunning">
<codeclass="descname">scriptRunning</code><spanclass="sig-paren">(</span><em>scriptname</em>, <em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#scriptRunning"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>scriptname</strong> (<em>string</em>) -- Filename of script to check. This is case-sensitive.</li>
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of target server</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of
its arguments.</p>
<p>This is different than the <em>isRunning()</em> function because it does not try to identify a specific instance of a running script
by its arguments.</p>
<p><strong>Examples:</strong></p>
<p>The example below will return true if there is any script named <em>foo.script</em> running on the <em>foodnstuff</em> server, and false otherwise:</p>
<h2>scriptKill<aclass="headerlink"href="#scriptkill"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="scriptKill">
<codeclass="descname">scriptKill</code><spanclass="sig-paren">(</span><em>scriptname</em>, <em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#scriptKill"title="Permalink to this definition">¶</a></dt>
<h2>getScriptName<aclass="headerlink"href="#getscriptname"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getScriptName">
<codeclass="descname">getScriptName</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getScriptName"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">getScriptRam</code><spanclass="sig-paren">(</span><em>scriptname</em><spanclass="optional">[</span>, <em>hostname/ip</em><spanclass="optional">]</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getScriptRam"title="Permalink to this definition">¶</a></dt>
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of target server the script is located on. This is optional, If it is not specified then the function will se the current server as the target server.</li>
<h2>getHackTime<aclass="headerlink"href="#gethacktime"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getHackTime">
<codeclass="descname">getHackTime</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getHackTime"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of target server</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the amount of time in seconds it takes to execute the <em>hack()</em> Netscript function on the target server.</p>
</dd></dl>
</div>
<divclass="section"id="getgrowtime">
<h2>getGrowTime<aclass="headerlink"href="#getgrowtime"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getGrowTime">
<codeclass="descname">getGrowTime</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getGrowTime"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of target server</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the amount of time in seconds it takes to execute the <em>grow()</em> Netscript function on the target server.</p>
</dd></dl>
</div>
<divclass="section"id="getweakentime">
<h2>getWeakenTime<aclass="headerlink"href="#getweakentime"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getWeakenTime">
<codeclass="descname">getWeakenTime</code><spanclass="sig-paren">(</span><em>hostname/ip</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#getWeakenTime"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of target server</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the amount of time in seconds it takes to execute the <em>weaken()</em> Netscript function on the target server.</p>
</dd></dl>
</div>
<divclass="section"id="getscriptincome">
<h2>getScriptIncome<aclass="headerlink"href="#getscriptincome"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getScriptIncome">
<codeclass="descname">getScriptIncome</code><spanclass="sig-paren">(</span><spanclass="optional">[</span><em>scriptname</em><spanclass="optional">]</span><spanclass="optional">[</span>, <em>hostname/ip</em><spanclass="optional">]</span><spanclass="optional">[</span>, <em>args...</em><spanclass="optional">]</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getScriptIncome"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>scriptname</strong> (<em>string</em>) -- Filename of script</li>
<li><strong>hostname/ip</strong> (<em>string</em>) -- Server on which script is running</li>
<li><strong>args...</strong> -- Arguments that the script is running with</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the amount of income the specified script generates while online (when the game is open, does not apply for offline income).
Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script with the arguments
"foodnstuff" and "5" then in order to use this function to get that script's income you must specify those same arguments in the same order
in this function call.</p>
<p>This function can also be called with no arguments. If called with no arguments, then this function will return an array of two values. The
first value is the total income ($ / second) of all of your active scripts (scripts that are currently running on any server). The second value
is the total income ($ / second) that you've earned from scripts since you last installed Augmentations.</p>
</dd></dl>
</div>
<divclass="section"id="getscriptexpgain">
<h2>getScriptExpGain<aclass="headerlink"href="#getscriptexpgain"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getScriptExpGain">
<codeclass="descname">getScriptExpGain</code><spanclass="sig-paren">(</span><spanclass="optional">[</span><em>scriptname</em><spanclass="optional">]</span><spanclass="optional">[</span>, <em>hostname/ip</em><spanclass="optional">]</span><spanclass="optional">[</span>, <em>args...</em><spanclass="optional">]</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getScriptExpGain"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>scriptname</strong> (<em>string</em>) -- Filename of script</li>
<li><strong>hostname/ip</strong> (<em>string</em>) -- Server on which script is running</li>
<li><strong>args...</strong> -- Arguments that the script is running with</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for offline experience gains).
Remember that a script is uniquely identified by both its name and its arguments.</p>
<p>This function can also return the total experience gain rate of all of your active scripts by running the function with no arguments.</p>
</dd></dl>
</div>
<divclass="section"id="gettimesincelastaug">
<h2>getTimeSinceLastAug<aclass="headerlink"href="#gettimesincelastaug"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="getTimeSinceLastAug">
<codeclass="descname">getTimeSinceLastAug</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#getTimeSinceLastAug"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the amount of time in milliseconds that have passed since you last installed Augmentations</p>
</dd></dl>
</div>
<divclass="section"id="sprintf">
<h2>sprintf<aclass="headerlink"href="#sprintf"title="Permalink to this headline">¶</a></h2>
<trclass="field-odd field"><thclass="field-name">Arguments:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>txt</strong> (<em>string</em>) -- Text to appear in the prompt dialog box</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Prompts the player with a dialog box with two options: "Yes" and "No". This function will return true if the player click "Yes" and
false if the player clicks "No". The script's execution is halted until the player selects one of the options.</p>
<p>Note that the following information is only applicable for Netscript 1.0.
<aclass="reference internal"href="netscriptjs.html"><spanclass="doc">NetscriptJS (Netscript 2.0)</span></a> allows you to define your functions using native Javascript
techniques.</p>
<p>You can define your own functions in Netscript 1.0 using the following syntax:</p>
<p><strong>Note about variable scope in functions:</strong></p>
<p>Functions can access "global" variables declared outside of the function's scope. However, they cannot change the value of any "global" variables.
<p><strong>Other Notes about creating your own functions:</strong></p>
<p>Defining a function does not create a Javascript function object in the underlying game code. This means that you cannot use any function
you create in functions such as <aclass="reference external"href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort">Array.sort()</a> (not yet at least, I'll try to make it work in the future).</p>