mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
commit
459f73702d
8
dist/vendor.bundle.js
vendored
8
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -32,7 +32,7 @@ Nodes are significantly less profitable. Servers have less money on them and low
|
|||||||
growth rates, but it is easier to lower their security level using the weaken() Netscript function.
|
growth rates, but it is easier to lower their security level using the weaken() Netscript function.
|
||||||
|
|
||||||
Furthermore, some BitNodes introduce new content and mechanics. For example there is one
|
Furthermore, some BitNodes introduce new content and mechanics. For example there is one
|
||||||
BitNode that grants access to the :ref:`Netscript Singularity Functions <netscript_singularityfunctions>`.
|
BitNode that grants access to the `Singularity API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.singularity.md>`_.
|
||||||
There is another BitNode in which you can manage a gang to earn money and reputation.
|
There is another BitNode in which you can manage a gang to earn money and reputation.
|
||||||
|
|
||||||
How to destroy a BitNode
|
How to destroy a BitNode
|
||||||
|
@ -14,54 +14,52 @@ of level 3.
|
|||||||
|
|
||||||
List of all Source-Files
|
List of all Source-Files
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| BitNode-1: Source Genesis | * Lets the player start with 32 GB of RAM on home computer. |
|
|| BitNode-1: Source Genesis || * Lets the player start with 32 GB of RAM on home computer. |
|
||||||
| | * Increases all of the player's multipliers by 16%/24%/28%. |
|
|| || * Increases all of the player's multipliers by 16%/24%/28%. |
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| BitNode-2: Rise of the Underworld | * Lets the player create Gangs in other BitNodes (although some |
|
|| BitNode-2: Rise of the Underworld || * Lets the player create Gangs in other BitNodes (although some |
|
||||||
| | BitNodes will disable this mechanic). |
|
|| || BitNodes will disable this mechanic). |
|
||||||
| | * Increases the player's crime success rate, crime money, and |
|
|| || * Increases the player's crime success rate, crime money, and |
|
||||||
| | charisma multipliers by 24%/36%/42%. |
|
|| || charisma multipliers by 24%/36%/42%. |
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| BitNode-3: Corporatocracy | * Lets the player create Corporations in other BitNodes (although some |
|
|| BitNode-3: Corporatocracy || * Lets the player create Corporations in other BitNodes (although some |
|
||||||
| | BitNodes will disable this mechanic). |
|
|| || BitNodes will disable this mechanic). |
|
||||||
| | * Increases the player's charisma and company salary multipliers by 8%/12%/14%. |
|
|| || * Increases the player's charisma and company salary multipliers by 8%/12%/14%. |
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| BitNode-4: The Singularity | * Lets the player access and use Netscript Singularity Functions in other BitNodes. |
|
|| BitNode-4: The Singularity || * Lets the player access and use Netscript Singularity Functions in other BitNodes. |
|
||||||
| | * Each level of this Source-File opens up more of the Singularity Functions to use. |
|
|| || * Each level of this Source-File opens up more of the Singularity Functions to use. |
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| BitNode-5: Artificial Intelligence | * Unlocks :ref:`gameplay_intelligence`. |
|
|| BitNode-5: Artificial Intelligence || * Unlocks :ref:`gameplay_intelligence`. |
|
||||||
| | * Unlocks :js:func:`getBitNodeMultipliers` and start with Formulas.exe |
|
|| || * Unlocks :js:func:`getBitNodeMultipliers` and start with Formulas.exe. |
|
||||||
| | Netscript functions, as well as :ref:`netscriptformulas`. |
|
|| || * Increases all of the player's hacking-related multipliers by 8%/12%/14%. |
|
||||||
| | * Increases all of the player's hacking-related multipliers by 8%/12%/14%. |
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
|| BitNode-6: Bladeburners || * Unlocks the Bladeburner feature in other BitNodes. |
|
||||||
| BitNode-6: Bladeburners | * Unlocks the Bladeburner feature in other BitNodes. |
|
|| || * Increases all of the player's level and experience gain rate multipliers for |
|
||||||
| | * Increases all of the player's level and experience gain rate multipliers for |
|
|| || combat stats by 8%/12%/14%. |
|
||||||
| | combat stats by 8%/12%/14%. |
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
|| BitNode-7: Bladeburners 2079 || * Allows the player to access the `Bladeburner API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.bladeburner.md>`_ in other BitNodes. |
|
||||||
| BitNode-7: Bladeburners 2079 | * Allows the player to access the :ref:`netscript_bladeburnerapi` in other BitNodes.|
|
|| || * Increases all of the player's Bladeburner multipliers by 8%/12%/14%. |
|
||||||
| | * Increases all of the player's Bladeburner multipliers by 8%/12%/14%. |
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
|| BitNode-8: Ghost of Wall Street || * Increases the player's hacking growth multiplier by 12%/18%/21%. |
|
||||||
| BitNode-8: Ghost of Wall Street | * Increases the player's hacking growth multiplier by 12%/18%/21%. |
|
|| || * Level 1 grants permanent access to :ref:`WSE <gameplay_stock_market>` and the `TIX API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.tix.md>`_ |
|
||||||
| | * Level 1 grants permanent access to :ref:`WSE <gameplay_stock_market>` and |
|
|| || * Level 2 grants permanent access to shorting stocks. |
|
||||||
| | :ref:`TIX API <netscript_tixapi>`. |
|
|| || * Level 3 grants permanent access to use limit/stop orders. |
|
||||||
| | * Level 2 grants permanent access to shorting stocks. |
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| | * Level 3 grants permanent access to use limit/stop orders. |
|
|| BitNode-9: Hacktocracy || * Level 1 permanently unlocks the Hacknet Server in other BitNodes. |
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
|| || * Level 2 lets the player start with 128 GB of RAM on home computer. |
|
||||||
| BitNode-9: Hacktocracy | * Level 1 permanently unlocks the Hacknet Server in other BitNodes. |
|
|| || * Level 3 grants a highly-upgraded Hacknet Server when entering a new BitNode (it |
|
||||||
| | * Level 2 lets the player start with 128 GB of RAM on home computer. |
|
|| || will be lost after installing augments). |
|
||||||
| | * Level 3 grants a highly-upgraded Hacknet Server when entering a new BitNode (it |
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| | will be lost after installing augments). |
|
|| BitNode-10: Digital Carbon || * Each level of this grants a Duplicate Sleeve. |
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
|| || * Allows the player to access the `Sleeve API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.sleeve.md>`_ in other BitNodes. |
|
||||||
| BitNode-10: Digital Carbon | * Each level of this grants a Duplicate Sleeve. |
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| | * Allows the player to access the :ref:`netscript_sleeveapi` in other BitNodes. |
|
|| BitNode-11: The Big Crash || * Company favor increases both the player's salary and reputation gain at that |
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
|| || company by 1% per favor (rather than just the reputation gain). |
|
||||||
| BitNode-11: The Big Crash | * Company favor increases both the player's salary and reputation gain at that |
|
|| || * Increases the player's company salary and reputation gain multipliers by |
|
||||||
| | company by 1% per favor (rather than just the reputation gain). |
|
|| || 32%/48%/56%. |
|
||||||
| | * Increases the player's company salary and reputation gain multipliers by |
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| | 32%/48%/56%. |
|
|| BitNode-12: The Recursion || * There is no maximum level for this Source-File. |
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
|| || * Lets the player start with Neuroflux Governor equal to the level of this |
|
||||||
| BitNode-12: The Recursion | * There is no maximum level for this Source-File. |
|
|| || Source-File. |
|
||||||
| | * Lets the player start with Neuroflux Governor equal to the level of this |
|
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| | Source-File. |
|
|
||||||
+------------------------------------+-------------------------------------------------------------------------------------+
|
|
||||||
|
@ -7,7 +7,7 @@ exchange for solving programming problems.
|
|||||||
|
|
||||||
Coding Contracts are files with the ".cct" extensions. They can
|
Coding Contracts are files with the ".cct" extensions. They can
|
||||||
be accessed through the :ref:`terminal` or through scripts using
|
be accessed through the :ref:`terminal` or through scripts using
|
||||||
the :ref:`netscriptcodingcontractapi`
|
the `Coding Contract API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.codingcontract.md>`_
|
||||||
|
|
||||||
Each contract has a limited number of attempts. If you
|
Each contract has a limited number of attempts. If you
|
||||||
provide the wrong answer too many times and exceed the
|
provide the wrong answer too many times and exceed the
|
||||||
@ -31,7 +31,7 @@ an area to provide an answer.
|
|||||||
|
|
||||||
Interacting through Scripts
|
Interacting through Scripts
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
See :ref:`netscriptcodingcontractapi`.
|
See the `Coding Contract API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.codingcontract.md>`_.
|
||||||
|
|
||||||
Submitting Solutions
|
Submitting Solutions
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -180,7 +180,7 @@ Working for a Company
|
|||||||
Automating the Stock Market
|
Automating the Stock Market
|
||||||
---------------------------
|
---------------------------
|
||||||
You can write scripts to perform automatic and algorithmic trading on the Stock Market.
|
You can write scripts to perform automatic and algorithmic trading on the Stock Market.
|
||||||
See :ref:`netscript_tixapi` for more details.
|
See `TIX API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.tix.md>`_ for more details.
|
||||||
|
|
||||||
Under the Hood
|
Under the Hood
|
||||||
--------------
|
--------------
|
||||||
|
@ -3,6 +3,57 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
v1.0.1 - 2021-11-17 New documentation (hydroflame)
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
** Documentation **
|
||||||
|
|
||||||
|
* The new documentation for the netscript API is available at
|
||||||
|
https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.ns.md
|
||||||
|
This documentation is used in-game to validate the code, in-editor to autocomplete, and
|
||||||
|
for users to reference. This is a huge quality of life improvements for me.
|
||||||
|
|
||||||
|
** Reputation **
|
||||||
|
|
||||||
|
* Fixed favor not affecting faction work reputation gain (Yeah, I know right?)
|
||||||
|
|
||||||
|
** Hacknet **
|
||||||
|
|
||||||
|
* Servers are now considerd "purchasedByPlayers"
|
||||||
|
|
||||||
|
** Script Editor **
|
||||||
|
|
||||||
|
* solarized themes now work.
|
||||||
|
|
||||||
|
** Corporation **
|
||||||
|
|
||||||
|
* Dividends are now much more taxed.
|
||||||
|
* The 2 upgrades that reduced taxes are now much stronger.
|
||||||
|
|
||||||
|
** Misc. **
|
||||||
|
|
||||||
|
* Starting / Stopping scripts on hashnet servers immediately updates their hash rate (instead of on the next tick)
|
||||||
|
* Hacknet has tooltip showing what the result of the upgrade would be.
|
||||||
|
* Augmentations page displayes current price multiplier as well as explains the mechanic.
|
||||||
|
* Terminal now is 25x stronger.
|
||||||
|
* Tail boxes use pre-wrap for it's lines.
|
||||||
|
* Tail boxes allow you to rerun dead scripts.
|
||||||
|
* Tail boxes can no longer open the same one twice.
|
||||||
|
* Terminal now autocompletes through aliases.
|
||||||
|
* Make alter reality harder.
|
||||||
|
* Fix bladeburner cancelling actions when manually starting anything with Simulacrum.
|
||||||
|
* Buying hash upgrade to increase uni class or gym training will apply to current class.
|
||||||
|
* Internally the game no longer uses the decimal library.
|
||||||
|
* Fix an issue where 'download *' would generate weird windows files.
|
||||||
|
* Timestamps can be set to any format in the options.
|
||||||
|
* Fix typo in documentation share popup.
|
||||||
|
* Remove bunch of debug log.
|
||||||
|
* Fix typo in corporation handbook literature.
|
||||||
|
* Fix typo in documentation
|
||||||
|
* Fix duplicate SF -1 exploit. (Yeah, an exploit of exploits, now were meta)
|
||||||
|
* Fix offline hacking earning being attributed to hacknet.
|
||||||
|
* nerf noodle bar
|
||||||
|
|
||||||
v1.0.0 - 2021-11-10 Breaking the API :( (blame hydroflame)
|
v1.0.0 - 2021-11-10 Breaking the API :( (blame hydroflame)
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
@ -64,16 +64,16 @@ documentation_title = '{0} Documentation'.format(project)
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.58'
|
version = '1.0'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.58.0'
|
release = '1.0.1'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
#
|
#
|
||||||
# This is also used if you do content translation via gettext catalogs.
|
# This is also used if you do content translation via gettext catalogs.
|
||||||
# Usually you set "language" from the command line for these cases.
|
# Usually you set "language" from the command line for these cases.
|
||||||
language = 'English'
|
language = 'en'
|
||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
|
@ -403,7 +403,7 @@ For fast progression
|
|||||||
strong because hacking is typically one of the best ways of earning money.
|
strong because hacking is typically one of the best ways of earning money.
|
||||||
|
|
||||||
3. (Optional) Consider doing **BitNode-4: The Singularity**. Its Source-File does not directly make you
|
3. (Optional) Consider doing **BitNode-4: The Singularity**. Its Source-File does not directly make you
|
||||||
more powerful in any way, but it does unlock :ref:`netscript_singularityfunctions` which
|
more powerful in any way, but it does unlock the `Singularity API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.singularity.md>`_ which
|
||||||
let you automate significantly more aspects of the game.
|
let you automate significantly more aspects of the game.
|
||||||
|
|
||||||
4. Do **BitNode-3: Corporatocracy** once to unlock the Corporation mechanic. This mechanic
|
4. Do **BitNode-3: Corporatocracy** once to unlock the Corporation mechanic. This mechanic
|
||||||
@ -440,12 +440,12 @@ them.
|
|||||||
|
|
||||||
For more scripting/hacking
|
For more scripting/hacking
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
**BitNode-4: The Singularity** unlocks the :ref:`netscript_singularityfunctions`, which
|
**BitNode-4: The Singularity** unlocks the `Singularity API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.singularity.md>`_, which
|
||||||
can be used to automate many different aspects of the game, including working for factions/companies,
|
can be used to automate many different aspects of the game, including working for factions/companies,
|
||||||
purchasing & installing Augmentations, and creating programs
|
purchasing & installing Augmentations, and creating programs
|
||||||
|
|
||||||
**BitNode-6** and **BitNode-7** unlock Bladeburner and its corresponding
|
**BitNode-6** and **BitNode-7** unlock Bladeburner and its corresponding
|
||||||
:ref:`Netscript API <netscript_bladeburnerapi>`. This allows you to automate an entire
|
`Netscript API <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.bladeburner.md>`_. This allows you to automate an entire
|
||||||
new mechanic.
|
new mechanic.
|
||||||
|
|
||||||
**BitNode-2: Rise of the Underworld** also unlocks a new mechanic and Netscript API for automating
|
**BitNode-2: Rise of the Underworld** also unlocks a new mechanic and Netscript API for automating
|
||||||
|
@ -20,7 +20,8 @@ secrets that you've been searching for.
|
|||||||
:maxdepth: 5
|
:maxdepth: 5
|
||||||
:caption: Contents:
|
:caption: Contents:
|
||||||
|
|
||||||
Netscript <netscript>
|
Full documentation <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.ns.md>
|
||||||
|
Basic documentation <netscript>
|
||||||
Basic Gameplay <basicgameplay>
|
Basic Gameplay <basicgameplay>
|
||||||
Advanced Gameplay <advancedgameplay>
|
Advanced Gameplay <advancedgameplay>
|
||||||
Keyboard Shortcuts <shortcuts>
|
Keyboard Shortcuts <shortcuts>
|
||||||
@ -29,6 +30,7 @@ secrets that you've been searching for.
|
|||||||
Tools & Resources <toolsandresources>
|
Tools & Resources <toolsandresources>
|
||||||
Changelog <changelog>
|
Changelog <changelog>
|
||||||
v1.0.0 script migration guide <v1.0.0_migration.rst>
|
v1.0.0 script migration guide <v1.0.0_migration.rst>
|
||||||
|
404 <404.rst>
|
||||||
Donate <https://paypal.me/danielyxie>
|
Donate <https://paypal.me/danielyxie>
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
|
@ -10,13 +10,12 @@ This means that Netscript's syntax is
|
|||||||
identical to that of JavaScript, but it does not implement some of the features
|
identical to that of JavaScript, but it does not implement some of the features
|
||||||
that JavaScript has.
|
that JavaScript has.
|
||||||
|
|
||||||
If you have any requests or suggestions to improve the Netscript language, feel free
|
|
||||||
to reach out to the developer!
|
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 5
|
:maxdepth: 5
|
||||||
:caption: Sections:
|
:caption: Sections:
|
||||||
|
|
||||||
|
Full documentation <https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.ns.md>
|
||||||
Learn to Program <netscript/netscriptlearntoprogram>
|
Learn to Program <netscript/netscriptlearntoprogram>
|
||||||
Netscript 1.0 <netscript/netscript1>
|
Netscript 1.0 <netscript/netscript1>
|
||||||
NetscriptJS (Netscript 2.0) <netscript/netscriptjs>
|
NetscriptJS (Netscript 2.0) <netscript/netscriptjs>
|
||||||
@ -24,11 +23,4 @@ to reach out to the developer!
|
|||||||
Basic Functions <netscript/netscriptfunctions>
|
Basic Functions <netscript/netscriptfunctions>
|
||||||
Advanced Functions <netscript/netscriptadvancedfunctions>
|
Advanced Functions <netscript/netscriptadvancedfunctions>
|
||||||
Hacknet Node API <netscript/netscripthacknetnodeapi>
|
Hacknet Node API <netscript/netscripthacknetnodeapi>
|
||||||
Trade Information eXchange (TIX) API <netscript/netscriptixapi>
|
|
||||||
Singularity Functions <netscript/netscriptsingularityfunctions>
|
|
||||||
Bladeburner API <netscript/netscriptbladeburnerapi>
|
|
||||||
Gang API <netscript/netscriptgangapi>
|
|
||||||
Coding Contract API <netscript/netscriptcodingcontractapi>
|
|
||||||
Sleeve API <netscript/netscriptsleeveapi>
|
|
||||||
Formulas API <netscript/netscriptformulasapi>
|
|
||||||
Miscellaneous <netscript/netscriptmisc>
|
Miscellaneous <netscript/netscriptmisc>
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
atExit() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: atExit(f)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param function f: function to call when the script dies.
|
|
||||||
|
|
||||||
Runs when the script dies.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
function onDeath() {
|
|
||||||
console.log('I died!!!')
|
|
||||||
}
|
|
||||||
atExit(onDeath);
|
|
@ -1,5 +1,5 @@
|
|||||||
autocomplete() Netscript Function
|
autocomplete() Netscript Function
|
||||||
============================
|
=================================
|
||||||
|
|
||||||
.. warning:: This feature is not officially supported yet and the API might change. It is also only supported in ns2
|
.. warning:: This feature is not officially supported yet and the API might change. It is also only supported in ns2
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ autocomplete() Netscript Function
|
|||||||
|
|
||||||
Terminal:
|
Terminal:
|
||||||
|
|
||||||
.. code-block:: javascript
|
.. code-block:: bash
|
||||||
|
|
||||||
$ run demo.ns mega\t
|
$ run demo.ns mega\t
|
||||||
// results in
|
// results in
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
getBitNodeMultipliers() Netscript Function
|
|
||||||
==========================================
|
|
||||||
|
|
||||||
.. js:function:: getBitNodeMultipliers()
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
|
|
||||||
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
|
|
||||||
run this function.
|
|
||||||
|
|
||||||
Returns an object containing the current BitNode multipliers. The
|
|
||||||
multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). The
|
|
||||||
multipliers represent the difference between the current BitNode and the
|
|
||||||
original BitNode (BitNode-1). For example, if the *CrimeMoney* multiplier
|
|
||||||
has a value of 0.1, then that means that committing crimes in the current
|
|
||||||
BitNode will only give 10% of the money you would have received in
|
|
||||||
BitNode-1.
|
|
||||||
|
|
||||||
The structure of the returned object is subject to change as BitNode
|
|
||||||
multipliers get added to the game. Refer to the `source code here
|
|
||||||
<https://github.com/danielyxie/bitburner/blob/master/src/BitNode/BitNodeMultipliers.ts>`_
|
|
||||||
to see the name of the BitNode multipliers.
|
|
||||||
|
|
||||||
Example::
|
|
||||||
|
|
||||||
mults = getBitNodeMultipliers();
|
|
||||||
print(mults.ServerMaxMoney);
|
|
||||||
print(mults.HackExpGain);
|
|
@ -1,38 +0,0 @@
|
|||||||
getServer() Netscript Function
|
|
||||||
==========================================
|
|
||||||
|
|
||||||
.. js:function:: getServer([hostname])
|
|
||||||
|
|
||||||
:RAM cost: 2 GB
|
|
||||||
:param string hostname: Hostname of the server, defaults to host server.
|
|
||||||
|
|
||||||
This function is meant to be used in conjunction with the :doc:`formulas API<../netscriptformulasapi>`.
|
|
||||||
|
|
||||||
Returns an object with the Server's stats. The object has the following properties::
|
|
||||||
|
|
||||||
{
|
|
||||||
cpuCores
|
|
||||||
ftpPortOpen
|
|
||||||
hasAdminRights
|
|
||||||
hostname
|
|
||||||
httpPortOpen
|
|
||||||
ip
|
|
||||||
isConnectedTo
|
|
||||||
maxRam
|
|
||||||
organizationName
|
|
||||||
ramUsed
|
|
||||||
smtpPortOpen
|
|
||||||
sqlPortOpen
|
|
||||||
sshPortOpen
|
|
||||||
baseDifficulty
|
|
||||||
hackDifficulty
|
|
||||||
backdoorInstalled
|
|
||||||
minDifficulty
|
|
||||||
moneyAvailable
|
|
||||||
moneyMax
|
|
||||||
numOpenPortsRequired
|
|
||||||
openPortCount
|
|
||||||
purchasedByPlayer
|
|
||||||
requiredHackingSkill
|
|
||||||
serverGrowth
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
alert() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: alert(message)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param string message: message to display
|
|
||||||
|
|
||||||
Spawns an alert box.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
alert("Reached $1b");
|
|
@ -1,16 +0,0 @@
|
|||||||
clear() Netscript Function
|
|
||||||
==========================
|
|
||||||
|
|
||||||
.. js:function:: clear(portOrFilename)
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
|
|
||||||
:param string/number portOrFilename: Port or text file to clear.
|
|
||||||
|
|
||||||
This function is used to clear data in a :ref:`Netscript Port <netscript_ports>` or a text file.
|
|
||||||
|
|
||||||
If the ``portOrFilename`` argument is a number between 1 and 20, then it
|
|
||||||
specifies a port and will clear it (deleting all data from the underlying queue).
|
|
||||||
|
|
||||||
If the ``portOrFilename`` argument is a string, then it specifies the name
|
|
||||||
of a text file (.txt) and will delete all data from that text file.
|
|
@ -1,17 +0,0 @@
|
|||||||
clearLog() Netscript Function
|
|
||||||
=============================
|
|
||||||
|
|
||||||
.. js:function:: clearLog()
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
|
|
||||||
Clears the script's logs. Useful when making monitoring scripts.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
while(true) {
|
|
||||||
clearLog();
|
|
||||||
print(getServerMoneyAvailable('foodnstuff'));
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
exit() Netscript Function
|
|
||||||
=========================
|
|
||||||
|
|
||||||
.. js:function:: exit()
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
|
|
||||||
Terminates the current script immediately.
|
|
||||||
|
|
||||||
.. warning:: In :ref:`netscriptjs`, execution may continue past a call to
|
|
||||||
this function; while some game-related functions (e.g. those with an
|
|
||||||
``ns.`` prefix) will not function after this function has been called,
|
|
||||||
there might still be unintended behavior if you assume ``exit`` will
|
|
||||||
immediately halt execution, like it does in :ref:`netscript1`. To be
|
|
||||||
safe, you should probably ``return`` from the main function instead
|
|
||||||
of/in addition to calling ``ns.exit()`` when halting a NetscriptJS
|
|
||||||
script.
|
|
@ -1,46 +0,0 @@
|
|||||||
flags() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: flags(data)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param data array of pairs of strings: Flags definition.
|
|
||||||
:returns: Object containing all the flags that were parsed or default.
|
|
||||||
|
|
||||||
This function allows for a more flexible way of parsing script arguments
|
|
||||||
than to just pass a fixed list in a fixed order. Options can be given
|
|
||||||
names, and passed in any order, while having defined default values.
|
|
||||||
|
|
||||||
The flag definition is an array of pairs of values: the first value is the
|
|
||||||
name of the flag, and the 2nd value is the default value for that flag.
|
|
||||||
|
|
||||||
The return object is a map containing flag names to the value. It also
|
|
||||||
contains the special field '_', which contains all arguments that were not
|
|
||||||
flags.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
// example.script
|
|
||||||
var data = flags([
|
|
||||||
['delay', 0], // a default number means this flag is a number
|
|
||||||
['server', 'foodnstuff'], // a default string means this flag is a string
|
|
||||||
['exclude', []], // a default array means this flag is a default array of string
|
|
||||||
['help', false], // a default boolean means this flag is a boolean
|
|
||||||
]);
|
|
||||||
tprint(data);
|
|
||||||
/*
|
|
||||||
[home ~/]> run example.script
|
|
||||||
{"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":false}
|
|
||||||
[home ~/]> run example.script --delay 3000
|
|
||||||
{"_":[],"server":"foodnstuff","exclude":[],"help":false,"delay":3000}
|
|
||||||
[home ~/]> run example.script --delay 3000 --server harakiri-sushi
|
|
||||||
{"_":[],"exclude":[],"help":false,"delay":3000,"server":"harakiri-sushi"}
|
|
||||||
[home ~/]> run example.script --delay 3000 --server harakiri-sushi hello world
|
|
||||||
{"_":["hello","world"],"exclude":[],"help":false,"delay":3000,"server":"harakiri-sushi"}
|
|
||||||
[home ~/]> run example.script --delay 3000 --server harakiri-sushi hello world --exclude a --exclude b
|
|
||||||
{"_":["hello","world"],"help":false,"delay":3000,"server":"harakiri-sushi","exclude":["a","b"]}
|
|
||||||
[home ~/]> run example.script --help
|
|
||||||
{"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":true}
|
|
||||||
*/
|
|
@ -1,13 +0,0 @@
|
|||||||
getFavorToDonate() Netscript Function
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
.. js:function:: getFavorToDonate()
|
|
||||||
|
|
||||||
:RAM cost: 0.1 GB
|
|
||||||
:returns: Amount of faction favor required to unlock donation.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getFavorToDonate() // returns: 150
|
|
@ -1,21 +0,0 @@
|
|||||||
getGrowTime() Netscript Function
|
|
||||||
================================
|
|
||||||
|
|
||||||
.. js:function:: getGrowTime(hostname[, hackLvl=current level])
|
|
||||||
|
|
||||||
:RAM cost: 0.05 GB
|
|
||||||
|
|
||||||
:param string hostname: Hostname of target server.
|
|
||||||
:returns: seconds it takes to execute :doc:`grow<grow>` on that server.
|
|
||||||
|
|
||||||
The function takes in an optional ``hackLvl`` parameter that can be
|
|
||||||
specified to see what the grow time would be at different hacking levels.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getGrowTime("foodnstuff"); // returns: 53.4
|
|
||||||
|
|
||||||
.. note:: For Hacknet Servers (the upgraded version of a Hacknet Node), this function will
|
|
||||||
return ``Infinity``.
|
|
@ -1,20 +0,0 @@
|
|||||||
getHackTime() Netscript Function
|
|
||||||
================================
|
|
||||||
|
|
||||||
.. js:function:: getHackTime(hostname[, hackLvl=current level])
|
|
||||||
|
|
||||||
:RAM cost: 0.05 GB
|
|
||||||
:param string hostname: Hostname of target server.
|
|
||||||
:returns: seconds it takes to execute :doc:`hack<hack>` on that server.
|
|
||||||
|
|
||||||
The function takes in an optional ``hackLvl`` parameter that can be
|
|
||||||
specified to see what the hack time would be at different hacking levels.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getHackTime("foodnstuff"); // returns: 53.4
|
|
||||||
|
|
||||||
.. note:: For Hacknet Servers (the upgraded version of a Hacknet Node), this function will
|
|
||||||
return :code:`Infinity`.
|
|
@ -1,13 +0,0 @@
|
|||||||
getHostname() Netscript Function
|
|
||||||
================================
|
|
||||||
|
|
||||||
.. js:function:: getHostname()
|
|
||||||
|
|
||||||
:RAM cost: 0.05 GB
|
|
||||||
:returns: Hostname of the server this script is running on.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getHostname(); // returns: "foodnstuff"
|
|
@ -1,101 +0,0 @@
|
|||||||
getPlayer() Netscript Function
|
|
||||||
==============================
|
|
||||||
|
|
||||||
.. js:function:: getPlayer()
|
|
||||||
|
|
||||||
:RAM cost: 0.5 GB
|
|
||||||
|
|
||||||
The result of this function can be passed to the :doc:`formulas API<../netscriptformulasapi>`.
|
|
||||||
|
|
||||||
Returns an object with the Player's stats. The object has the following properties::
|
|
||||||
|
|
||||||
{
|
|
||||||
hacking: Current Hacking skill level
|
|
||||||
hp: Current health points
|
|
||||||
max_hp: Maximum health points
|
|
||||||
strength: Current Strength skill level
|
|
||||||
defense: Current Defense skill level
|
|
||||||
dexterity: Current Dexterity skill level
|
|
||||||
agility: Current Agility skill level
|
|
||||||
charisma: Current Charisma skill level
|
|
||||||
intelligence: Current Intelligence skill level (from BitNode-5)
|
|
||||||
hacking_chance_mult: Hacking Chance multiplier (from Source-Files and Augments)
|
|
||||||
hacking_speed_mult: Hacking Speed multiplier (from Source-Files and Augments)
|
|
||||||
hacking_money_mult: Hacking Money multiplier (from Source-Files and Augments)
|
|
||||||
hacking_grow_mult: Hacking Growth multiplier (from Source-Files and Augments)
|
|
||||||
hacking_exp: Current Hacking experience points
|
|
||||||
strength_exp: Current Strength experience points
|
|
||||||
defense_exp: Current Defense experience points
|
|
||||||
dexterity_exp: Current Dexterity experience points
|
|
||||||
agility_exp: Current Agility experience points
|
|
||||||
charisma_exp: Current Charisma experience points
|
|
||||||
hacking_mult: Hacking Level multiplier (from Source-Files and Augments)
|
|
||||||
strength_mult: Strength Level multiplier (from Source-Files and Augments)
|
|
||||||
defense_mult: Defense Level multiplier (from Source-Files and Augments)
|
|
||||||
dexterity_mult: Dexterity Level multiplier (from Source-Files and Augments)
|
|
||||||
agility_mult: Agility Level multiplier (from Source-Files and Augments)
|
|
||||||
charisma_mult: Charisma Level multiplier (from Source-Files and Augments)
|
|
||||||
hacking_exp_mult: Hacking Experience multiplier (from Source-Files and Augments)
|
|
||||||
strength_exp_mult: Strength Experience multiplier (from Source-Files and Augments)
|
|
||||||
defense_exp_mult: Defense Experience multiplier (from Source-Files and Augments)
|
|
||||||
dexterity_exp_mult: Dexterity Experience multiplier (from Source-Files and Augments)
|
|
||||||
agility_exp_mult: Agility Experience multiplier (from Source-Files and Augments)
|
|
||||||
charisma_exp_mult: Charisma Experience multiplier (from Source-Files and Augments)
|
|
||||||
company_rep_mult: Company reputation gain multiplier (from Source-Files and Augments)
|
|
||||||
faction_rep_mult: Faction reputation gain multiplier (from Source-Files and Augments)
|
|
||||||
money: Current money
|
|
||||||
city: Name of city you are currently in
|
|
||||||
location: Name of the last location visited
|
|
||||||
crime_money_mult: Crime money multiplier (from Source-Files and Augments)
|
|
||||||
crime_success_mult: Crime success multiplier (from Source-Files and Augments)
|
|
||||||
isWorking: Boolean indicating whether the player is currently performing work
|
|
||||||
workType: Name of the kind of work the player is performing
|
|
||||||
currentWorkFactionName: Name of the faction the player is currently working for
|
|
||||||
currentWorkFactionDescription: Description of the kind of work the player is currently doing
|
|
||||||
workHackExpGainRate: Amount of Hacking experience the player will gain every cycle (fifth of a second)
|
|
||||||
workStrExpGainRate: Amount of Strength experience the player will gain every cycle
|
|
||||||
workDefExpGainRate: Amount of Defense experience the player will gain every cycle
|
|
||||||
workDexExpGainRate: Amount of Dexterity experience the player will gain every cycle
|
|
||||||
workAgiExpGainRate: Amount of Agility experience the player will gain every cycle
|
|
||||||
workChaExpGainRate: Amount of Charisma experience the player will gain every cycle
|
|
||||||
workRepGainRate: Amount of Reputation the player will gain every cycle
|
|
||||||
workMoneyGainRate: Amount of Money the player will gain every cycle
|
|
||||||
workMoneyLossRate: Amount of Money the player will lose every cycle
|
|
||||||
workHackExpGained: Total Hacking experience gained while working thus far
|
|
||||||
workStrExpGained: Total Strength experience gained while working thus far
|
|
||||||
workDefExpGained: Total Defense experience gained while working thus far
|
|
||||||
workDexExpGained: Total Dexterity experience gained while working thus far
|
|
||||||
workAgiExpGained: Total Agility experience gained while working thus far
|
|
||||||
workChaExpGained: Total Charisma experience gained while working thus far
|
|
||||||
workRepGained: Total Reputation gained while working thus far
|
|
||||||
workMoneyGained: Total Money gained while working thus far
|
|
||||||
createProgramName: Name of the program the player is currently creating
|
|
||||||
createProgramReqLvl: Hacking skill required to make that program
|
|
||||||
className: Name of the class the player is currently studying
|
|
||||||
crimeType: Name of the crime the player last started
|
|
||||||
work_money_mult: Salary multiplier (from Source-Files and Augments)
|
|
||||||
hacknet_node_money_mult: Hacknet Node production multiplier (from Source-Files and Augments)
|
|
||||||
hacknet_node_purchase_cost_mult: Hacknet Node purchase cost multiplier (from Source-Files and Augments)
|
|
||||||
hacknet_node_ram_cost_mult: Hacknet Node RAM upgrade cost multiplier (from Source-Files and Augments)
|
|
||||||
hacknet_node_core_cost_mult: Hacknet Node Core purchase cost multiplier (from Source-Files and Augments)
|
|
||||||
hacknet_node_level_cost_mult: Hacknet Node level upgrade cost multiplier (from Source-Files and Augments)
|
|
||||||
hasWseAccount: Boolean indicating whether the player has a WSE Account
|
|
||||||
hasTixApiAccess: Boolean indicating whether the player has TIX API Access
|
|
||||||
has4SData: Boolean indicating whether the player has 4S Market Data Access
|
|
||||||
has4SDataTixApi: Boolean indicating whether the player has 4S Market Data TIX API Access
|
|
||||||
bladeburner_max_stamina_mult: Bladeburner Max Stamina multiplier (from Source-Files and Augments)
|
|
||||||
bladeburner_stamina_gain_mult: Bladeburner Stamina Gain multiplier (from Source-Files and Augments)
|
|
||||||
bladeburner_success_chance_mult: Bladeburner Success Chance multiplier (from Source-Files and Augments)
|
|
||||||
bitNodeN: Current BitNode number
|
|
||||||
totalPlaytime: Total amount of time the game has been running, in milliseconds
|
|
||||||
playtimeSinceLastAug: Milliseconds since the last time Augmentations were installed
|
|
||||||
playtimeSinceLastBitnode: Milliseconds since this BitNode was started
|
|
||||||
jobs: A mapping of companies the player works for to the title of the player's job at that company
|
|
||||||
factions: An array of factions the player is currently a member of
|
|
||||||
tor: Boolean indicating whether or not you have a tor router
|
|
||||||
}
|
|
||||||
|
|
||||||
Example::
|
|
||||||
|
|
||||||
player = getPlayer();
|
|
||||||
print('My charisma level is: ' + player.charisma);
|
|
@ -1,11 +0,0 @@
|
|||||||
getPortHandle() Netscript Function
|
|
||||||
==================================
|
|
||||||
|
|
||||||
.. js:function:: getPortHandle(port)
|
|
||||||
|
|
||||||
:RAM cost: 10 GB
|
|
||||||
|
|
||||||
:param number port: Port number
|
|
||||||
:returns: portHandle object. See :ref:`netscript_ports`
|
|
||||||
|
|
||||||
**WARNING:** Port Handles only work in :ref:`netscriptjs`. They will not work in :ref:`netscript1`.
|
|
@ -1,88 +0,0 @@
|
|||||||
getRunningScript() Netscript Function
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
.. js:function:: getRunningScript()
|
|
||||||
|
|
||||||
:RAM cost: 0.3 GB
|
|
||||||
:returns: Script object or null if not found.
|
|
||||||
|
|
||||||
The object has the following properties:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
{
|
|
||||||
// Script arguments
|
|
||||||
args
|
|
||||||
|
|
||||||
// Script filename
|
|
||||||
filename
|
|
||||||
|
|
||||||
// This script's logs. An array of log entries
|
|
||||||
logs
|
|
||||||
|
|
||||||
// Flag indicating whether the logs have been updated since
|
|
||||||
// the last time the UI was updated
|
|
||||||
logUpd
|
|
||||||
|
|
||||||
// Total amount of hacking experience earned from this script when offline
|
|
||||||
offlineExpGained
|
|
||||||
|
|
||||||
// Total amount of money made by this script when offline
|
|
||||||
offlineMoneyMade
|
|
||||||
|
|
||||||
// Number of seconds that the script has been running offline
|
|
||||||
offlineRunningTime
|
|
||||||
|
|
||||||
// Total amount of hacking experience earned from this script when online
|
|
||||||
onlineExpGained
|
|
||||||
|
|
||||||
// Total amount of money made by this script when online
|
|
||||||
onlineMoneyMade
|
|
||||||
|
|
||||||
// Number of seconds that this script has been running online
|
|
||||||
onlineRunningTime
|
|
||||||
|
|
||||||
// Process ID.
|
|
||||||
pid
|
|
||||||
|
|
||||||
// How much RAM this script uses for ONE thread
|
|
||||||
ramUsage
|
|
||||||
|
|
||||||
// IP of the server on which this script is running
|
|
||||||
server
|
|
||||||
|
|
||||||
// Number of threads that this script is running with
|
|
||||||
threads
|
|
||||||
}
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getRunningScript(); // get the current script.
|
|
||||||
|
|
||||||
.. js:function:: getRunningScript(pid)
|
|
||||||
|
|
||||||
:RAM cost: 0.3 GB
|
|
||||||
:param number pid: PID of the script.
|
|
||||||
:returns: Script object or null if not found.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getRunningScript(42); // get the script with pid 42.
|
|
||||||
|
|
||||||
.. js:function:: getRunningScript(fn, hostname[, args...])
|
|
||||||
|
|
||||||
:RAM cost: 0.3 GB
|
|
||||||
:param number fn: Filename of the target script.
|
|
||||||
:param number hostname: Hostname of the server running the script.
|
|
||||||
:param number args...: Arguments that the script is running with.
|
|
||||||
:returns: Script object or null if not found.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getRunningScript("example.script", "home", "foodnstuff"); // get the script called "example.script" on "home" with argument "foodnstuff"
|
|
@ -1,17 +0,0 @@
|
|||||||
getScriptExpGain() Netscript Function
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
.. js:function:: getScriptExpGain([scriptname[, hostname[, args...]]])
|
|
||||||
|
|
||||||
:RAM cost: 0.1 GB
|
|
||||||
:param string scriptname: Filename of script.
|
|
||||||
:param string hostname: Server on which script is running.
|
|
||||||
:param args...: Arguments that the script is running with.
|
|
||||||
:returns: The amount of hacking experience the specified script generates
|
|
||||||
while online.
|
|
||||||
|
|
||||||
This function can also return the total experience gain rate of all of your
|
|
||||||
active scripts by running the function with no arguments.
|
|
||||||
|
|
||||||
.. note:: A script is uniquely identified by both its name and its
|
|
||||||
arguments.
|
|
@ -1,19 +0,0 @@
|
|||||||
getScriptIncome() Netscript Function
|
|
||||||
====================================
|
|
||||||
|
|
||||||
.. js:function:: getScriptIncome([scriptname[, hostname/ip[, [args...]]])
|
|
||||||
|
|
||||||
:RAM cost: 0.1 GB
|
|
||||||
:param string scriptname: Filename of script
|
|
||||||
:param string hostname/ip: Server on which script is running
|
|
||||||
:param args...: Arguments that the script is running with
|
|
||||||
:returns: Amount of income the specified script generates while online.
|
|
||||||
|
|
||||||
If called with no arguments 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.
|
|
||||||
|
|
||||||
.. note:: A script is uniquely identified by both its name and its
|
|
||||||
arguments.
|
|
@ -1,33 +0,0 @@
|
|||||||
getScriptLogs() Netscript Function
|
|
||||||
==================================
|
|
||||||
|
|
||||||
.. js:function:: getScriptLogs([filename[, hostname=current hostname[, args...]]])
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param string filename: Optional. Filename of script to get logs from.
|
|
||||||
:param string hostname: Optional. Hostname of the server running the script.
|
|
||||||
:param args...: Arguments to identify which scripts to get logs for
|
|
||||||
:returns: Array of string, each line being a logged line. Chronological.
|
|
||||||
|
|
||||||
.. note:: There is a maximum number of lines that a script stores in its logs.
|
|
||||||
This is configurable in the game's options.
|
|
||||||
|
|
||||||
If the function is called with no arguments, it will return the current
|
|
||||||
script's logs.
|
|
||||||
|
|
||||||
Otherwise, the ``filename``, ``hostname``, and ``args...`` arguments can be
|
|
||||||
used to get the logs from another script. Remember that scripts are uniquely
|
|
||||||
identified by both their names and arguments.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
// Get logs from foo.script on the current server that was run with no args
|
|
||||||
getScriptLogs("foo.script");
|
|
||||||
|
|
||||||
// Get logs from foo.script on the foodnstuff server that was run with no args
|
|
||||||
getScriptLogs("foo.script", "foodnstuff");
|
|
||||||
|
|
||||||
// Get logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
|
|
||||||
getScriptLogs("foo.script", "foodnstuff", 1, "test");
|
|
@ -1,13 +0,0 @@
|
|||||||
getScriptName() Netscript Function
|
|
||||||
==================================
|
|
||||||
|
|
||||||
.. js:function:: getScriptName()
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:returns: Current script name.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getScriptName(); // returns: "example.script"
|
|
@ -1,28 +0,0 @@
|
|||||||
getServerBaseSecurityLevel() Netscript Function
|
|
||||||
===============================================
|
|
||||||
|
|
||||||
.. js:function:: getServerBaseSecurityLevel(hostname)
|
|
||||||
|
|
||||||
:RAM cost: 0.1 GB
|
|
||||||
:param string hostname: Hostname of target server.
|
|
||||||
:returns: Base security level of target server.
|
|
||||||
|
|
||||||
The base security level is the security level that the server starts out with.
|
|
||||||
|
|
||||||
This function isn't particularly useful.
|
|
||||||
:doc:`getServerSecurityLevel<getServerSecurityLevel>` and
|
|
||||||
:doc:`getServerMinSecurityLevel<getServerMinSecurityLevel>` are more often
|
|
||||||
used.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getServerBaseSecurityLevel('foodnstuff'); // returns: 9
|
|
||||||
|
|
||||||
.. note:: This is different than :doc:`getServerSecurityLevel<getServerSecurityLevel>`
|
|
||||||
because :doc:`getServerSecurityLevel<getServerSecurityLevel>` returns the current
|
|
||||||
security level of a server, which can constantly change due to
|
|
||||||
:doc:`hack<hack>`, :doc:`grow<grow>`, and :doc:`weaken<weaken>` calls on
|
|
||||||
that server. The base security level will stay the same until you reset
|
|
||||||
by installing augmentation(s).
|
|
@ -1,19 +0,0 @@
|
|||||||
getServerGrowth() Netscript Function
|
|
||||||
====================================
|
|
||||||
|
|
||||||
.. js:function:: getServerGrowth(hostname)
|
|
||||||
|
|
||||||
:RAM cost: 0.1 GB
|
|
||||||
:param string hostname: Hostname of target server.
|
|
||||||
:returns: Server growth parameter.
|
|
||||||
|
|
||||||
The growth parameter is a number, typically between 1 and 100, that affects
|
|
||||||
the percentage by which the server's money is increased when using the
|
|
||||||
:doc:`grow<grow>` function. A higher growth parameter will result in a
|
|
||||||
higher percentage increase.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getServerGrowth('foodnstuff'); // returns: 5
|
|
@ -1,25 +0,0 @@
|
|||||||
getServerRam() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: getServerRam(hostname)
|
|
||||||
|
|
||||||
.. warning:: This function is deprecated. It still functions, but new
|
|
||||||
scripts should prefer :doc:`getServerMaxRam<getServerMaxRam>`
|
|
||||||
and :doc:`getServerUsedRam<getServerUsedRam>` instead.
|
|
||||||
|
|
||||||
:RAM cost: 0.1 GB
|
|
||||||
:param string hostname: Hostname of target server.
|
|
||||||
:returns: An array of 2 numbers; the first number is the total RAM, and the
|
|
||||||
second is the used RAM.
|
|
||||||
|
|
||||||
Returns an array with two elements that gives information about a server's memory (RAM). The first
|
|
||||||
element in the array is the amount of RAM that the server has total (in GB). The second element in
|
|
||||||
the array is the amount of RAM that is currently being used on the server (in GB).
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
res = getServerRam("helios"); // returns: [5, 10]
|
|
||||||
totalRam = res[0];
|
|
||||||
ramUsed = res[1];
|
|
@ -1,13 +0,0 @@
|
|||||||
getTimeSinceLastAug() Netscript Function
|
|
||||||
========================================
|
|
||||||
|
|
||||||
.. js:function:: getTimeSinceLastAug()
|
|
||||||
|
|
||||||
:RAM cost: 0.05 GB
|
|
||||||
:returns: Milliseconds since you last installed augmentations.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getTimeSinceLastAug(); // returns: 13912400
|
|
@ -1,21 +0,0 @@
|
|||||||
getWeakenTime() Netscript Function
|
|
||||||
==================================
|
|
||||||
|
|
||||||
.. js:function:: getWeakenTime(hostname[, hackLvl=current level])
|
|
||||||
|
|
||||||
:RAM cost: 0.05 GB
|
|
||||||
:param string hostname: Hostname of target server.
|
|
||||||
:returns: seconds it takes to execute the :doc:`weaken<weaken>` Netscript
|
|
||||||
function on the target server.
|
|
||||||
|
|
||||||
The function takes in an optional *hackLvl* parameter that can be specified
|
|
||||||
to see what the weaken time would be at different hacking levels.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
getWeakenTime("foodnstuff"); // returns: 34.5
|
|
||||||
|
|
||||||
.. note:: For Hacknet Servers (the upgraded version of a Hacknet Node), this function will
|
|
||||||
return :code:`Infinity`.
|
|
@ -20,8 +20,7 @@ grow() Netscript Function
|
|||||||
server will be increased by a certain, fixed percentage. This percentage is
|
server will be increased by a certain, fixed percentage. This percentage is
|
||||||
determined by the target server's growth rate (which varies between servers)
|
determined by the target server's growth rate (which varies between servers)
|
||||||
and security level. Generally, higher-level servers have higher growth
|
and security level. Generally, higher-level servers have higher growth
|
||||||
rates. The :doc:`getServerGrowth<getServerGrowth>` function can be used to
|
rates.
|
||||||
obtain a server's growth rate.
|
|
||||||
|
|
||||||
Like :doc:`hack<hack>`, :doc:`grow<grow>` can be called on any server, from
|
Like :doc:`hack<hack>`, :doc:`grow<grow>` can be called on any server, from
|
||||||
any server. The :doc:`grow<grow>` command requires root access to the target
|
any server. The :doc:`grow<grow>` command requires root access to the target
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
growthAnalyze() Netscript Function
|
|
||||||
==================================
|
|
||||||
|
|
||||||
.. js:function:: growthAnalyze(hostname, growthAmount[, cores])
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:param string hostname: Hostname of server to analyze.
|
|
||||||
:param number growthAmount: Multiplicative factor by which the server is
|
|
||||||
grown. Decimal form. Must be >= 1.
|
|
||||||
:param number cores: Amount of cores on the server that would run the growth, defaults to 1
|
|
||||||
:returns: The amount of :doc:`grow<grow>` threads needed to grow the specified
|
|
||||||
server by the specified amount.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
// How many grow threads are needed to double the current money on 'foodnstuff'
|
|
||||||
growthAnalyze("foodnstuff", 2); // returns: 5124
|
|
||||||
|
|
||||||
If this returns 5124, then this means you need to call :doc:`grow<grow>`
|
|
||||||
5124 times in order to double the money (or once with 5124 threads).
|
|
||||||
|
|
||||||
**Warning**: The value returned by this function isn't necessarily a whole number.
|
|
@ -1,22 +0,0 @@
|
|||||||
hackAnalyzePercent() Netscript Function
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
.. js:function:: hackAnalyzePercent(hostname)
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:param string hostname: Hostname of target server.
|
|
||||||
:returns: The percentage of money you will steal from the target server with
|
|
||||||
a single hack.
|
|
||||||
|
|
||||||
Returns the percentage of the specified server's money you will steal with a
|
|
||||||
single hack. This value is returned in percentage form, not decimal.
|
|
||||||
|
|
||||||
For example, assume the following returns 1:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
hackAnalyzePercent("foodnstuff"); // returns: 1
|
|
||||||
|
|
||||||
This means that if hack the 'foodnstuff' server, then you will steal 1% of its
|
|
||||||
total money. If you :doc:`hack<hack>` using N threads, then you will steal N% of its total
|
|
||||||
money.
|
|
@ -1,37 +0,0 @@
|
|||||||
hackAnalyzeThreads() Netscript Function
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
.. js:function:: hackAnalyzeThreads(hostname, hackAmount)
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:param string hostname: Hostname of server to analyze.
|
|
||||||
:param number hackAmount: Amount of money you want to hack from the server.
|
|
||||||
:returns: The number of threads needed to :doc:`hack<hack>` the server for
|
|
||||||
``hackAmount`` money.
|
|
||||||
|
|
||||||
This function returns the number of script threads you need when running
|
|
||||||
the :doc:`hack<hack>` command to steal the specified amount of money from
|
|
||||||
the target server.
|
|
||||||
|
|
||||||
If ``hackAmount`` is less than zero or greater than the amount of money
|
|
||||||
available on the server, then this function returns -1.
|
|
||||||
|
|
||||||
For example, let's say the 'foodnstuff' server has $10m and you run:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
hackAnalyzeThreads("foodnstuff", 1e6);
|
|
||||||
|
|
||||||
If this function returns 50, this means that if your next :doc:`hack<hack>` call
|
|
||||||
is run on a script with 50 threads, it will steal $1m from the `foodnstuff` server.
|
|
||||||
|
|
||||||
.. warning:: The value returned by this function isn't necessarily a whole number.
|
|
||||||
.. warning:: It is possible for this function to return :code:`Infinity` or :code:`NaN` in
|
|
||||||
certain uncommon scenarios. This is because in JavaScript:
|
|
||||||
|
|
||||||
* :code:`0 / 0 = NaN`
|
|
||||||
* :code:`N / 0 = Infinity` for 0 < N < Infinity.
|
|
||||||
|
|
||||||
For example, if a server has no money available and you want to hack some positive
|
|
||||||
amount from it, then the function would return :code:`Infinity` because
|
|
||||||
this would be impossible.
|
|
@ -1,16 +0,0 @@
|
|||||||
hackChance() Netscript Function
|
|
||||||
===============================
|
|
||||||
|
|
||||||
.. js:function:: hackChance(hostname)
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:param string hostname: Hostname of target server.
|
|
||||||
:returns: The chance you have of successfully hacking the target server.
|
|
||||||
in decimal form.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
hackChance("foodnstuff"); // returns: .5
|
|
||||||
// So 50% chance to hack "foodnstuff"
|
|
@ -1,22 +0,0 @@
|
|||||||
nFormat() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: nFormat(n, format)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param number n: number to format
|
|
||||||
:param string format: The format to use.
|
|
||||||
|
|
||||||
Converts a number into a string with the specified format. This uses the
|
|
||||||
`numeraljs <http://numeraljs.com/>`_ library, so the formatters must be
|
|
||||||
compatible with that.
|
|
||||||
|
|
||||||
The game uses the ``$0.000a`` format to display money.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
nFormat(1.23e9, "$0.000a"); // returns: "$1.230b"
|
|
||||||
nFormat(12345.678, "0,0"); // returns: "12,346"
|
|
||||||
nFormat(0.84, "0.0%"); // returns: "84.0%"
|
|
@ -1,14 +0,0 @@
|
|||||||
peek() Netscript Function
|
|
||||||
=========================
|
|
||||||
|
|
||||||
.. js:function:: peek(port)
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:param number port: Port to peek. Must be an integer between 1 and 20.
|
|
||||||
:returns: First element on that port.
|
|
||||||
|
|
||||||
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 :ref:`netscript_ports` work here
|
|
@ -1,23 +0,0 @@
|
|||||||
prompt() Netscript Function
|
|
||||||
===========================
|
|
||||||
|
|
||||||
.. js:function:: prompt(txt)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param string txt: Text to appear in the prompt dialog box.
|
|
||||||
:returns: ``true`` if the player clicks "Yes".
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
cost = getPurchasedServerCost(8192);
|
|
||||||
answer = prompt("Buy a server for $"+cost);
|
|
||||||
if(answer) {
|
|
||||||
purchaseServer("my server", 8192);
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
read() Netscript Function
|
|
||||||
=========================
|
|
||||||
|
|
||||||
.. js:function:: read(portOrFilename)
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:param string/number portOrFilename: Port or text file to read from.
|
|
||||||
|
|
||||||
This function is used to read data from a port, a text file (.txt), or a
|
|
||||||
script (.script, .js, .ns).
|
|
||||||
|
|
||||||
If the argument ``portOrFilename`` is a number between 1 and 20, then it
|
|
||||||
specifies a port and it will read data from that port. Read about how
|
|
||||||
:ref:`netscript_ports` work here. 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.
|
|
||||||
|
|
||||||
If the argument ``portOrFilename`` is a string, then it specifies the name
|
|
||||||
of a text file or script and this function will return the data in the
|
|
||||||
specified text file/script. If the text file does not exist, an empty string
|
|
||||||
will be returned.
|
|
@ -1,13 +0,0 @@
|
|||||||
rm() Netscript Function
|
|
||||||
=======================
|
|
||||||
|
|
||||||
.. js:function:: rm(filename[, hostname=current server])
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:param string filename: Filename of file to remove. Must include the extension.
|
|
||||||
:param string hostname: Hostname address of the server on which to delete
|
|
||||||
the file. Optional. Defaults to current server
|
|
||||||
:returns: ``true`` if it successfully deletes the file.
|
|
||||||
|
|
||||||
Removes the specified file from the current server. This function works for
|
|
||||||
every file type except ``.msg`` files.
|
|
@ -1,8 +0,0 @@
|
|||||||
sprintf() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: sprintf()
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
|
|
||||||
See `this link <https://github.com/alexei/sprintf.js>`_ for details.
|
|
@ -1,17 +0,0 @@
|
|||||||
tFormat() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: tFormat(milliseconds[, milliPrecision=false])
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param number milliseconds: Amount of milliseconds to format.
|
|
||||||
:param number milliPrecision: Display time with millisecond precision.
|
|
||||||
:returns: milliseconds in the "D M H S" format
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
tFormat(3000); // returns: "3 seconds"
|
|
||||||
tFormat(10000000); // returns: "2 hours 46 minutes 40 seconds"
|
|
||||||
tFormat(10000023, true); // returns: "2 hours 46 minutes 40.023 seconds"
|
|
@ -1,58 +0,0 @@
|
|||||||
tail() Netscript Function
|
|
||||||
==================================
|
|
||||||
|
|
||||||
.. js:function:: tail([fn[, hostname=current hostname[, ...args]])
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param string fn: Optional. Filename of script to get logs from.
|
|
||||||
:param string hostname: Optional. Hostname of the server that the script is on.
|
|
||||||
:param args...: Arguments to identify which scripts to get logs for.
|
|
||||||
|
|
||||||
Opens a script's logs. This is functionally the same as the
|
|
||||||
:ref:`tail_terminal_command` Terminal command.
|
|
||||||
|
|
||||||
If the function is called with no arguments, it will open the current script's logs.
|
|
||||||
|
|
||||||
Otherwise, the ``fn``, ``hostname``, and ``args...`` arguments can be
|
|
||||||
used to get the logs from another script. Remember that scripts are uniquely
|
|
||||||
identified by both their names and arguments.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
// Open logs from foo.script on the current server that was run with no args
|
|
||||||
tail("foo.script");
|
|
||||||
|
|
||||||
// Open logs from foo.script on the foodnstuff server that was run with no args
|
|
||||||
tail("foo.script", "foodnstuff");
|
|
||||||
|
|
||||||
// Open logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
|
|
||||||
tail("foo.script", "foodnstuff", 1, "test");
|
|
||||||
|
|
||||||
.. js:function:: tail(scriptPid)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param number scriptPid: PID of the script to tail.
|
|
||||||
|
|
||||||
Opens a script's logs by pid
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
// Open logs from process with id 42
|
|
||||||
tail(42);
|
|
||||||
|
|
||||||
.. js:function:: tail()
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
|
|
||||||
Opens the current script logs.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
// Open the current script logs.
|
|
||||||
tail();
|
|
@ -1,17 +0,0 @@
|
|||||||
toast() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: toast(message[, variant])
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param string message: message to display
|
|
||||||
:param success|info|warning|error variant: color of the toast
|
|
||||||
|
|
||||||
Spawns a toast (those bottom right notifications, like "Game Saved!" ).
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
toast("Reached $1b");
|
|
||||||
toast("Failed to hack home", "error");
|
|
@ -1,17 +0,0 @@
|
|||||||
tprint() Netscript Function
|
|
||||||
===========================
|
|
||||||
|
|
||||||
.. js:function:: tprintf(format, args...)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param format: Format of the string to be printed.
|
|
||||||
:param args: Values to be formatted
|
|
||||||
|
|
||||||
Prints a raw formatted string to the terminal.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
tprintf("Hello world!"); // Prints "Hello world!" to the terminal.
|
|
||||||
tprintf("Hello %s", "world!"); // Prints "Hello world!" to the terminal.
|
|
@ -1,14 +0,0 @@
|
|||||||
tryWrite() Netscript Function
|
|
||||||
=============================
|
|
||||||
|
|
||||||
.. js:function:: tryWrite(port, data="")
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:param number port: Port to be written to
|
|
||||||
:param string data: Data to try to write
|
|
||||||
:returns: ``true`` if the data is successfully written to the port.
|
|
||||||
|
|
||||||
Attempts to write data to the specified Netscript Port. If the port is full,
|
|
||||||
the data will not be written. Otherwise, the data will be written normally.
|
|
||||||
|
|
||||||
See :ref:`netscript_ports` for more details.
|
|
@ -1,8 +0,0 @@
|
|||||||
vsprintf() Netscript Function
|
|
||||||
=============================
|
|
||||||
|
|
||||||
.. js:function:: vsprintf()
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
|
|
||||||
See `this link <https://github.com/alexei/sprintf.js>`_ for details.
|
|
@ -1,31 +0,0 @@
|
|||||||
wget() Netscript Function
|
|
||||||
=========================
|
|
||||||
|
|
||||||
.. js:function:: wget(url, target[, hostname=current hostname])
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param string url: URL to pull data from
|
|
||||||
:param string target: Filename to write data to. Must be script or text file
|
|
||||||
:param string ip: Optional hostname of server for target file.
|
|
||||||
|
|
||||||
Retrieves data from a URL and downloads it to a file on the specified server. The data can only
|
|
||||||
be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists,
|
|
||||||
it will be overwritten by this command.
|
|
||||||
|
|
||||||
Note that it will not be possible to download data from many websites because they do not allow
|
|
||||||
cross-origin resource sharing (CORS). Example::
|
|
||||||
|
|
||||||
wget("https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md", "game_readme.txt");
|
|
||||||
|
|
||||||
**IMPORTANT:** This is an asynchronous function that returns a Promise. The Promise's resolved
|
|
||||||
value will be a boolean indicating whether or not the data was successfully
|
|
||||||
retrieved from the URL. Because the function is async and returns a Promise,
|
|
||||||
it is recommended you use ``wget`` in :ref:`netscriptjs`.
|
|
||||||
|
|
||||||
In NetscriptJS, you must preface any call to
|
|
||||||
``wget`` with the ``await`` keyword (like you would ``hack`` or ``sleep``).
|
|
||||||
|
|
||||||
``wget`` will still work in :ref:`netscript1`, but the functions execution will not
|
|
||||||
be synchronous (i.e. it may not execute when you expect/want it to). Furthermore, since Promises are not
|
|
||||||
supported in ES5, you will not be able to process the returned value of ``wget`` in
|
|
||||||
Netscript 1.0.
|
|
@ -1,26 +0,0 @@
|
|||||||
write() Netscript Function
|
|
||||||
===========================
|
|
||||||
|
|
||||||
.. js:function:: write(portOrFilename, data="", mode="a")
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:param string/number portOrFilename: Port or text file/script that will be written to
|
|
||||||
:param string data: Data to write
|
|
||||||
:param string mode: Defines the write mode. Only valid when writing to text files or scripts.
|
|
||||||
|
|
||||||
This function can be used to either write data to a port, a text file
|
|
||||||
(.txt), or a script (.script, .js, .ns)
|
|
||||||
|
|
||||||
If the first argument is a number between 1 and 20, then it specifies a port
|
|
||||||
and this function will write ``data`` to that port. Read about how
|
|
||||||
:ref:`netscript_ports` work here. The third argument, ``mode``, is not used
|
|
||||||
when writing to a port.
|
|
||||||
|
|
||||||
If the first argument is a string, then it specifies the name of a text file
|
|
||||||
or script and this function will write ``data`` to that text file/script. If
|
|
||||||
the specified text file/script does not exist, then it will be created. The
|
|
||||||
third argument ``mode``, defines how the data will be written. If ``mode``
|
|
||||||
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/script. If ``mode`` 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 file.
|
|
@ -1,15 +0,0 @@
|
|||||||
getActionAutolevel() Netscript Function
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
.. js:function:: getActionAutolevel(type, name)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:returns: ``true`` if this action is set to auto level.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getActionAutolevel("Contracts", "Tracking"); // returns: true
|
|
@ -1,21 +0,0 @@
|
|||||||
getActionCountRemaining() Netscript Function
|
|
||||||
============================================
|
|
||||||
|
|
||||||
.. js:function:: getActionCountRemaining(type, name)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:returns: Remaining action count. -1 for invalid actions.
|
|
||||||
|
|
||||||
Note that this is meant to be used for 'Contracts' and 'Operations'.
|
|
||||||
This function will return 'Infinity' for actions such as 'Training' and
|
|
||||||
'Field Analysis'.
|
|
||||||
This function will return 1 for BlackOps not yet completed regardless of
|
|
||||||
whether the player has the required rank to attempt the mission or not.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getActionCountRemaining("Contracts", "Tracking"); // returns: 124
|
|
@ -1,15 +0,0 @@
|
|||||||
getActionCurrentLevel() Netscript Function
|
|
||||||
==========================================
|
|
||||||
|
|
||||||
.. js:function:: getActionCurrentLevel(type, name)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match.
|
|
||||||
:returns: Action current level, -1 for invalid actions.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getActionCurrentLevel("Contracts", "Tracking"); // returns: 9
|
|
@ -1,15 +0,0 @@
|
|||||||
getActionEstimatedSuccessChance() Netscript Function
|
|
||||||
====================================================
|
|
||||||
|
|
||||||
.. js:function:: getActionEstimatedSuccessChance(type, name)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:returns: Array of 2 number, lower and upper bound of the action chance.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getActionEstimatedSuccessChance("Contracts", "Tracking"); // returns: [.3, .6]
|
|
@ -1,15 +0,0 @@
|
|||||||
getActionMaxLevel() Netscript Function
|
|
||||||
======================================
|
|
||||||
|
|
||||||
.. js:function:: getActionMaxLevel(type, name)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:returns: Action max level, -1 for invalid actions.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getActionMaxLevel("Contracts", "Tracking"); // returns: 15
|
|
@ -1,18 +0,0 @@
|
|||||||
getActionRepGain() Netscript Function
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
.. js:function:: getActionRepGain(type, name[, level=current level])
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:param number level: Optional action level at which to calculate the gain.
|
|
||||||
:returns: Average Bladeburner reputation gain for successfully completing
|
|
||||||
the specified action. Note that this value is an 'average' and the real
|
|
||||||
reputation gain may vary slightly from this value.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getActionRepGain("Contracts", "Tracking"); // returns: 341
|
|
@ -1,16 +0,0 @@
|
|||||||
getActionTime() Netscript Function
|
|
||||||
==================================
|
|
||||||
|
|
||||||
.. js:function:: getActionTime(type, name)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:returns: Number of seconds it takes to complete the specified action.
|
|
||||||
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getActionTime("Contracts", "Tracking"); // returns: 4
|
|
@ -1,13 +0,0 @@
|
|||||||
getBlackOpNames() Netscript Function
|
|
||||||
====================================
|
|
||||||
|
|
||||||
.. js:function:: getBlackOpNames()
|
|
||||||
|
|
||||||
:RAM cost: 0.4 GB
|
|
||||||
:returns: Array of strings containing the names of all Bladeburner Black Ops.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getBlackOpNames(); // returns: ["Operation Typhoon"]
|
|
@ -1,14 +0,0 @@
|
|||||||
getBlackOpRank() Netscript Function
|
|
||||||
====================================
|
|
||||||
|
|
||||||
.. js:function:: getBlackOpRank(name)
|
|
||||||
|
|
||||||
:RAM cost: 2 GB
|
|
||||||
:param string name: name of the BlackOp. Must be an exact match.
|
|
||||||
:returns: Rank required to complete this BlackOp. -1 for invalid BlackOp.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getBlackOpRank("Operation Typhoon"); // returns: 2500
|
|
@ -1,21 +0,0 @@
|
|||||||
getBonusTime() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: getBonusTime()
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:returns: Amount of accumulated "bonus time" (seconds) for the Bladeburner mechanic.
|
|
||||||
|
|
||||||
"Bonus time" is accumulated when the game is offline or if the game is
|
|
||||||
inactive in the browser.
|
|
||||||
|
|
||||||
"Bonus time" makes the game progress faster, up to 5x the normal speed.
|
|
||||||
For example, if an action takes 30 seconds to complete but you've accumulated
|
|
||||||
over 30 seconds in bonus time, then the action will only take 6 seconds
|
|
||||||
in real life to complete.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getBonusTime(); // returns: 130
|
|
@ -1,13 +0,0 @@
|
|||||||
getCity() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: getCity()
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:returns: City that the player is currently in (for Bladeburner).
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getCity(); // returns: "Sector-12"
|
|
@ -1,14 +0,0 @@
|
|||||||
getCityChaos() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: getCityChaos(cityName)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string cityName: Name of city. Case-sensitive
|
|
||||||
:returns: Chaos in the specified city, or -1 if an invalid city was specified.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getCityChaos("Sector-12"); // returns: 3800.1
|
|
@ -1,15 +0,0 @@
|
|||||||
getCityCommunities() Netscript Function
|
|
||||||
================================================
|
|
||||||
|
|
||||||
.. js:function:: getCityCommunities(cityName)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string cityName: Name of city. Case-sensitive
|
|
||||||
:returns: Confirmed number of Synthoid communities in the specified city,
|
|
||||||
or -1 if an invalid city was specified.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getCityCommunities("Sector-12"); // returns: 76
|
|
@ -1,15 +0,0 @@
|
|||||||
getCityEstimatedPopulation() Netscript Function
|
|
||||||
===============================================
|
|
||||||
|
|
||||||
.. js:function:: getCityEstimatedPopulation(cityName)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string cityName: Name of city. Case-sensitive
|
|
||||||
:returns: Estimated number of Synthoids in the specified city, or -1 if an
|
|
||||||
invalid city was specified.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getCityEstimatedPopulation("Sector-12"); // returns: 1240000
|
|
@ -1,13 +0,0 @@
|
|||||||
getContractNames() Netscript Function
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
.. js:function:: getContractNames()
|
|
||||||
|
|
||||||
:RAM cost: 0.4 GB
|
|
||||||
:returns: Array of strings containing the names of all Bladeburner contracts.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getContractNames(); // returns: ["Tracking"]
|
|
@ -1,25 +0,0 @@
|
|||||||
getCurrentAction() Netscript Function
|
|
||||||
=====================================
|
|
||||||
|
|
||||||
.. js:function:: getCurrentAction()
|
|
||||||
|
|
||||||
:RAM cost: 1 GB
|
|
||||||
:returns: An object that represents the player's current Bladeburner action.
|
|
||||||
|
|
||||||
Result::
|
|
||||||
|
|
||||||
{
|
|
||||||
type: Type of Action
|
|
||||||
name: Name of Action
|
|
||||||
}
|
|
||||||
|
|
||||||
If the player is not performing an action, the function will return an object
|
|
||||||
with the 'type' property set to "Idle".
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
action = bladeburner.getCurrentAction();
|
|
||||||
print(action.type); // "Contracts"
|
|
||||||
print(action.name); // "Tracking"
|
|
@ -1,13 +0,0 @@
|
|||||||
getGeneralActionNames() Netscript Function
|
|
||||||
==========================================
|
|
||||||
|
|
||||||
.. js:function:: getGeneralActionNames()
|
|
||||||
|
|
||||||
:RAM cost: 0.4 GB
|
|
||||||
:returns: Array of strings containing the names of all general Bladeburner actions.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getGeneralActionNames(); // returns: ["Training"]
|
|
@ -1,13 +0,0 @@
|
|||||||
getOperationNames() Netscript Function
|
|
||||||
======================================
|
|
||||||
|
|
||||||
.. js:function:: getOperationNames()
|
|
||||||
|
|
||||||
:RAM cost: 0.4 GB
|
|
||||||
:returns: Array of strings containing the names of all Bladeburner operations.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getOperationNames(); // returns: ["Investigation"]
|
|
@ -1,13 +0,0 @@
|
|||||||
getRank() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: getRank()
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:returns: Player's Bladeburner Rank.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getRank(); // returns: 87135
|
|
@ -1,14 +0,0 @@
|
|||||||
getSkillLevel() Netscript Function
|
|
||||||
==================================
|
|
||||||
|
|
||||||
.. js:function:: getSkillLevel(skillName)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string skillName: Name of skill. Case-sensitive.
|
|
||||||
:returns: Level of specified skill, -1 for invalid skills.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getSkillLevel("Overclock"); // returns: 90
|
|
@ -1,13 +0,0 @@
|
|||||||
getSkillNames() Netscript Function
|
|
||||||
==================================
|
|
||||||
|
|
||||||
.. js:function:: getSkillNames()
|
|
||||||
|
|
||||||
:RAM cost: 0.4 GB
|
|
||||||
:returns: Array of strings containing the names of all Bladeburner skills.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getSkillNames(); // returns: ["Overclock"]
|
|
@ -1,13 +0,0 @@
|
|||||||
getSkillPoints() Netscript Function
|
|
||||||
===================================
|
|
||||||
|
|
||||||
.. js:function:: getSkillPoints()
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:returns: Amount of Bladeburner skill points you have.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getSkillPoints(); // returns: 1630
|
|
@ -1,14 +0,0 @@
|
|||||||
getSkillUpgradeCost() Netscript Function
|
|
||||||
========================================
|
|
||||||
|
|
||||||
.. js:function:: getSkillUpgradeCost(skillName)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string skillName: Name of skill. Case-sensitive and must be an exact match
|
|
||||||
:returns: Amount of skill points needed to upgrade the specified skill. -1 for invalid skills.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getSkillUpgradeCost("Overclock"); // returns: 120
|
|
@ -1,14 +0,0 @@
|
|||||||
getStamina() Netscript Function
|
|
||||||
===============================
|
|
||||||
|
|
||||||
.. js:function:: getStamina()
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:returns: Array with two elements [Current stamina, Max stamina]
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
res = bladeburner.getStamina();
|
|
||||||
percentage = res[0] / res[1];
|
|
@ -1,19 +0,0 @@
|
|||||||
getTeamSize() Netscript Function
|
|
||||||
================================
|
|
||||||
|
|
||||||
.. js:function:: getTeamSize(type, name)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:returns: Number of Bladeburner team members you have assigned to the
|
|
||||||
specified action.
|
|
||||||
|
|
||||||
Setting a team is only applicable for Operations and BlackOps. This function
|
|
||||||
will return 0 for other action types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.getTeamSize("Operations", "Investigation"); // returns: 7
|
|
@ -1,16 +0,0 @@
|
|||||||
joinBladeburnerDivision() Netscript Function
|
|
||||||
============================================
|
|
||||||
|
|
||||||
.. js:function:: joinBladeburnerDivision()
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:returns: ``true`` if you successfully join the Bladeburner division, or if you
|
|
||||||
are already a member.
|
|
||||||
|
|
||||||
Attempts to join the Bladeburner division.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.joinBladeburnerDivision(); // returns: true
|
|
@ -1,16 +0,0 @@
|
|||||||
joinBladeburnerFaction() Netscript Function
|
|
||||||
===========================================
|
|
||||||
|
|
||||||
.. js:function:: joinBladeburnerFaction()
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:returns: ``true`` if you successfully join the Bladeburner faction, or if
|
|
||||||
you are already a member.
|
|
||||||
|
|
||||||
Attempts to join the Bladeburner faction.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.joinBladeburnerFaction(); // returns: true
|
|
@ -1,17 +0,0 @@
|
|||||||
setActionAutolevel() Netscript Function
|
|
||||||
=======================================
|
|
||||||
|
|
||||||
.. js:function:: setActionAutolevel(type, name, autoLevel)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:param boolean autoLevel: Whether or not to autolevel this action
|
|
||||||
|
|
||||||
Enable/disable autoleveling for the specified action.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.setActionAutolevel("Contracts", "Tracking", true);
|
|
@ -1,17 +0,0 @@
|
|||||||
setActionLevel() Netscript Function
|
|
||||||
===================================
|
|
||||||
|
|
||||||
.. js:function:: setActionLevel(type, name, level)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:param level int: Level to set this action to
|
|
||||||
|
|
||||||
Set the level for the specified action.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.setActionLevel("Contracts", "Tracking", 10);
|
|
@ -1,18 +0,0 @@
|
|||||||
setTeamSize() Netscript Function
|
|
||||||
================================
|
|
||||||
|
|
||||||
.. js:function:: setTeamSize(type, name, size)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:param int size: Number of team members to set. Will be converted using Math.round()
|
|
||||||
:returns: Team size or -1 for invalid actions.
|
|
||||||
|
|
||||||
Set the team size for the specified Bladeburner action.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.setTeamSize("Operations", "Investigation", 7);
|
|
@ -1,17 +0,0 @@
|
|||||||
startAction() Netscript Function
|
|
||||||
================================
|
|
||||||
|
|
||||||
.. js:function:: startAction(type, name)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
|
||||||
:param string name: Name of action. Must be an exact match
|
|
||||||
:returns: ``true`` if the action was started successfully.
|
|
||||||
|
|
||||||
Attempts to start the specified Bladeburner action.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.startAction("Contracts", "Tracking"); // returns: true
|
|
@ -1,14 +0,0 @@
|
|||||||
stopBladeburnerAction() Netscript Function
|
|
||||||
==========================================
|
|
||||||
|
|
||||||
.. js:function:: stopBladeburnerAction()
|
|
||||||
|
|
||||||
:RAM cost: 2 GB
|
|
||||||
|
|
||||||
Stops the current Bladeburner action
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.stopBladeburnerAction();
|
|
@ -1,16 +0,0 @@
|
|||||||
switchCity() Netscript Function
|
|
||||||
===============================
|
|
||||||
|
|
||||||
.. js:function:: switchCity(cityName)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string cityName: Name of city
|
|
||||||
:returns: ``true`` if successful.
|
|
||||||
|
|
||||||
Attempts to switch to the specified city (for Bladeburner only).
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.switchCity("Sector-12"); // returns: true
|
|
@ -1,16 +0,0 @@
|
|||||||
upgradeSkill() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: upgradeSkill(skillName)
|
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
|
||||||
:param string skillName: Name of Skill to be upgraded. Case-sensitive and must be an exact match
|
|
||||||
:returns: ``true`` if the skill is successfully upgraded.
|
|
||||||
|
|
||||||
Attempts to upgrade the specified Bladeburner skill.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
bladeburner.upgradeSkill("Overclock"); // returns: true
|
|
@ -1,27 +0,0 @@
|
|||||||
attempt() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: attempt(answer, filename[, hostname=current hostname[, opts={}]])
|
|
||||||
|
|
||||||
:RAM cost: 10 GB
|
|
||||||
:param answer: Solution for the contract
|
|
||||||
:param string filename: Filename of the contract
|
|
||||||
:param string hostname: Hostname of the server containing the contract.
|
|
||||||
Optional. Defaults to current server if not provided
|
|
||||||
:param object opts: Optional parameters for configuring function behavior. Properties:
|
|
||||||
|
|
||||||
* returnReward (*boolean*) If truthy, then the function will return a string
|
|
||||||
that states the contract's reward when it is successfully solved.
|
|
||||||
:returns: ``true`` if the solution was correct. If the :code:`returnReward`
|
|
||||||
option is configured, then the function will instead return a
|
|
||||||
string. If the contract is successfully solved, the string will
|
|
||||||
contain a description of the contract's reward. Otherwise, it will
|
|
||||||
be an empty string.
|
|
||||||
|
|
||||||
Attempts to solve the Coding Contract with the provided solution.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
codingcontract.attempt("myanswer!", "contract-123.cct", "home");
|
|
@ -1,19 +0,0 @@
|
|||||||
getContractType() Netscript Function
|
|
||||||
====================================
|
|
||||||
|
|
||||||
.. js:function:: getContractType(filename[, hostname=current hostname])
|
|
||||||
|
|
||||||
:RAM cost: 5 GB
|
|
||||||
:param string filename: Filename of the contract
|
|
||||||
:param string hostname: Hostname of the server containing the contract.
|
|
||||||
Optional. Defaults to current server if not provided
|
|
||||||
:returns: A string with the contract's problem type
|
|
||||||
|
|
||||||
Describes the type of problem posed by the Coding Contract.
|
|
||||||
(e.g. Find Largest Prime Factor, Total Ways to Sum, etc.)
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
codingcontract.getContractType("contract-123.cct", "home");
|
|
@ -1,23 +0,0 @@
|
|||||||
getData() Netscript Function
|
|
||||||
============================
|
|
||||||
|
|
||||||
.. js:function:: getData(filename[, hostname=current hostname])
|
|
||||||
|
|
||||||
:RAM cost: 5 GB
|
|
||||||
:param string filename: Filename of the contract
|
|
||||||
:param string hostname: Hostname of the server containing the contract.
|
|
||||||
Optional. Defaults to current server if not provided
|
|
||||||
:returns: The specified contract's data. Different data type depending on
|
|
||||||
contract type.
|
|
||||||
|
|
||||||
Get the data associated with the specific Coding Contract. Note that this is
|
|
||||||
not the same as the contract's description; this is just the data that
|
|
||||||
the contract wants you to act on in order to solve.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
data = codingcontract.getData("contract-123.cct", "home");
|
|
||||||
answer = solve(data);
|
|
||||||
codingcontract.attempt(answer, "contract-123.cct", "home");
|
|
@ -1,18 +0,0 @@
|
|||||||
getDescription() Netscript Function
|
|
||||||
===================================
|
|
||||||
|
|
||||||
.. js:function:: getDescription(filename[, hostname=current hostname])
|
|
||||||
|
|
||||||
:RAM cost: 5 GB
|
|
||||||
:param string filename: Filename of the contract
|
|
||||||
:param string hostname: Hostname of the server containing the contract.
|
|
||||||
Optional. Defaults to current server if not provided
|
|
||||||
:returns: A string with the contract's text description
|
|
||||||
|
|
||||||
Get the full text description for the problem posed by the Coding Contract.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
codingcontract.getDescription("contract-123.cct", "home");
|
|
@ -1,19 +0,0 @@
|
|||||||
getNumTriesRemaining() Netscript Function
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
.. js:function:: getNumTriesRemaining(filename[, hostname=current hostname])
|
|
||||||
|
|
||||||
:RAM cost: 2 GB
|
|
||||||
:param string filename: Filename of the contract
|
|
||||||
:param string hostname: Hostname of the server containing the contract.
|
|
||||||
Optional. Defaults to current server if not provided
|
|
||||||
:returns: Number indicating how many attempts are remaining
|
|
||||||
|
|
||||||
Get the number of tries remaining on the contract before it
|
|
||||||
self-destructs.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
codingcontract.getNumTriesRemaining("contract-123.cct", "home"); // returns: 5
|
|
@ -1,25 +0,0 @@
|
|||||||
calculateExp() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: calculateExp(skillLevel[, mult])
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param number skillLevel: ``skillLevel`` to convert to exp.
|
|
||||||
:param number mult: Assume a specific skill multipler (not exp multiplier).
|
|
||||||
:returns: number of exp required to reach given ``skillLevel`` with that multiplier.
|
|
||||||
|
|
||||||
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
|
|
||||||
use this function.
|
|
||||||
|
|
||||||
This function calculates the amount of experience needed to reach the given
|
|
||||||
``skillLevel``.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
var player = getPlayer();
|
|
||||||
var nextHacking = player.hacking_skill+1;
|
|
||||||
var nextExp = formulas.basic.calculateExp(nextHacking);
|
|
||||||
var missingExp = nextExp - player.hacking_exp;
|
|
||||||
tprint("Missing " + missingExp + " to reach next hacking level");
|
|
@ -1,21 +0,0 @@
|
|||||||
calculateSkill() Netscript Function
|
|
||||||
===================================
|
|
||||||
|
|
||||||
.. js:function:: calculateSkill(exp[, mult])
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param number exp: ``exp`` to convert to skillLevel.
|
|
||||||
:param number mult: Assume a specific skill multipler (not exp multiplier).
|
|
||||||
:returns: skillLevel that ``exp`` would reach with that multiplier.
|
|
||||||
|
|
||||||
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
|
|
||||||
use this function.
|
|
||||||
|
|
||||||
This function calculates the skillLevel that the given amount of ``exp`` would reach.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
skillLevel = formulas.basic.calculateSkill(1000);
|
|
||||||
tprint("1000 exp would reach level " + skillLevel);
|
|
@ -1,28 +0,0 @@
|
|||||||
growPercent() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: growPercent(server, threads, player, cores)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param server server: The server that receives the growth.
|
|
||||||
:param number threads: The number of thread that would be used.
|
|
||||||
:param player player: The player.
|
|
||||||
:param number cores: The amount of cores on the host computer.
|
|
||||||
:returns: The amount the server's money would be multiplied by with these
|
|
||||||
parameters.
|
|
||||||
|
|
||||||
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
|
|
||||||
use this function.
|
|
||||||
|
|
||||||
Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function.
|
|
||||||
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
|
|
||||||
|
|
||||||
This function calculates the amount of growth, as a multiplier, a server
|
|
||||||
would receive with these parameters. Despite its name, it does not return
|
|
||||||
a percentage.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
tprint(formulas.basic.growPercent(getServer(), 50, getPlayer()))
|
|
@ -1,25 +0,0 @@
|
|||||||
growTime() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: growTime(server, player)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param server server: The server to grow.
|
|
||||||
:param player player: The player.
|
|
||||||
:returns: The time it takes to grow this server. In seconds.
|
|
||||||
|
|
||||||
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
|
|
||||||
use this function.
|
|
||||||
|
|
||||||
Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function.
|
|
||||||
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
|
|
||||||
|
|
||||||
This function calculates the amount of time it takes to grow a server.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
server = getServer();
|
|
||||||
server.hackDifficulty = server.minDifficulty;
|
|
||||||
tprint(formulas.basic.growTime(server, getPlayer()));
|
|
@ -1,25 +0,0 @@
|
|||||||
hackChance() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: hackChance(server, player)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param server server: The server to hack.
|
|
||||||
:param player player: The player.
|
|
||||||
:returns: The chance to hack that server, between 0 and 1.
|
|
||||||
|
|
||||||
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
|
|
||||||
use this function.
|
|
||||||
|
|
||||||
Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function.
|
|
||||||
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
|
|
||||||
|
|
||||||
This function calculates the probability to successfully hack a server.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
var server = getServer();
|
|
||||||
server.hackDifficulty = server.minDifficulty;
|
|
||||||
tprint(formulas.basic.hackChance(server, getPlayer()));
|
|
@ -1,23 +0,0 @@
|
|||||||
hackExp() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: hackExp(server, player)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param server server: The server to hack.
|
|
||||||
:param player player: The player.
|
|
||||||
:returns: The amount of exp that would be acquired if this server were to be hacked.
|
|
||||||
|
|
||||||
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
|
|
||||||
use this function.
|
|
||||||
|
|
||||||
Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function.
|
|
||||||
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
|
|
||||||
|
|
||||||
This function calculates the amount of exp obtained by hacking a server.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
tprint(formulas.basic.hackExp(getServer(), getPlayer()));
|
|
@ -1,26 +0,0 @@
|
|||||||
hackPercent() Netscript Function
|
|
||||||
=================================
|
|
||||||
|
|
||||||
.. js:function:: hackPercent(server, player)
|
|
||||||
|
|
||||||
:RAM cost: 0 GB
|
|
||||||
:param server server: The server to hack.
|
|
||||||
:param player player: The player.
|
|
||||||
:returns: The percentage of money hacked from the server's money.
|
|
||||||
|
|
||||||
If you are not in BitNode-5, then you must have Source-File 5-1 in order to
|
|
||||||
use this function.
|
|
||||||
|
|
||||||
Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function.
|
|
||||||
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
|
|
||||||
|
|
||||||
This function calculates the percentage of money hacked from a server.
|
|
||||||
Multiply this by thread count to calculate the percentage for more than 1 thread.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
.. code-block:: javascript
|
|
||||||
|
|
||||||
server = getServer();
|
|
||||||
server.hackDifficulty = server.minDifficulty;
|
|
||||||
tprint(formulas.basic.hackPercent(server, getPlayer()));
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user