Minor bugfix in Gang.js and updating documentation for spawn() and stopAction()

This commit is contained in:
danielyxie 2018-02-14 22:34:57 -06:00
parent f82d216e10
commit 1808afa711
23 changed files with 101 additions and 5 deletions

1
dist/bundle.js vendored

@ -50293,7 +50293,6 @@ GangMember.prototype.assignToTask = function(taskName) {
this.task = GangMemberTasks[taskName]; this.task = GangMemberTasks[taskName];
} else { } else {
this.task = GangMemberTasks["Unassigned"]; this.task = GangMemberTasks["Unassigned"];
this.task = null;
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -248,6 +248,26 @@ exec
exec("foo.script", "foodnstuff", 5, 1, "test"); exec("foo.script", "foodnstuff", 5, 1, "test");
spawn
^^^^^
.. js:function:: spawn(script, numThreads, [args...])
:param string script: Filename of script to execute
:param number numThreads: Number of threads to spawn new script with. Will be rounded to nearest integer
:param args...:
Additional arguments to pass into the new script that is being run.
Terminates the current script, and then after a delay of about 20 seconds it will execute the newly-specified script.
The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one.
This function can only be used to run scripts on the local server.
Because this function immediately terminates the script, it does not have a return value.
The following example will execute the script 'foo.script' with 10 threads and the arguments 'foodnstuff' and 90::
spawn('foo.script', 10, 'foodnstuff', 90);
kill kill
^^^^ ^^^^

@ -162,6 +162,25 @@ isBusy
Returns a boolean indicating whether or not the player is currently performing an 'action'. These actions include Returns a boolean indicating whether or not the player is currently performing an 'action'. These actions include
working for a company/faction, studying at a univeristy, working out at a gym, creating a program, or committing a crime. working for a company/faction, studying at a univeristy, working out at a gym, creating a program, or committing a crime.
stopAction
----------
.. js:function:: stopAction()
If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to run this function.
This function is used to end whatever 'action' the player is currently performing. The player
will receive whatever money/experience/etc. he has earned from that action.
The actions that can be stopped with this function are:
* Studying at a university
* Working for a company/faction
* Creating a program
* Committing a Crime
This function will return true if the player's action was ended. It will return false if the player was not
performing an action when this function was called.
upgradeHomeRam upgradeHomeRam
-------------- --------------

@ -367,19 +367,23 @@
</li> </li>
<li><a href="netscriptixapi.html#sellShort">sellShort() (built-in function)</a> <li><a href="netscriptixapi.html#sellShort">sellShort() (built-in function)</a>
</li> </li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptixapi.html#sellStock">sellStock() (built-in function)</a> <li><a href="netscriptixapi.html#sellStock">sellStock() (built-in function)</a>
</li> </li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#serverExists">serverExists() (built-in function)</a> <li><a href="netscriptfunctions.html#serverExists">serverExists() (built-in function)</a>
</li> </li>
<li><a href="netscriptixapi.html#shortStock">shortStock() (built-in function)</a> <li><a href="netscriptixapi.html#shortStock">shortStock() (built-in function)</a>
</li> </li>
<li><a href="netscriptfunctions.html#sleep">sleep() (built-in function)</a> <li><a href="netscriptfunctions.html#sleep">sleep() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#spawn">spawn() (built-in function)</a>
</li> </li>
<li><a href="netscriptfunctions.html#sprintf">sprintf() (built-in function)</a> <li><a href="netscriptfunctions.html#sprintf">sprintf() (built-in function)</a>
</li> </li>
<li><a href="netscriptfunctions.html#sqlinject">sqlinject() (built-in function)</a> <li><a href="netscriptfunctions.html#sqlinject">sqlinject() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#stopAction">stopAction() (built-in function)</a>
</li> </li>
</ul></td> </ul></td>
</tr></table> </tr></table>

@ -96,6 +96,7 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#sqlinject">sqlinject</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#sqlinject">sqlinject</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#run">run</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#run">run</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#exec">exec</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#exec">exec</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#spawn">spawn</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#kill">kill</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#kill">kill</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#killall">killall</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#killall">killall</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#exit">exit</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#exit">exit</a></li>
@ -173,6 +174,7 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#purchaseprogram">purchaseProgram</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#purchaseprogram">purchaseProgram</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#getstats">getStats</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#getstats">getStats</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#isbusy">isBusy</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#isbusy">isBusy</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#stopaction">stopAction</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#upgradehomeram">upgradeHomeRam</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#upgradehomeram">upgradeHomeRam</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#getupgradehomeramcost">getUpgradeHomeRamCost</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#getupgradehomeramcost">getUpgradeHomeRamCost</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#workforcompany">workForCompany</a></li> <li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#workforcompany">workForCompany</a></li>

@ -97,6 +97,7 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#sqlinject">sqlinject</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#sqlinject">sqlinject</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#run">run</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#run">run</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#exec">exec</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#exec">exec</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#spawn">spawn</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#kill">kill</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#kill">kill</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#killall">killall</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#killall">killall</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#exit">exit</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#exit">exit</a></li>
@ -174,6 +175,7 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#purchaseprogram">purchaseProgram</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#purchaseprogram">purchaseProgram</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#getstats">getStats</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#getstats">getStats</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#isbusy">isBusy</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#isbusy">isBusy</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#stopaction">stopAction</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#upgradehomeram">upgradeHomeRam</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#upgradehomeram">upgradeHomeRam</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#getupgradehomeramcost">getUpgradeHomeRamCost</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#getupgradehomeramcost">getUpgradeHomeRamCost</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#workforcompany">workForCompany</a></li> <li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#workforcompany">workForCompany</a></li>

@ -460,6 +460,35 @@ the number 1 and the string &quot;test&quot; in as arguments to the script:</p>
</div> </div>
</dd></dl> </dd></dl>
</div>
<div class="section" id="spawn">
<h2>spawn<a class="headerlink" href="#spawn" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">spawn</code><span class="sig-paren">(</span><em>script</em>, <em>numThreads</em><span class="optional">[</span>, <em>args...</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>script</strong> (<em>string</em>) -- Filename of script to execute</li>
<li><strong>numThreads</strong> (<em>number</em>) -- Number of threads to spawn new script with. Will be rounded to nearest integer</li>
<li><strong>args...</strong> -- Additional arguments to pass into the new script that is being run.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Terminates the current script, and then after a delay of about 20 seconds it will execute the newly-specified script.
The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one.
This function can only be used to run scripts on the local server.</p>
<p>Because this function immediately terminates the script, it does not have a return value.</p>
<p>The following example will execute the script 'foo.script' with 10 threads and the arguments 'foodnstuff' and 90:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">spawn</span><span class="p">(</span><span class="s1">&#39;foo.script&#39;</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="s1">&#39;foodnstuff&#39;</span><span class="p">,</span> <span class="mi">90</span><span class="p">);</span>
</pre></div>
</div>
</dd></dl>
</div> </div>
<div class="section" id="kill"> <div class="section" id="kill">
<h2>kill<a class="headerlink" href="#kill" title="Permalink to this headline"></a></h2> <h2>kill<a class="headerlink" href="#kill" title="Permalink to this headline"></a></h2>
@ -1485,6 +1514,7 @@ you create in functions such as <a class="reference external" href="https://deve
<li class="toctree-l3"><a class="reference internal" href="#sqlinject">sqlinject</a></li> <li class="toctree-l3"><a class="reference internal" href="#sqlinject">sqlinject</a></li>
<li class="toctree-l3"><a class="reference internal" href="#run">run</a></li> <li class="toctree-l3"><a class="reference internal" href="#run">run</a></li>
<li class="toctree-l3"><a class="reference internal" href="#exec">exec</a></li> <li class="toctree-l3"><a class="reference internal" href="#exec">exec</a></li>
<li class="toctree-l3"><a class="reference internal" href="#spawn">spawn</a></li>
<li class="toctree-l3"><a class="reference internal" href="#kill">kill</a></li> <li class="toctree-l3"><a class="reference internal" href="#kill">kill</a></li>
<li class="toctree-l3"><a class="reference internal" href="#killall">killall</a></li> <li class="toctree-l3"><a class="reference internal" href="#killall">killall</a></li>
<li class="toctree-l3"><a class="reference internal" href="#exit">exit</a></li> <li class="toctree-l3"><a class="reference internal" href="#exit">exit</a></li>

@ -247,6 +247,26 @@ Terminal <em>buy</em> command.</p>
working for a company/faction, studying at a univeristy, working out at a gym, creating a program, or committing a crime.</p> working for a company/faction, studying at a univeristy, working out at a gym, creating a program, or committing a crime.</p>
</dd></dl> </dd></dl>
</div>
<div class="section" id="stopaction">
<h2>stopAction<a class="headerlink" href="#stopaction" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="stopAction">
<code class="descname">stopAction</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#stopAction" title="Permalink to this definition"></a></dt>
<dd><p>If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to run this function.
This function is used to end whatever 'action' the player is currently performing. The player
will receive whatever money/experience/etc. he has earned from that action.</p>
<p>The actions that can be stopped with this function are:</p>
<ul class="simple">
<li>Studying at a university</li>
<li>Working for a company/faction</li>
<li>Creating a program</li>
<li>Committing a Crime</li>
</ul>
<p>This function will return true if the player's action was ended. It will return false if the player was not
performing an action when this function was called.</p>
</dd></dl>
</div> </div>
<div class="section" id="upgradehomeram"> <div class="section" id="upgradehomeram">
<h2>upgradeHomeRam<a class="headerlink" href="#upgradehomeram" title="Permalink to this headline"></a></h2> <h2>upgradeHomeRam<a class="headerlink" href="#upgradehomeram" title="Permalink to this headline"></a></h2>
@ -656,6 +676,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="#purchaseprogram">purchaseProgram</a></li> <li class="toctree-l3"><a class="reference internal" href="#purchaseprogram">purchaseProgram</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getstats">getStats</a></li> <li class="toctree-l3"><a class="reference internal" href="#getstats">getStats</a></li>
<li class="toctree-l3"><a class="reference internal" href="#isbusy">isBusy</a></li> <li class="toctree-l3"><a class="reference internal" href="#isbusy">isBusy</a></li>
<li class="toctree-l3"><a class="reference internal" href="#stopaction">stopAction</a></li>
<li class="toctree-l3"><a class="reference internal" href="#upgradehomeram">upgradeHomeRam</a></li> <li class="toctree-l3"><a class="reference internal" href="#upgradehomeram">upgradeHomeRam</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getupgradehomeramcost">getUpgradeHomeRamCost</a></li> <li class="toctree-l3"><a class="reference internal" href="#getupgradehomeramcost">getUpgradeHomeRamCost</a></li>
<li class="toctree-l3"><a class="reference internal" href="#workforcompany">workForCompany</a></li> <li class="toctree-l3"><a class="reference internal" href="#workforcompany">workForCompany</a></li>

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -361,7 +361,6 @@ GangMember.prototype.assignToTask = function(taskName) {
this.task = GangMemberTasks[taskName]; this.task = GangMemberTasks[taskName];
} else { } else {
this.task = GangMemberTasks["Unassigned"]; this.task = GangMemberTasks["Unassigned"];
this.task = null;
} }
} }