Update netscript documentation.

Unfortunately, I haven't used most of the specialty APIs yet, so I'm not intimately familiar with where their documentation might be wrong. I figured some fixes were better than no fixes, and I can always make more fixes later.

Fixes #1023.
This commit is contained in:
MageKing17
2021-07-02 14:27:59 -07:00
committed by danielyxie
parent 55d1ebd0e4
commit ae15914efa
73 changed files with 322 additions and 267 deletions

View File

@@ -8,15 +8,18 @@ calculateExp() Netscript Function
:param number mult: Assume a specific skill multipler (not exp multiplier).
:returns: number of exp required to reach given ``skillLevel`` with that multiplier.
You must have Source-File 5-1 in order to use this function.
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 level the given ``skillLevel``.
This function calculates the amount of experience needed to reach the given
``skillLevel``.
Examples:
.. code-block:: javascript
nextHacking = getStats().hacking+1;
player = getPlayer();
nextHacking = player.hacking_skill+1;
nextExp = formulas.basic.calculateExp(nextHacking);
missingExp = nextExp - getCharacterInformation().hackingExp;
missingExp = nextExp - player.hacking_exp;
tprint("Missing " + missingExp + " to reach next hacking level");

View File

@@ -8,7 +8,8 @@ calculateSkill() Netscript Function
:param number mult: Assume a specific skill multipler (not exp multiplier).
:returns: skillLevel that ``exp`` would reach with that multiplier.
You must have Source-File 5-1 in order to use this function.
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.

View File

@@ -7,17 +7,21 @@ growPercent() Netscript Function
: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.
:returns: The percentage growth this server would receive with these parameters.
:returns: The amount the server's money would be multiplied by with these
parameters.
You must have Source-File 5-1 in order to use this function.
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<../../singularityfunctions/getPlayer>` function.
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
This function calculates percentage of growth a server would receive with these parameters.
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()))
tprint(formulas.basic.growPercent(getServer(), 50, getPlayer()))

View File

@@ -8,10 +8,11 @@ growTime() Netscript Function
:param player player: The player.
:returns: The time it takes to grow this server. In seconds.
You must have Source-File 5-1 in order to use this function.
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<../../singularityfunctions/getPlayer>` 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.
@@ -21,4 +22,4 @@ growTime() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(formulas.basic.growTime(server, getPlayer()));
tprint(formulas.basic.growTime(server, getPlayer()));

View File

@@ -6,14 +6,15 @@ hackChance() Netscript Function
:RAM cost: 0 GB
:param server server: The server to hack.
:param player player: The player.
:returns: The change to hack that server. between 0 and 1.
:returns: The chance to hack that server, between 0 and 1.
You must have Source-File 5-1 in order to use this function.
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<../../singularityfunctions/getPlayer>` function.
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
This function calculates percentage chance to hack a server.
This function calculates the probability to successfully hack a server.
Examples:
@@ -21,4 +22,4 @@ hackChance() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(formulas.basic.hackChance(server, getPlayer()));
tprint(formulas.basic.hackChance(server, getPlayer()));

View File

@@ -8,10 +8,11 @@ hackExp() Netscript Function
:param player player: The player.
:returns: The amount of exp that would be acquired if this server were to be hacked.
You must have Source-File 5-1 in order to use this function.
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<../../singularityfunctions/getPlayer>` function.
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
This function calculates the amount of exp obtained by hacking a server.
@@ -19,6 +20,4 @@ hackExp() Netscript Function
.. code-block:: javascript
server = getServer();
server.hackDifficulty = 99.9;
tprint(formulas.basic.hackExp(server, getPlayer()));
tprint(formulas.basic.hackExp(getServer(), getPlayer()));

View File

@@ -6,14 +6,15 @@ hackPercent() Netscript Function
:RAM cost: 0 GB
:param server server: The server to hack.
:param player player: The player.
:returns: The percentage of money hacked from a servers maximum money.
:returns: The percentage of money hacked from the server's money.
You must have Source-File 5-1 in order to use this function.
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<../../singularityfunctions/getPlayer>` function.
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
This function calculates the percentage of maximum money hacked from a server.
This function calculates the percentage of money hacked from a server.
Multiply this by thread count to know calculate the percentage for more than 1 thread.
Examples:
@@ -22,4 +23,4 @@ hackPercent() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(formulas.basic.hackPercent(server, getPlayer()));
tprint(formulas.basic.hackPercent(server, getPlayer()));

View File

@@ -8,10 +8,11 @@ hackTime() Netscript Function
:param player player: The player.
:returns: The time it takes to hack this server. In seconds.
You must have Source-File 5-1 in order to use this function.
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<../../singularityfunctions/getPlayer>` function.
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
This function calculates the amount of time it takes to hack a server.
@@ -21,4 +22,4 @@ hackTime() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(formulas.basic.hackTime(server, getPlayer()));
tprint(formulas.basic.hackTime(server, getPlayer()));

View File

@@ -8,10 +8,11 @@ weakenTime() Netscript Function
:param player player: The player.
:returns: The time it takes to weaken this server. In seconds.
You must have Source-File 5-1 in order to use this function.
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<../../singularityfunctions/getPlayer>` function.
Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function.
This function calculates the amount of time it takes to weaken a server.
@@ -21,4 +22,4 @@ weakenTime() Netscript Function
server = getServer();
server.hackDifficulty = server.minDifficulty;
tprint(formulas.basic.weakenTime(server, getPlayer()));
tprint(formulas.basic.weakenTime(server, getPlayer()));