mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-08 16:53:54 +01:00
commit
54e8875dd0
@ -80,6 +80,7 @@ Specifically, you'll want to take a look at :ref:`netscriptfunctions`.
|
|||||||
Enter the following code in the script editor:
|
Enter the following code in the script editor:
|
||||||
|
|
||||||
.. code:: javascript
|
.. code:: javascript
|
||||||
|
|
||||||
/** @param {NS} ns */
|
/** @param {NS} ns */
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
// Defines the "target server", which is the server
|
// Defines the "target server", which is the server
|
||||||
|
@ -3,7 +3,7 @@ getHackingMultipliers() Netscript Function
|
|||||||
|
|
||||||
.. js:function:: getHackingMultipliers()
|
.. js:function:: getHackingMultipliers()
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
:RAM cost: 0.25 GB
|
||||||
:returns: object containing the player's hacking multipliers. These
|
:returns: object containing the player's hacking multipliers. These
|
||||||
multipliers are returned in decimal forms, not percentages (e.g. 1.5
|
multipliers are returned in decimal forms, not percentages (e.g. 1.5
|
||||||
instead of 150%).
|
instead of 150%).
|
||||||
|
@ -3,7 +3,7 @@ getHacknetMultipliers() Netscript Function
|
|||||||
|
|
||||||
.. js:function:: getHacknetMultipliers()
|
.. js:function:: getHacknetMultipliers()
|
||||||
|
|
||||||
:RAM cost: 4 GB
|
:RAM cost: 0.25 GB
|
||||||
:returns: object containing the player's hacknet multipliers. These
|
:returns: object containing the player's hacknet multipliers. These
|
||||||
multipliers are returned in decimal forms, not percentages (e.g. 1.5
|
multipliers are returned in decimal forms, not percentages (e.g. 1.5
|
||||||
instead of 150%).
|
instead of 150%).
|
||||||
|
@ -3,7 +3,7 @@ getPurchasedServerUpgradeCost() Netscript Function
|
|||||||
|
|
||||||
.. js:function:: getPurchasedServerUpgradeCost(hostname, ram)
|
.. js:function:: getPurchasedServerUpgradeCost(hostname, ram)
|
||||||
|
|
||||||
:RAM cost: 0.25 GB
|
:RAM cost: 0.1 GB
|
||||||
|
|
||||||
:param string hostname: Hostname of target purchased server.
|
:param string hostname: Hostname of target purchased server.
|
||||||
:param number ram: Target amount of RAM for purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of :doc:`getPurchasedServerMaxRam<getPurchasedServerMaxRam>`
|
:param number ram: Target amount of RAM for purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of :doc:`getPurchasedServerMaxRam<getPurchasedServerMaxRam>`
|
||||||
|
@ -13,9 +13,9 @@ For example, let's say we want to make a generic script
|
|||||||
The first argument will be the name of another script, and the second
|
The first argument will be the name of another script, and the second
|
||||||
argument will be a number. This generic script will run the
|
argument will be a number. This generic script will run the
|
||||||
script specified in the first argument with the amount of threads
|
script specified in the first argument with the amount of threads
|
||||||
specified in the second argument. The code would look like::
|
specified in the second argument. The code would look like:
|
||||||
|
|
||||||
.. code:: javascript
|
.. code:: javascript
|
||||||
|
|
||||||
run(args[0], args[1]);
|
run(args[0], args[1]);
|
||||||
|
|
||||||
@ -23,13 +23,13 @@ And it could be ran from the terminal like:
|
|||||||
|
|
||||||
``run generic-run.script myscript.script 7``
|
``run generic-run.script myscript.script 7``
|
||||||
|
|
||||||
In .js / ns2, the above script would look like::
|
In .js / ns2, the above script would look like:
|
||||||
|
|
||||||
.. code:: javascript
|
.. code:: javascript
|
||||||
|
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
ns.run(ns.args[0], ns.args[1]);
|
ns.run(ns.args[0], ns.args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
It is also possible to get the number of arguments that were passed
|
It is also possible to get the number of arguments that were passed
|
||||||
into a script using ``args.length``.
|
into a script using ``args.length``.
|
||||||
|
Loading…
Reference in New Issue
Block a user