mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
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:
@@ -7,8 +7,8 @@ brutessh() Netscript Function
|
||||
|
||||
:param string hostname: Hostname of the target server.
|
||||
|
||||
Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist
|
||||
on your home computer.
|
||||
Runs the ``BruteSSH.exe`` program on the target server. ``BruteSSH.exe``
|
||||
must exist on your home computer.
|
||||
|
||||
Examples:
|
||||
|
||||
|
||||
@@ -9,9 +9,3 @@ disableLog() Netscript Function
|
||||
|
||||
Disables logging for the given function. Logging can be disabled for
|
||||
all functions by passing 'ALL' as the argument.
|
||||
|
||||
Note that this does not completely remove all logging functionality.
|
||||
This only stops a function from logging when the function is successful. If
|
||||
the function fails, it will still log the reason for failure.
|
||||
|
||||
Notable functions that cannot have their logs disabled: run, exec, exit
|
||||
|
||||
@@ -19,9 +19,8 @@ exec() Netscript Function
|
||||
the :doc:`run<run>` function except that it can be used to run a script on any
|
||||
server, instead of just the current server.
|
||||
|
||||
.. warning:: Running this function with a ``numThreads`` argument of 0 will return 0 without
|
||||
running the script. However, running this function with a negative *numThreads*
|
||||
argument will cause a runtime error.
|
||||
.. warning:: Running this function with a ``numThreads`` argument of 0 or
|
||||
less will cause a runtime error.
|
||||
|
||||
The simplest way to use the :doc:`exec<exec>` command is to call it with
|
||||
just the script name and the target server. The following example will try
|
||||
|
||||
@@ -6,3 +6,12 @@ exit() Netscript Function
|
||||
: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.
|
||||
|
||||
@@ -7,11 +7,16 @@ flags() Netscript Function
|
||||
:param data array of pairs of strings: Flags definition.
|
||||
:returns: Object containing all the flags that were parsed or default.
|
||||
|
||||
The flag definition is an array of pairs of values, the first value is the
|
||||
name of the flag, the 2nd value is the default value for that flag.
|
||||
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.
|
||||
contains the special field '_', which contains all arguments that were not
|
||||
flags.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -27,14 +32,14 @@ flags() Netscript Function
|
||||
tprint(data);
|
||||
*/
|
||||
[home ~/]> run example.script
|
||||
{"_":[],"delay":0,"server":"foodnstuff"}
|
||||
{"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":false}
|
||||
[home ~/]> run example.script --delay 3000
|
||||
{"_":[],"server":"foodnstuff","delay":3000}
|
||||
{"_":[],"server":"foodnstuff","exclude":[],"help":false,"delay":3000}
|
||||
[home ~/]> run example.script --delay 3000 --server harakiri-sushi
|
||||
{"_":[],"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"],"delay":3000,"server":"harakiri-sushi"}
|
||||
{"_":["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"],"delay":3000,"server":"harakiri-sushi","exclude":["a","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}
|
||||
|
||||
@@ -10,7 +10,6 @@ ftpcrack() Netscript Function
|
||||
Runs the ``FTPCrack.exe`` program on the target server. ``FTPCrack.exe``
|
||||
must exist on your home computer.
|
||||
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
@@ -10,4 +10,4 @@ getFavorToDonate() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getFavorToDonate() // returns: 150
|
||||
getFavorToDonate() // returns: 150
|
||||
|
||||
@@ -13,7 +13,6 @@ getGrowTime() Netscript Function
|
||||
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
|
||||
|
||||
@@ -10,4 +10,4 @@ getHackingLevel() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getHackingLevel(); // returns: 124
|
||||
getHackingLevel(); // returns: 124
|
||||
|
||||
@@ -11,4 +11,3 @@ getHostname() Netscript Function
|
||||
.. code-block:: javascript
|
||||
|
||||
getHostname(); // returns: "foodnstuff"
|
||||
|
||||
|
||||
@@ -10,89 +10,89 @@ getPlayer() Netscript Function
|
||||
Returns an object with the Player's stats. The object has the following properties::
|
||||
|
||||
{
|
||||
hacking_skill
|
||||
hp
|
||||
max_hp
|
||||
strength
|
||||
defense
|
||||
dexterity
|
||||
agility
|
||||
charisma
|
||||
intelligence
|
||||
hacking_chance_mult
|
||||
hacking_speed_mult
|
||||
hacking_money_mult
|
||||
hacking_grow_mult
|
||||
hacking_exp
|
||||
strength_exp
|
||||
defense_exp
|
||||
dexterity_exp
|
||||
agility_exp
|
||||
charisma_exp
|
||||
hacking_mult
|
||||
strength_mult
|
||||
defense_mult
|
||||
dexterity_mult
|
||||
agility_mult
|
||||
charisma_mult
|
||||
hacking_exp_mult
|
||||
strength_exp_mult
|
||||
defense_exp_mult
|
||||
dexterity_exp_mult
|
||||
agility_exp_mult
|
||||
charisma_exp_mult
|
||||
company_rep_mult
|
||||
faction_rep_mult
|
||||
money
|
||||
city
|
||||
location
|
||||
crime_money_mult
|
||||
crime_success_mult
|
||||
isWorking
|
||||
workType
|
||||
currentWorkFactionName
|
||||
currentWorkFactionDescription
|
||||
workHackExpGainRate
|
||||
workStrExpGainRate
|
||||
workDefExpGainRate
|
||||
workDexExpGainRate
|
||||
workAgiExpGainRate
|
||||
workChaExpGainRate
|
||||
workRepGainRate
|
||||
workMoneyGainRate
|
||||
workMoneyLossRate
|
||||
workHackExpGained
|
||||
workStrExpGained
|
||||
workDefExpGained
|
||||
workDexExpGained
|
||||
workAgiExpGained
|
||||
workChaExpGained
|
||||
workRepGained
|
||||
workMoneyGained
|
||||
createProgramName
|
||||
createProgramReqLvl
|
||||
className
|
||||
crimeType
|
||||
work_money_mult
|
||||
hacknet_node_money_mult
|
||||
hacknet_node_purchase_cost_mult
|
||||
hacknet_node_ram_cost_mult
|
||||
hacknet_node_core_cost_mult
|
||||
hacknet_node_level_cost_mult
|
||||
hasWseAccount
|
||||
hasTixApiAccess
|
||||
has4SData
|
||||
has4SDataTixApi
|
||||
bladeburner_max_stamina_mult
|
||||
bladeburner_stamina_gain_mult
|
||||
bladeburner_success_chance_mult
|
||||
bitNodeN
|
||||
totalPlaytime
|
||||
playtimeSinceLastAug
|
||||
playtimeSinceLastBitnode
|
||||
jobs
|
||||
factions
|
||||
tor
|
||||
hacking_skill: 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::
|
||||
|
||||
@@ -10,4 +10,4 @@ getPurchasedServerLimit() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getPurchasedServerLimit() // returns: 25
|
||||
getPurchasedServerLimit() // returns: 25
|
||||
|
||||
@@ -10,4 +10,4 @@ getPurchasedServerMaxRam() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getPurchasedServerMaxRam(); // returns: 1048576
|
||||
getPurchasedServerMaxRam(); // returns: 1048576
|
||||
|
||||
@@ -4,7 +4,7 @@ getRunningScript() Netscript Function
|
||||
.. js:function:: getRunningScript()
|
||||
|
||||
:RAM cost: 0.3 GB
|
||||
:returns: Script object or null if not found
|
||||
:returns: Script object or null if not found.
|
||||
|
||||
The object has the following properties:
|
||||
|
||||
@@ -64,8 +64,8 @@ getRunningScript() Netscript Function
|
||||
.. js:function:: getRunningScript(pid)
|
||||
|
||||
:RAM cost: 0.3 GB
|
||||
:param number pid: PID of the script
|
||||
:returns: Script object or null if not found
|
||||
:param number pid: PID of the script.
|
||||
:returns: Script object or null if not found.
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -73,13 +73,13 @@ getRunningScript() Netscript Function
|
||||
|
||||
getRunningScript(42); // get the script with pid 42.
|
||||
|
||||
.. js:function:: getRunningScript(fn, hostname[, args])
|
||||
.. 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 to the script.
|
||||
:returns: Script object or null if not found
|
||||
: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:
|
||||
|
||||
|
||||
@@ -15,4 +15,3 @@ getScriptExpGain() Netscript Function
|
||||
|
||||
.. note:: A script is uniquely identified by both its name and its
|
||||
arguments.
|
||||
|
||||
|
||||
@@ -16,4 +16,4 @@ getScriptIncome() Netscript Function
|
||||
scripts since you last installed Augmentations.
|
||||
|
||||
.. note:: A script is uniquely identified by both its name and its
|
||||
arguments.
|
||||
arguments.
|
||||
|
||||
@@ -9,8 +9,8 @@ getScriptLogs() Netscript Function
|
||||
: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.
|
||||
.. 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.
|
||||
|
||||
@@ -7,10 +7,10 @@ getServerGrowth() Netscript Function
|
||||
:param string hostname: Hostname of target server.
|
||||
:returns: Server growth parameter.
|
||||
|
||||
The growth parameter is a number between 1 and 100 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.
|
||||
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:
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ getServerMaxMoney() Netscript Function
|
||||
|
||||
:RAM cost: 0.1 GB
|
||||
:param string hostname: Hostname of target server.
|
||||
:returns: Maximum amount of money that can be available on a server.
|
||||
:returns: Maximum amount of money that can be available on a server.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerMaxMoney('foodnstuff'); // returns: 4000000
|
||||
getServerMaxMoney('foodnstuff'); // returns: 50000000
|
||||
|
||||
@@ -16,4 +16,4 @@ getServerMoneyAvailable() Netscript Function
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerMoneyAvailable("foodnstuff"); // returns: 120000
|
||||
getServerMoneyAvailable("home"); // returns: 1000
|
||||
getServerMoneyAvailable("home"); // returns: 1000
|
||||
|
||||
@@ -3,12 +3,14 @@ getServerRam() Netscript Function
|
||||
|
||||
.. js:function:: getServerRam(hostname)
|
||||
|
||||
.. warning:: This function is deprecated.
|
||||
.. 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 number, first number is the total RAM, second the
|
||||
used RAM.
|
||||
: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
|
||||
|
||||
@@ -11,4 +11,4 @@ getServerRequiredHackingLevel() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerRequiredHackingLevel("foodnstuff"); // returns: 5
|
||||
getServerRequiredHackingLevel("foodnstuff"); // returns: 5
|
||||
|
||||
@@ -11,4 +11,4 @@ getServerSecurityLevel() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getServerSecurityLevel("foodnstuff"); // returns: 3.45
|
||||
getServerSecurityLevel("foodnstuff"); // returns: 3.45
|
||||
|
||||
@@ -10,4 +10,4 @@ getTimeSinceLastAug() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
getTimeSinceLastAug(); // returns: 13912400
|
||||
getTimeSinceLastAug(); // returns: 13912400
|
||||
|
||||
@@ -13,4 +13,4 @@ hackChance() Netscript Function
|
||||
.. code-block:: javascript
|
||||
|
||||
hackChance("foodnstuff"); // returns: .5
|
||||
// So 50% chance to hack "foodnstuff"
|
||||
// So 50% chance to hack "foodnstuff"
|
||||
|
||||
@@ -6,8 +6,8 @@ httpworm() Netscript Function
|
||||
:RAM cost: 0.05 GB
|
||||
:param string hostname: Hostname of the target server.
|
||||
|
||||
Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist
|
||||
on your home computer.
|
||||
Runs the ``HTTPWorm.exe`` program on the target server. ``HTTPWorm.exe``
|
||||
must exist on your home computer.
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@ isLogEnabled() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
isLogEnabled('hack'); // returns: true
|
||||
isLogEnabled('hack'); // returns: true
|
||||
|
||||
@@ -14,4 +14,4 @@ killall() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
killall('foodnstuff'); // returns: true
|
||||
killall('foodnstuff'); // returns: true
|
||||
|
||||
@@ -12,4 +12,4 @@ ls() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
ls("home"); // returns: ["demo.script", "msg1.txt"]
|
||||
ls("home"); // returns: ["demo.script", "msg1.txt"]
|
||||
|
||||
@@ -6,7 +6,8 @@ nuke() Netscript Function
|
||||
:RAM cost: 0.05 GB
|
||||
:param string hostname: Hostname of the target server.
|
||||
|
||||
Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer.
|
||||
Runs the ``NUKE.exe`` program on the target server. ``NUKE.exe`` must exist
|
||||
on your home computer.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
@@ -13,4 +13,4 @@ print() Netscript Function
|
||||
.. code-block:: javascript
|
||||
|
||||
print("Hello world!"); // Prints "Hello world!" in the logs.
|
||||
print({a:5}); // Prints '{"a":5}' in the logs.
|
||||
print({a:5}); // Prints '{"a":5}' in the logs.
|
||||
|
||||
@@ -20,4 +20,4 @@ prompt() Netscript Function
|
||||
answer = prompt("Buy a server for $"+cost);
|
||||
if(answer) {
|
||||
purchaseServer("my server", 8192);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,8 @@ relaysmtp() Netscript Function
|
||||
:RAM cost: 0.05 GB
|
||||
:param string hostname: Hostname of the target server.
|
||||
|
||||
|
||||
Runs the relaySMTP.exe program on the target server. relaySMTP.exe must
|
||||
exist on your home computer.
|
||||
Runs the ``relaySMTP.exe`` program on the target server. ``relaySMTP.exe``
|
||||
must exist on your home computer.
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
@@ -17,9 +17,8 @@ run() Netscript Function
|
||||
scripts located on the current server (the server running the script that
|
||||
calls this function).
|
||||
|
||||
.. warning:: Running this function with a ``numThreads`` argument of 0 will
|
||||
return 0 without running the script. However, running this function with
|
||||
a negative ``numThreads`` argument will cause a runtime error.
|
||||
.. warning:: Running this function with a ``numThreads`` argument of 0 or
|
||||
less will cause a runtime error.
|
||||
|
||||
The simplest way to use the :doc:`run<run>` command is to call it with just
|
||||
the script name. The following example will run ``foo.script``
|
||||
|
||||
@@ -12,4 +12,4 @@ scan() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
scan("home"); // returns: ["foodnstuff", "sigma-cosmetics", "joesguns", "hong-fang-tea", "harakiri-sushi", "iron-gym"]
|
||||
scan("home"); // returns: ["foodnstuff", "sigma-cosmetics", "joesguns", "hong-fang-tea", "harakiri-sushi", "iron-gym"]
|
||||
|
||||
@@ -9,7 +9,7 @@ scp() Netscript Function
|
||||
Hostname of the source server, which is the server from which the file will be copied.
|
||||
This argument is optional and if it's omitted the source will be the current server.
|
||||
:param string destination: Hostname of the destination server, which is the server to which the file will be copied.
|
||||
:returns: ``true`` is the copy was a success.
|
||||
:returns: ``true`` if the copy was a success.
|
||||
|
||||
Copies a script or literature (.lit) file(s) to another server. The
|
||||
``files`` argument can be either a string specifying a single file to copy,
|
||||
|
||||
@@ -11,4 +11,4 @@ serverExists() Netscript Function
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
serverExists("foodnstuff"); // returns: true
|
||||
serverExists("foodnstuff"); // returns: true
|
||||
|
||||
@@ -8,9 +8,8 @@ sleep() Netscript Function
|
||||
|
||||
Suspends the script for n milliseconds.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
sleep(3000); // Will wait 3 seconds.
|
||||
sleep(3000); // Will wait 3 seconds.
|
||||
|
||||
@@ -16,6 +16,8 @@ spawn() Netscript Function
|
||||
current one. This function can only be used to run scripts on the local
|
||||
server.
|
||||
|
||||
.. warning:: Running this function with a ``numThreads`` argument of 0 or
|
||||
less will cause a runtime error.
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ sqlinject() Netscript Function
|
||||
:RAM cost: 0.05 GB
|
||||
:param string hostname: Hostname of the target server.
|
||||
|
||||
Runs the SQLInject.exe program on the target server. SQLInject.exe must
|
||||
exist on your home computer.
|
||||
Runs the ``SQLInject.exe`` program on the target server. ``SQLInject.exe``
|
||||
must exist on your home computer.
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
@@ -44,9 +44,6 @@ tail() Netscript Function
|
||||
// Open logs from process with id 42
|
||||
tail(42);
|
||||
|
||||
// Open logs from process with id 42 on the foodnstuff server
|
||||
tail(42, "foodnstuff");
|
||||
|
||||
.. js:function:: tail()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
@@ -13,4 +13,4 @@ tprint() Netscript Function
|
||||
.. code-block:: javascript
|
||||
|
||||
tprint("Hello world!"); // Prints "Hello world!" to the terminal.
|
||||
tprint({a:5}); // Prints '{"a":5}' to the terminal.
|
||||
tprint({a:5}); // Prints '{"a":5}' to the terminal.
|
||||
|
||||
@@ -11,4 +11,4 @@ tryWrite() Netscript Function
|
||||
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.
|
||||
See :ref:`netscript_ports` for more details.
|
||||
|
||||
@@ -8,7 +8,6 @@ write() Netscript Function
|
||||
: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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user