mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 23:38:35 +02:00
merge dev
This commit is contained in:
18
doc/source/netscript/advancedfunctions/atExit.rst
Normal file
18
doc/source/netscript/advancedfunctions/atExit.rst
Normal file
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
36
doc/source/netscript/advancedfunctions/autocomplete.rst
Normal file
36
doc/source/netscript/advancedfunctions/autocomplete.rst
Normal file
@@ -0,0 +1,36 @@
|
||||
autocomplete() Netscript Function
|
||||
============================
|
||||
|
||||
.. warning:: This feature is not officially supported yet and the API might change.
|
||||
|
||||
.. js:function:: autocomplete(data, args)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
:param Object data: general data about the game you might want to autocomplete.
|
||||
:param string[] args: current arguments.
|
||||
|
||||
data is an object with the following properties::
|
||||
|
||||
{
|
||||
servers: list of all servers in the game.
|
||||
txts: list of all text files on the current server.
|
||||
scripts: list of all scripts on the current server.
|
||||
}
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
export function autocomplete(data, args) {
|
||||
return [...data.servers]; // This script autocompletes the list of servers.
|
||||
return [...data.servers, ...data.scripts]; // Autocomplete servers and scripts
|
||||
return ["low", "medium", "high"]; // Autocomplete 3 specific strings.
|
||||
}
|
||||
|
||||
Terminal:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
$ run demo.ns mega\t
|
||||
// results in
|
||||
$ run demo.ns megacorp
|
||||
@@ -10,3 +10,4 @@ they contain spoilers for the game.
|
||||
|
||||
getBitNodeMultipliers() <advancedfunctions/getBitNodeMultipliers>
|
||||
getServer() <advancedfunctions/getServer>
|
||||
autocomplete() <advancedfunctions/autocomplete>
|
||||
|
||||
@@ -43,6 +43,7 @@ The player has access to all of these functions while in BitNode-4. Completing B
|
||||
getFactionRep() <singularityfunctions/getFactionRep>
|
||||
getFactionFavor() <singularityfunctions/getFactionFavor>
|
||||
getFactionFavorGain() <singularityfunctions/getFactionFavorGain>
|
||||
upgradeHomeCores() <singularityfunctions/upgradeHomeCores>
|
||||
|
||||
.. toctree::
|
||||
:caption: Level 3 Functions
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
upgradeHomeRam() Netscript Function
|
||||
===================================
|
||||
|
||||
.. js:function:: upgradeHomeCores()
|
||||
|
||||
:RAM cost: 3 GB
|
||||
|
||||
If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function.
|
||||
|
||||
This function will upgrade amount of CORES on the player's home computer. The cost is the same as if you were to do it manually.
|
||||
|
||||
This function will return true if the player's home computer core count is successfully upgraded, and false otherwise.
|
||||
Reference in New Issue
Block a user