mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-23 22:52:29 +01:00
v0.44.1 Minor Update - Added Augs to Duplicate Sleeves and updated documentation
This commit is contained in:
parent
31ed986b8f
commit
8e4c7beb1a
@ -50,6 +50,16 @@ no shock. Shock affects the amount of experience earned by the sleeve.
|
||||
Sleeve shock slowly decreases over time. You can further increase the rate at which
|
||||
it decreases by assigning sleeves to the 'Shock Recovery' task.
|
||||
|
||||
Obtaining Duplicate Sleeves
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
There are two methods of obtaining Duplicate Sleeves:
|
||||
|
||||
1. Destroy BitNode-10. Each completion give you one additional Duplicate Sleeve
|
||||
2. Purchase Duplicate Sleeves from :ref:`the faction The Covenant <gameplay_factions>`.
|
||||
This is only available in BitNodes-10 and above, and is only available after defeating
|
||||
BitNode-10 at least once. Sleeves purchased this way are permanent. You can purchase
|
||||
up to 5 Duplicate Sleeves from The Covenant.
|
||||
|
||||
Re-sleeving
|
||||
^^^^^^^^^^^
|
||||
Re-sleeving is the process of digitizing and transferring your consciousness into a
|
||||
@ -64,4 +74,4 @@ Note that resleeving **REMOVES** all of your currently-installed Augmentations,
|
||||
and replaces them with the ones provided by the purchased sleeve. However,
|
||||
Augmentations that are purchased but not installed will **not** be removed. If you have purchased
|
||||
an Augmentation and then re-sleeve into a body which already has that Augmentation,
|
||||
it will be removed since you cannot have duplicate Augmentations.
|
||||
it will be removed since you cannot have duplicate Augmentations.
|
||||
|
@ -23,6 +23,8 @@ enough reputation in it, you will be able to purchase its Augmentations.
|
||||
Different Factions offer different Augmentations. Augmentations must be
|
||||
purchased in order to be installed, and they are fairly expensive.
|
||||
|
||||
.. _gameplay_augmentations_installing:
|
||||
|
||||
Installing Augmentations
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
You will not gain the benefits of your purchased Augmentations until you
|
||||
@ -57,6 +59,8 @@ Here is everything you will KEEP when you install an Augmentation:
|
||||
* RAM Upgrades on your home computer
|
||||
* World Stock Exchange account and TIX API Access
|
||||
|
||||
.. _gameplay_augmentations_purchasingmultiple:
|
||||
|
||||
Purchasing Multiple Augmentations
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
You do not have to install an Augmentation right after you purchase it.
|
||||
|
@ -49,6 +49,8 @@ on a server in order to successfully NUKE it:**
|
||||
Once you have enough ports opened on a server and have ran the NUKE virus
|
||||
to gain root access, you will be able to hack it.
|
||||
|
||||
.. _gameplay_hacking_generalhackingmechanics:
|
||||
|
||||
General Hacking Mechanics
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
When you execute the hack command, either manually through the terminal
|
||||
@ -73,6 +75,8 @@ in your hacking (since you are only hacking a certain percentage).
|
||||
You can increase the amount of money on a server using a script and
|
||||
the :js:func:`grow` function in Netscript.
|
||||
|
||||
.. _gameplay_hacking_serversecurity:
|
||||
|
||||
Server Security
|
||||
^^^^^^^^^^^^^^^
|
||||
Each server has a security level, typically between 1 and 100.
|
||||
|
@ -37,6 +37,8 @@ name and the arguments that it was run with.**
|
||||
The arguments must be an **exact** match. This means that both
|
||||
the order and type of the arguments matter.
|
||||
|
||||
.. _gameplay_scripts_multithreadingscripts:
|
||||
|
||||
Multithreading scripts
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
A script can be run with multiple threads. This is also called multithreading.
|
||||
|
@ -126,6 +126,8 @@ Both 'clear' and 'cls' do the same thing::
|
||||
$ clear
|
||||
$ cls
|
||||
|
||||
.. _connect_terminal_command:
|
||||
|
||||
connect
|
||||
^^^^^^^
|
||||
|
||||
@ -165,8 +167,6 @@ Examples::
|
||||
$ expr 3 ** 3
|
||||
|
||||
|
||||
Evalutes a
|
||||
|
||||
free
|
||||
^^^^
|
||||
|
||||
@ -193,6 +193,7 @@ detailed information about the Terminal command. Examples::
|
||||
$ help alias
|
||||
$ help scan-analyze
|
||||
|
||||
.. _home_terminal_command:
|
||||
|
||||
home
|
||||
^^^^
|
||||
@ -346,6 +347,9 @@ scan
|
||||
Prints all immediately-available network connections. This will print a list
|
||||
of all servers that you can currently connect to using the 'connect' Terminal command.
|
||||
|
||||
|
||||
.. _scan_analyze_terminal_command:
|
||||
|
||||
scan-analyze
|
||||
^^^^^^^^^^^^
|
||||
|
||||
@ -364,6 +368,8 @@ The information 'scan-analyze' displays about each server includes whether or
|
||||
not you have root access to it, its required hacking level, the number of open
|
||||
ports required to run NUKE.exe on it, and how much RAM it has.
|
||||
|
||||
.. _scp_terminal_command:
|
||||
|
||||
scp
|
||||
^^^
|
||||
|
||||
|
@ -28,20 +28,850 @@ entire "quest-line".
|
||||
First Steps
|
||||
-----------
|
||||
I'm going to assume you followed the introductory tutorial when you first began the game.
|
||||
In this introductory tutorial you created a script called `foodnstuff.script` and ran it
|
||||
on the `foodnstuff` server. Right now, we'll kill this script. There are two ways
|
||||
In this introductory tutorial you created a script called :code:`foodnstuff.script` and ran it
|
||||
on the :code:`foodnstuff` server. Right now, we'll kill this script. There are two ways
|
||||
to do this:
|
||||
|
||||
1. You can go to the Terminal and enter::
|
||||
|
||||
$ kill foodnstuff.script
|
||||
|
||||
2. You can go to the "Active Scripts" page (:ref:`Keyboard shortcut <shortcuts>` Alt + s) and
|
||||
press the "Kill Script" button for `foodnstuff.script`.
|
||||
2. You can go to the :code:`Active Scripts` page (|Keyboard shortcut| Alt + s) and
|
||||
press the "Kill Script" button for :code:`foodnstuff.script`.
|
||||
|
||||
If you skipped the introductory tutorial, then ignore the part above. Instead, go to the
|
||||
"Hacknet Nodes" page (:ref:`Keyboard shortcut <shortcuts>` Alt + h) and purchase a
|
||||
:code:`Hacknet Nodes` page (|Keyboard shortcut| Alt + h) and purchase a
|
||||
Hacknet Node to start generating some passive income.
|
||||
|
||||
Creating our First Scripts
|
||||
Creating our First Script
|
||||
-------------------------
|
||||
Now, we'll create a generic hacking script that can be used early on in the game (or throughout the
|
||||
entire game, if you want).
|
||||
|
||||
Before we write the script, here are some things you'll want to familiarize yourself with:
|
||||
|
||||
* :ref:`gameplay_hacking_generalhackingmechanics`
|
||||
* :ref:`gameplay_hacking_serversecurity`
|
||||
* :js:func:`hack`
|
||||
* :js:func:`grow`
|
||||
* :js:func:`weaken`
|
||||
* :js:func:`brutessh`
|
||||
* :js:func:`nuke`
|
||||
|
||||
To briefly summarize the information from the links above: Each server has a
|
||||
security level that affects how difficult it is to hack. Each server also has a
|
||||
certain amount of money, as well as a maximum amount of money it can hold. Hacking a
|
||||
server steals a percentage of that server's money. The :js:func:`hack` Netscript function
|
||||
is used to hack server. The :js:func:`grow` Netscript function is used to increase
|
||||
the amount of money available on a server. The :js:func:`weaken` Netscript function is
|
||||
used to decrease a server's security level.
|
||||
|
||||
Now let's move on to actually creating the script.
|
||||
Go to your home computer and then create a script called :code:`early-hack-template.script` by
|
||||
going to Terminal and entering the following two commands::
|
||||
|
||||
$ home
|
||||
$ nano early-hack-template.script
|
||||
|
||||
This will take you to the script editor, which you can use to code and create
|
||||
:ref:`gameplay_scripts`. It will be helpful to consult the :ref:`netscript` documentation.
|
||||
Specifically, you'll want to take a look at :ref:`netscriptfunctions`.
|
||||
|
||||
Enter the following code in the script editor:
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
// Defines the "target server", which is the server
|
||||
// that we're going to hack. In this case, it's "foodnstuff"
|
||||
var target = "foodnstuff";
|
||||
|
||||
// Defines how much money a server should have before we hack it
|
||||
// In this case, it is set to 75% of the server's max money
|
||||
var moneyThresh = getServerMaxMoney(target) * 0.75;
|
||||
|
||||
// Defines the maximum security level the target server can
|
||||
// have. If the target's security level is higher than this,
|
||||
// we'll weaken it before doing anything else
|
||||
var securityThresh = getServerMinSecurityLevel(target) + 5;
|
||||
|
||||
// If we have the BruteSSH.exe program, use it to open the SSH Port
|
||||
// on the target server
|
||||
if (fileExists("BruteSSH.exe", "home")) {
|
||||
brutessh(target);
|
||||
}
|
||||
|
||||
// Get root access to target server
|
||||
nuke(target);
|
||||
|
||||
// Infinite loop that continously hacks/grows/weakens the target server
|
||||
while(true) {
|
||||
if (getServerSecurityLevel(target) > securityThresh) {
|
||||
// If the server's security level is above our threshold, weaken it
|
||||
weaken(target);
|
||||
} else if (getServerMoneyAvailable(target) < moneyThresh) {
|
||||
// If the server's money is less than our threshold, grow it
|
||||
grow(target);
|
||||
} else {
|
||||
// Otherwise, hack it
|
||||
hack(target);
|
||||
}
|
||||
}
|
||||
|
||||
The script above contains comments that document what it does, but let's go through it
|
||||
step-by-step anyways.
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
var target = "foodnstuff";
|
||||
|
||||
This first command defines a string which contains our target server. That's the server
|
||||
that we're going to hack. For now, it's set to `foodnstuff` because that's the only
|
||||
server with a required hacking level of 1. If you want to hack a different server,
|
||||
simply change this
|
||||
variable to be the hostname of another server.
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
var moneyThresh = getServerMaxMoney(target) * 0.75;
|
||||
|
||||
This second command defines a numerical value representing the minimum
|
||||
amount of money that must be available on the target server in order for our script
|
||||
to hack it. If the money available on the target server is less than this value,
|
||||
then our script will :js:func:`grow` the server rather than hacking it.
|
||||
It is set to 75% of the maximum amount of money that can be available on the server.
|
||||
The :js:func:`getServerMaxMoney` Netscript function is used to find this value
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
var securityThresh = getServerMinSecurityLevel(target) + 5;
|
||||
|
||||
This third command defines a numerical value representing the maximum security level
|
||||
the target server can have. If the target server's security level is higher than
|
||||
this value, then our script will :js:func:`weaken` the script before doing anything else.
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
if (fileExists("BruteSSH.exe", "home")) {
|
||||
brutessh(target);
|
||||
}
|
||||
|
||||
nuke(target);
|
||||
|
||||
This section of code is used to gain root access on the target server. This is
|
||||
necessary for hacking. See :ref:`here for more details <gameplay_hacking>`.
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
while (true) {
|
||||
if (getServerSecurityLevel(target) > securityThresh) {
|
||||
// If the server's security level is above our threshold, weaken it
|
||||
weaken(target);
|
||||
} else if (getServerMoneyAvailable(target) < moneyThresh) {
|
||||
// Otherwise, if the server's money is less than our threshold, grow it
|
||||
grow(target);
|
||||
} else {
|
||||
// Otherwise, hack it
|
||||
hack(target);
|
||||
}
|
||||
}
|
||||
|
||||
This is the main section that drives our script. It dictates the script's logic
|
||||
and carries out the hacking operations. The `while (true)` creates an infinite loop
|
||||
that will continuously run the hacking logic until the the script is killed.
|
||||
|
||||
Running our Scripts
|
||||
-------------------
|
||||
Now we want to start running our hacking script so that it can start earning us
|
||||
money and experience. Our home computer only has 8GB of RAM and we'll be using it for
|
||||
something else later. So instead, we'll take advantage of the RAM on other machines.
|
||||
|
||||
Go to |Terminal| and enter the following command::
|
||||
|
||||
$ scan-analyze 2
|
||||
|
||||
This will show detailed information about some servers on the network. The
|
||||
**network is randomized so it will be different for every person**.
|
||||
Here's what mine showed at the time I made this::
|
||||
|
||||
[home ~]> scan-analyze 2
|
||||
~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~
|
||||
|
||||
>foodnstuff
|
||||
--Root Access: NO, Required hacking skill: 1
|
||||
--Number of open ports required to NUKE: 0
|
||||
--RAM: 16
|
||||
|
||||
>sigma-cosmetics
|
||||
--Root Access: NO, Required hacking skill: 5
|
||||
--Number of open ports required to NUKE: 0
|
||||
--RAM: 16
|
||||
|
||||
>joesguns
|
||||
--Root Access: NO, Required hacking skill: 10
|
||||
--Number of open ports required to NUKE: 0
|
||||
--RAM: 16
|
||||
|
||||
---->max-hardware
|
||||
------Root Access: NO, Required hacking skill: 80
|
||||
------Number of open ports required to NUKE: 1
|
||||
------RAM: 32
|
||||
|
||||
>hong-fang-tea
|
||||
--Root Access: NO, Required hacking skill: 30
|
||||
--Number of open ports required to NUKE: 0
|
||||
--RAM: 16
|
||||
|
||||
---->nectar-net
|
||||
------Root Access: NO, Required hacking skill: 20
|
||||
------Number of open ports required to NUKE: 0
|
||||
------RAM: 16
|
||||
|
||||
>harakiri-sushi
|
||||
--Root Access: NO, Required hacking skill: 40
|
||||
--Number of open ports required to NUKE: 0
|
||||
--RAM: 16
|
||||
|
||||
>iron-gym
|
||||
--Root Access: NO, Required hacking skill: 100
|
||||
--Number of open ports required to NUKE: 1
|
||||
--RAM: 32
|
||||
|
||||
---->zer0
|
||||
------Root Access: NO, Required hacking skill: 75
|
||||
------Number of open ports required to NUKE: 1
|
||||
------RAM: 32
|
||||
|
||||
---->CSEC
|
||||
------Root Access: NO, Required hacking skill: 54
|
||||
------Number of open ports required to NUKE: 1
|
||||
------RAM: 8
|
||||
|
||||
Take note of the following servers:
|
||||
|
||||
* |foodnstuff|
|
||||
* |sigma-cosmetics|
|
||||
* |joesguns|
|
||||
* |nectar-net|
|
||||
* |hong-fang-tea|
|
||||
* |harakiri-sushi|
|
||||
|
||||
All of these servers have 16GB of RAM. Furthermore, all of these servers do not require
|
||||
any open ports in order to NUKE. In other words, we can gain root access to all of these
|
||||
servers and then run scripts on them.
|
||||
|
||||
First, let's determine how many threads of our hacking script we can run.
|
||||
:ref:`Read more about multithreading scripts here <gameplay_scripts_multithreadingscripts>`
|
||||
The script we wrote
|
||||
uses 2.6GB of RAM. You can check this using the following |Terminal| command::
|
||||
|
||||
$ mem early-hack-template.script
|
||||
|
||||
This means we can run 6 threads on a 16GB server. Now, to run our scripts on all of these
|
||||
servers, we have to do the following:
|
||||
|
||||
1. Use the :ref:`scp_terminal_command` |Terminal| command to copy our script to each server.
|
||||
2. Use the :ref:`connect_terminal_command` |Terminal| command to connect to a server.
|
||||
3. Use the :ref:`run_terminal_command` |Terminal| command to run the `NUKE.exe` program and
|
||||
gain root access.
|
||||
4. Use the :ref:`run_terminal_command` |Terminal| command again to run our script.
|
||||
5. Repeat steps 2-4 for each server.
|
||||
|
||||
Here's the sequence of |Terminal| commands I used in order to achieve this::
|
||||
|
||||
$ home
|
||||
$ scp early-hack-template.script foodnstuff
|
||||
$ scp early-hack-template.script sigma-cosmetics
|
||||
$ scp early-hack-template.script joesguns
|
||||
$ scp early-hack-template.script nectar-net
|
||||
$ scp early-hack-template.script hong-fang-tea
|
||||
$ scp early-hack-template.script harakiri-sushi
|
||||
$ connect foodnstuff
|
||||
$ run NUKE.exe
|
||||
$ run early-hack-template.script -t 6
|
||||
$ home
|
||||
$ connect sigma-cosmetics
|
||||
$ run NUKE.exe
|
||||
$ run early-hack-template.script -t 6
|
||||
$ home
|
||||
$ connect joesguns
|
||||
$ run NUKE.exe
|
||||
$ run early-hack-template.script -t 6
|
||||
$ home
|
||||
$ connect hong-fang-tea
|
||||
$ run NUKE.exe
|
||||
$ run early-hack-template.script -t 6
|
||||
$ home
|
||||
$ connect harakiri-sushi
|
||||
$ run NUKE.exe
|
||||
$ run early-hack-template.script -t 6
|
||||
$ home
|
||||
$ connect hong-fang-tea
|
||||
$ connect nectar-net
|
||||
$ run NUKE.exe
|
||||
$ run early-hack-template.script -t 6
|
||||
|
||||
.. note::
|
||||
|
||||
Pressing the :code:`Tab` key in the middle of a Terminal command will attempt to
|
||||
auto-complete the command. For example, if you type in :code:`scp ea` and then
|
||||
hit :code:`Tab`, the rest of the script's name should automatically be filled in.
|
||||
This works for most commands in the game!
|
||||
|
||||
The :ref:`home_terminal_command` |Terminal| command is used to connect to the home
|
||||
computer. When running our scripts with the :code:`run early-hack-template.script -t 6`
|
||||
command, the :code:`-t 6` specifies that the script should be run with 6 threads.
|
||||
|
||||
Note that the |nectar-net| server isn't in the home computer's immediate network.
|
||||
This means you can't directly connect to it from home. You will have to search for it
|
||||
inside the network. The results of the `scan-analyze 2` command we ran before
|
||||
will show where it is. In my case, I could connect to it by going from
|
||||
`hong-fang-tea -> nectar-net`. However, this will probably be different for you.
|
||||
|
||||
After running all of these |Terminal| commands, our scripts are now up and running.
|
||||
These will earn money and hacking experience over time. These gains will be
|
||||
really slow right now, but they will increase once our hacking skill rises and
|
||||
we start running more scripts.
|
||||
|
||||
Increasing Hacking Level
|
||||
------------------------
|
||||
There are many servers besides |foodnstuff| that can be hacked, but they have
|
||||
higher required hacking levels. Therefore, we should raise our hacking level. Not only
|
||||
will this let us hack more servers, but it will also increase the effectiveness of our hacking
|
||||
against |foodnstuff|.
|
||||
|
||||
The easiest way to train your hacking level is to visit Rothman University. You can do this by
|
||||
clicking the `City` tab on the left-hand navigation menu, or you can use the
|
||||
:ref:`keyboard shortcut <shortcuts>` Alt + w. Rothman University should be one of the buttons
|
||||
near the top. Click the button to go to the location.
|
||||
|
||||
Once you go to Rothman University, you should see a screen with several options. These
|
||||
options describe different courses you can take. You should click the first button, which
|
||||
says: "Study Computer Science (free)".
|
||||
|
||||
After you click the button, you will start studying and earning hacking experience. While you
|
||||
are doing this, you cannot interact with any other part of the game until you click the button
|
||||
that says "Stop taking course".
|
||||
|
||||
Right now, we want a hacking level of 10. You need approximately 174 hacking experience to reach
|
||||
level 10. You can check how much hacking experience you have by clicking the `Stats` tab
|
||||
on the left-hand navigation menu, or by using |Keyboard shortcut| Alt + c.
|
||||
Since studying at Rothman University earns you 1 experience per second, this will take
|
||||
174 seconds, or approximately 3 minutes. Feel free to do something in the meantime!
|
||||
|
||||
Editing our Hacking Script
|
||||
--------------------------
|
||||
Now that we have a hacking level of 10, we can hack the :code:`joesguns` server. This server
|
||||
will be slightly more profitable than :code:`foodnstuff`. Therefore, we want to change our hacking
|
||||
script to target :code:`joesguns` instead of :code:`foodnstuff`.
|
||||
|
||||
Go to |Terminal| and edit the hacking script by entering::
|
||||
|
||||
$ home
|
||||
$ nano early-hack-template.script
|
||||
|
||||
At the top of the script, change the `target` variable to be `joesguns`:
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
var target = "joesguns";
|
||||
|
||||
Note that this will **NOT** affect any instances of the script that are already running.
|
||||
This will only affect instances of the script that are ran from this point forward.
|
||||
|
||||
Creating a New Script to Purchase New Servers
|
||||
---------------------------------------------
|
||||
Next, we're going to create a script that automatically purchases additional servers. These
|
||||
servers will be used to run many scripts. Running this script will initially be very
|
||||
expensive since purchasing a server costs money, but it will pay off in the long run.
|
||||
|
||||
In order to create this script, you should familiarize yourself with the following
|
||||
Netscript functions:
|
||||
|
||||
* :js:func:`purchaseServer`
|
||||
* :js:func:`getPurchasedServerCost`
|
||||
* :js:func:`getPurchasedServerLimit`
|
||||
* :js:func:`getServerMoneyAvailable`
|
||||
* :js:func:`scp`
|
||||
* :js:func:`exec`
|
||||
|
||||
Create the script by going to |Terminal| and typing::
|
||||
|
||||
$ home
|
||||
$ nano purchase-server-8gb.script
|
||||
|
||||
Paste the following code into the script editor:
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
// How much RAM each purchased server will have. In this case, it'll
|
||||
// be 8GB.
|
||||
var ram = 8;
|
||||
|
||||
// Iterator we'll use for our loop
|
||||
var i = 0;
|
||||
|
||||
// Continuously try to purchase servers until we've reached the maximum
|
||||
// amount of servers
|
||||
while (i < getPurchasedServerLimit()) {
|
||||
// Check if we have enough money to purchase a server
|
||||
if (getServerMoneyAvailable("home") > getPurchasedServerCost(ram)) {
|
||||
// If we have enough money, then:
|
||||
// 1. Purchase the server
|
||||
// 2. Copy our hacking script onto the newly-purchased server
|
||||
// 3. Run our hacking script on the newly-purchased server with 3 threads
|
||||
// 4. Increment our iterator to indicate that we've bought a new server
|
||||
var hostname = purchaseServer("pserv-" + i, ram);
|
||||
scp("early-hack-template.script", hostname);
|
||||
exec("early-hack-template.script", hostname, 3);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
This code uses a while loop to purchase the maximum amount of servers using the
|
||||
:js:func:`purchaseServer` Netscript function. Each of these servers will have
|
||||
8GB of RAM, as defined in the :code:`ram` variable. Note that the script uses the command
|
||||
:code:`getServerMoneyAvailable("home")` to get the amount of money you currently have.
|
||||
This is then used to check if you can afford to purchase a server.
|
||||
|
||||
Whenever the script purchases a new server, it uses the :js:func:`scp` function to copy
|
||||
our script onto that new server, and then it uses the :js:func:`exec` function to
|
||||
execute it on that server.
|
||||
|
||||
To run this script, go to |Terminal| and type::
|
||||
|
||||
$ run purchase-server-8gb.script
|
||||
|
||||
This purchase will continuously run until it has purchased the maximum number of servers.
|
||||
When this happens, it'll mean that you have a bunch of new servers that are all running
|
||||
hacking scripts against the :code:`joesguns` server!
|
||||
|
||||
.. note::
|
||||
|
||||
The reason we're using so many scripts to hack :code:`joesguns` instead of targeting other
|
||||
servers is because it's more effective. This early in the game, we don't have enough RAM
|
||||
to efficiently hack multiple targets, and trying to do so would be slow as we'd be spread
|
||||
too thin. You should definitely do this later on, though!
|
||||
|
||||
Note that purchasing a server is fairly expensive, and purchasing the maximum amount of
|
||||
servers even more so. At the time of writing this guide, the script above requires
|
||||
$11 million in order to finish purchasing all of the 8GB servers.
|
||||
Therefore, we need to find additional ways to make money to speed
|
||||
up the process! These are covered in the next section.
|
||||
|
||||
Additional Sources of Income
|
||||
----------------------------
|
||||
There are other ways to gain money in this game besides scripts & hacking.
|
||||
|
||||
Hacknet Nodes
|
||||
^^^^^^^^^^^^^
|
||||
If you completed the introductory tutorial, you were already introduced to this method: Hacknet Nodes.
|
||||
Once you have enough money, you can start upgrading your Hacknet Nodes in order to increase
|
||||
your passive income stream. This is completely optional. Since each Hacknet Node upgrade
|
||||
takes a certain amount of time to "pay itself off", it may not necessarily be in your best
|
||||
interest to use these.
|
||||
|
||||
Nonetheless, Hacknet Nodes are a good source of income early in the game, although
|
||||
their effectiveness tapers off later on. If you do wind up purchasing and upgrading Hacknet Nodes,
|
||||
I would suggest only upgrading their levels for now. I wouldn't bother with RAM and Core
|
||||
upgrades until later on.
|
||||
|
||||
Crime
|
||||
^^^^^
|
||||
The best source of income right now is from :ref:`committing crimes <gameplay_crimes>`.
|
||||
This is because it not only gives you a large amount of money, but it also raises your
|
||||
hacking level. To commit crimes, click on the :code:`City` tab on the left-hand
|
||||
navigation menu or use the |Keyboard shortcut| Alt + w.
|
||||
Then, click on the link that says :code:`The Slums`.
|
||||
|
||||
In the Slums, you can attempt to commit a variety of crimes, each of which gives certain
|
||||
types of experience and money if successful. See :ref:`gameplay_crimes` for more details.
|
||||
|
||||
.. note::
|
||||
|
||||
You are not always successful when you attempt to commit a crime. Nothing bad happens
|
||||
if you fail a crime, but you won't earn any money and the experience gained will be
|
||||
reduced. Raising your stats improves your chance of successfully committing a crime.
|
||||
|
||||
Right now, the best option is the :code:`Rob Store` crime. This takes 60 seconds to attempt
|
||||
and gives $400k if successful. I suggest this crime because you don't have to click or check
|
||||
in too often since it takes a whole minute to attempt. Furthermore, it gives hacking experience,
|
||||
which is very important right now.
|
||||
|
||||
Alternatively, you can also use the :code:`Shoplift` crime. This takes 2 seconds to attempt
|
||||
and gives $15k if successful. This crime is slightly easier and is more profitable
|
||||
than :code:`Rob Store`, but it requires constant clicking and it doesn't give
|
||||
hacking experience.
|
||||
|
||||
Work for a Company
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
If you don't want to constantly check in on the game to commit crimes, there's another option
|
||||
that's much more passive: working for a :ref:`company <gameplay_companies>`.
|
||||
This will not be nearly as profitable as crimes, but it's completely passive.
|
||||
|
||||
Go to the :code:`City` tab on the left-hand navigation menu and then go to
|
||||
:code:`Joe's Guns`. At :code:`Joe's Guns`, there will be an option that says
|
||||
:code:`Apply to be an Employee`. Click this to get the job. Then, a new option
|
||||
will appear that simply says :code:`Work`. Click this to start working.
|
||||
Working at :code:`Joe's Guns` earns $110 per second and also grants some experience
|
||||
for every stat except hacking.
|
||||
|
||||
Working for a company is completely passive. However, you will not be able to do anything
|
||||
else in the game while you work. You can cancel working at any time. You'll notice that
|
||||
cancelling your work early causes you to lose out on some reputation gains, but
|
||||
you shouldn't worry about this. Company reputation isn't important right now.
|
||||
|
||||
Once your hacking hits level 75, you can visit :code:`Carmichael Security` in the city
|
||||
and get a software job there. This job offers higher pay and also earns you
|
||||
hacking experience.
|
||||
|
||||
There are many more companies in the |City tab| that offer more pay and also more gameplay
|
||||
features. Feel free to explore!
|
||||
|
||||
After you Purchase your New Servers
|
||||
-----------------------------------
|
||||
After you've made a total of $11 million, your automatic server-purchasing script should
|
||||
finish running. This will free up some RAM on your home computer. We don't want this RAM
|
||||
to go to waste, so we'll make use of it. Go to |Terminal| and enter the following commands::
|
||||
|
||||
$ home
|
||||
$ run early-hack-template.script -t 3
|
||||
|
||||
Reaching a Hacking Level of 50
|
||||
------------------------------
|
||||
Once you reach a hacking level of 50, two new important parts of the game open up.
|
||||
|
||||
Creating your first program: BruteSSH.exe
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
On the left-hand navigation menu you will notice a :code:`Create Programs` tab with a
|
||||
red notification icon. This indicates that there are programs available to be created.
|
||||
Click on that tab (or use |Keyboard shortcut| Alt + p) and you'll see a
|
||||
list of all the programs you can currently create. Hovering over a program will give a
|
||||
brief description of its function. Simply click on a program to start creating it.
|
||||
|
||||
Right now, the program we want to create is :code:`BruteSSH.exe`. This program is used
|
||||
to open up SSH ports on servers. This will allow you to hack more servers,
|
||||
as many servers in the game require a certain number of opened ports in order for
|
||||
:code:`NUKE.exe` to gain root access.
|
||||
|
||||
When you are creating a program, you cannot interact with any other part of the game.
|
||||
Feel free to cancel your work on creating a program at any time, as your progress will
|
||||
be saved and can be picked back up later. :code:`BruteSSH.exe` takes about
|
||||
10 minutes to complete.
|
||||
|
||||
Optional: Create AutoLink.exe
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
On the :code:`Create Programs` page, you will notice another program you can create
|
||||
called :code:`AutoLink.exe`. If you don't mind waiting another 10-15 minutes, you should
|
||||
go ahead and create this program. It makes it much less tedious to connect to other servers,
|
||||
but it's not necessary for progressing.
|
||||
|
||||
Joining your first faction: CyberSec
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Shortly after you reached level 50 hacking, you should have received a message that
|
||||
said this::
|
||||
|
||||
Message received from unknown sender:
|
||||
|
||||
We've been watching you. Your skills are very impressive. But you're wasting
|
||||
your talents. If you join us, you can put your skills to good use and change
|
||||
the world for the better. If you join us, we can unlock your full potential.
|
||||
But first, you must pass our test. Find and hack our server using the Terminal.
|
||||
|
||||
-CyberSec
|
||||
|
||||
This message was saved as csec-test.msg onto your home computer.
|
||||
|
||||
If you didn't, or if you accidentally closed it, that's okay! Messages get saved onto
|
||||
your home computer. Enter the following |Terminal| commands to view the message::
|
||||
|
||||
$ home
|
||||
$ cat csec-test.msg
|
||||
|
||||
This message is part of the game's main "quest-line". It is a message from the
|
||||
|CyberSec faction| that is asking you to pass their test.
|
||||
Passing their test is simple, you just have to find their server and hack it through
|
||||
the |Terminal|. Their server is called :code:`CSEC`.
|
||||
To do this, we'll use the :ref:`scan_analyze_terminal_command`
|
||||
Terminal command, just like we did before::
|
||||
|
||||
$ home
|
||||
$ scan-analyze 2
|
||||
|
||||
This will show you the network for all servers that are up to 2 "nodes" away from
|
||||
your home computer. Remember that the network is randomly generated so it'll look
|
||||
different for everyone. Here's the relevant part of my :code:`scan-analyze` results::
|
||||
|
||||
>iron-gym
|
||||
--Root Access: NO, Required hacking skill: 100
|
||||
--Number of open ports required to NUKE: 1
|
||||
--RAM: 32
|
||||
|
||||
---->zer0
|
||||
------Root Access: NO, Required hacking skill: 75
|
||||
------Number of open ports required to NUKE: 1
|
||||
------RAM: 32
|
||||
|
||||
---->CSEC
|
||||
------Root Access: NO, Required hacking skill: 54
|
||||
------Number of open ports required to NUKE: 1
|
||||
------RAM: 8
|
||||
|
||||
This tells me that I can reach :code:`CSEC` by going through :code:`iron-gym`::
|
||||
|
||||
$ connect iron-gym
|
||||
$ connect CSEC
|
||||
|
||||
.. note::
|
||||
|
||||
If you created the :code:`AutoLink.exe` program earlier, then there is an easier
|
||||
method of connecting to :code:`CSEC`. You'll notice that in the :code:`scan-analyze`
|
||||
results, all of the server hostnames are white and underlined. You can simply
|
||||
click one of the server hostnames in order to connect to it. So, simply click
|
||||
:code:`CSEC`!
|
||||
|
||||
.. note::
|
||||
|
||||
Make sure you notice the required hacking skill for the :code:`CSEC` server.
|
||||
This is a random value between 51 and 60. Although you receive the message
|
||||
from CSEC once you hit 50 hacking, you cannot actually pass their test
|
||||
until your hacking is high enough to hack their server.
|
||||
|
||||
After you are connected to the :code:`CSEC` server, you can hack it. Note that this
|
||||
server requires one open port in order to gain root access. We can open the SSH port
|
||||
using the :code:`BruteSSH.exe` program we created earlier. In |Terminal|::
|
||||
|
||||
$ run BruteSSH.exe
|
||||
$ run NUKE.exe
|
||||
$ hack
|
||||
|
||||
Keep hacking the server until you are successful. After you successfully hack it, you should
|
||||
receive a faction invitation from |CyberSec| shortly afterwards. Accept it. If you accidentally
|
||||
reject the invitation, that's okay. Just go to the :code:`Factions` tab
|
||||
(|Keyboard shortcut| Alt + f) and you should see an option that lets you
|
||||
accept the invitation.
|
||||
|
||||
Congrats! You just joined your first faction. Don't worry about doing anything
|
||||
with this faction yet, we can come back to it later.
|
||||
|
||||
Using Additional Servers to Hack Joesguns
|
||||
-----------------------------------------
|
||||
Once you have the |BruteSSH| program, you will be able to gain root access
|
||||
to several additional servers. These servers have more RAM that you can use to
|
||||
run scripts. We'll use the RAM on these servers to run more scripts that target
|
||||
:code:`joesguns`.
|
||||
|
||||
Copying our Scripts
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
The server's we'll be using to run our scripts are:
|
||||
|
||||
* :code:`neo-net`
|
||||
* :code:`zer0`
|
||||
* :code:`max-hardware`
|
||||
* :code:`iron-gym`
|
||||
|
||||
All of these servers have 32GB of RAM. You can use the |Terminal| command
|
||||
:code:`scan-analyze 3` to see for yourself. To copy our hacking scripts onto these servers,
|
||||
go to |Terminal| and run::
|
||||
|
||||
$ home
|
||||
$ scp early-hack-template.script neo-net
|
||||
$ scp early-hack-template.script zer0
|
||||
$ scp early-hack-template.script max-hardware
|
||||
$ scp early-hack-template.script iron-gym
|
||||
|
||||
Since each of these servers has 32GB of RAM, we can run our hacking script with 12 threads
|
||||
on each server. By now, you should know how to connect to servers. So find and connect to
|
||||
each of the servers above using the :code:`scan-analyze 3` |Terminal| command. Then, use
|
||||
following |Terminal| command to run our hacking
|
||||
script with 12 threads::
|
||||
|
||||
$ run early-hack-template.script -t 12
|
||||
|
||||
Remember that if you have the |AutoLink| program, you can simply click on the hostname of a server
|
||||
after running :ref:`scan_analyze_terminal_command` to connect to it.
|
||||
|
||||
Profiting from Scripts & Gaining Reputation with CyberSec
|
||||
---------------------------------------------------------
|
||||
Now it's time to play the waiting game. It will take some time for your scripts to start
|
||||
earning money. Remember that most of your scripts are targeting |joesguns|. It will take a
|
||||
bit for them to :js:func:`grow` and :js:func:`weaken` the server to the appropriate values
|
||||
before they start hacking it. Once they do, however, the scripts will be very profitable.
|
||||
|
||||
.. note::
|
||||
|
||||
For reference, in about two hours after starting my first script, my scripts had a
|
||||
production rate of $20k per second and had earned a total of $70 million.
|
||||
(You can see these stats on the :code:`Active Scripts` tab).
|
||||
|
||||
After another 15 minutes, the production rate had increased to $25k per second
|
||||
and the scripts had made an additional $55 million.
|
||||
|
||||
Your results will vary based on how fast you earned money from crime/working/hacknet nodes,
|
||||
but this will hopefully give you a good indication of how much the scripts can earn.
|
||||
|
||||
In the meantime, we are going to be gaining reputation with the |CyberSec faction|.
|
||||
Go to the |Factions tab| on the left-hand
|
||||
navigation menu, and from there select |CyberSec|. In the middle of
|
||||
the page there should be a button for :code:`Hacking Contracts`.
|
||||
Click it to start earning reputation for the |CyberSec| faction (as well
|
||||
as some hacking experience). The higher your hacking level, the more reputation you
|
||||
will gain. Note that while you are working for a faction, you cannot interact with
|
||||
the rest of the game in any way. You can cancel your faction work at any time
|
||||
with no penalty.
|
||||
|
||||
Purchasing Upgrades and Augmentations
|
||||
-------------------------------------
|
||||
As I mentioned before, within 1-2 hours I had earned over $200 million. Now, it's time
|
||||
to spend all of this money on some persistent upgrades to help progress!
|
||||
|
||||
Upgrading RAM on Home computer
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
The most important thing to upgrade right now is the RAM on your home computer. This
|
||||
will allow you to run more scripts.
|
||||
|
||||
To upgrade your RAM, go to the |City tab| and visit the company |Alpha Enterprises|.
|
||||
There will be an option that says :code:`Purchase additional RAM for Home Computer`.
|
||||
Click it and follow the dialog box to upgrade your RAM.
|
||||
|
||||
I recommend getting your home computer's RAM to *at least* 128GB. Getting it even
|
||||
higher would be better.
|
||||
|
||||
Purchasing your First Augmentations
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Once you get ~1000 reputation with the |CyberSec faction|, you can purchase
|
||||
your first :ref:`Augmentation <gameplay_augmentations>` from them.
|
||||
|
||||
To do this, go to the |Factions tab| on the left-hand navigation menu
|
||||
(|Keyboard shortcut| Alt + f) and select |CyberSec|. There is an button
|
||||
near the bottom that says :code:`Purchase Augmentations`. This will bring up a
|
||||
page that displays all of the Augmentations available from |CyberSec|. Some of them
|
||||
may be locked right now. To unlock these, you will need to earn more
|
||||
reputation with |CyberSec|.
|
||||
|
||||
Augmentations give persistent upgrades in the form of multipliers. These aren't very
|
||||
powerful early in the game because the multipliers are small. However, the effects
|
||||
of Augmentations stack multiplicatively **with each other**, so as you continue to install
|
||||
many Augmentations their effects will increase significantly.
|
||||
|
||||
Because of this, I would recommend investing more in RAM upgrades for your home computer rather
|
||||
than Augmentations early on. Having enough RAM to run many scripts will allow you to make
|
||||
much more money, and then you can come back later on and get all these Augmentations.
|
||||
|
||||
Right now, I suggest purchasing at the very least the :code:`Neurotrainer I` Augmentation from
|
||||
|CyberSec|. If you have the money to spare, I would also suggest getting :code:`BitWire` and
|
||||
several levels of the :code:`NeuroFlux Governor` Augmentations. Note that each time
|
||||
you purchase an Augmentation,
|
||||
:ref:`the price of purchasing another increases by 90% <gameplay_augmentations_purchasingmultiple>`,
|
||||
so make sure you buy the most expensive Augmentation first. Don't worry, once you choose to
|
||||
install Augmentations, their prices will reset back to their original values.
|
||||
|
||||
Next Steps
|
||||
----------
|
||||
That's the end of the walkthrough portion of this guide! You should continue to explore
|
||||
what the game has to offer. There's quite a few features that aren't covered or mentioned
|
||||
in this guide, and even more that get unlocked as you continue to play!
|
||||
|
||||
Also, check out the :ref:`netscript` documentation to see what it has to offer. Writing
|
||||
scripts to perform and automate various tasks is where most of the fun in the game comes
|
||||
from (in my opinion)!
|
||||
|
||||
The following are a few things you may want to consider doing in the near future.
|
||||
|
||||
Installing Augmentations (and Resetting)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
If you've purchased any :ref:`gameplay_augmentations`, you'll need to install them before you
|
||||
actually gain their effects. Installing Augmentations is the game's "soft-reset" or "prestige"
|
||||
mechanic. You can :ref:`read more details about it here <gameplay_augmentations_installing>`.
|
||||
|
||||
To install your Augmentations, click the |Augmentations tab| on the left-hand navigation
|
||||
menu (|Keyboard shortcut| Alt + a). You will see a list of all of the Augmentations
|
||||
you have purchased. Below that, you will see a button that says :code:`Install Augmentations`.
|
||||
Be warned, after clicking this there is no way to undo it (unless you load an earlier save).
|
||||
|
||||
Automating the Script Startup Process
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Whenever you install Augmentations, all of your scripts are killed and you'll have to
|
||||
re-run them. Doing this every time you install Augmentations would be very tedious and annoying,
|
||||
so you should write a script to automate the process. Here's a simple example for a
|
||||
startup script. Feel free to adjust it to your liking.
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
// Array of all servers that don't need any ports opened
|
||||
// to gain root access. These have 16 GB of RAM
|
||||
var servers0Port = ["foodnstuff",
|
||||
"sigma-cosmetics",
|
||||
"joesguns",
|
||||
"nectar-net",
|
||||
"hong-fang-tea",
|
||||
"harakiri-sushi"];
|
||||
|
||||
// Array of all servers that only need 1 port opened
|
||||
// to gain root access. These have 32 GB of RAM
|
||||
var servers1Port = ["neo-net",
|
||||
"zer0",
|
||||
"max-hardware",
|
||||
"iron-gym"];
|
||||
|
||||
// Copy our scripts onto each server that requires 0 ports
|
||||
// to gain root access. Then use nuke() to gain admin access and
|
||||
// run the scripts.
|
||||
for (var i = 0; i < servers0Port.length; ++i) {
|
||||
var serv = servers0Port[i];
|
||||
|
||||
scp("early-hack-template.script", serv);
|
||||
nuke(serv);
|
||||
exec("early-hack-template.script", serv, 6);
|
||||
}
|
||||
|
||||
// Wait until we acquire the "BruteSSH.exe" program
|
||||
while (!fileExists("BruteSSH.exe")) {
|
||||
sleep(60000);
|
||||
}
|
||||
|
||||
// Copy our scripts onto each server that requires 1 port
|
||||
// to gain root access. Then use brutessh() and nuke()
|
||||
// to gain admin access and run the scripts.
|
||||
for (var i = 0; i < servers1Port.length; ++i) {
|
||||
var serv = servers1Port[i];
|
||||
|
||||
scp("early-hack-template.script", serv);
|
||||
brutessh(serv);
|
||||
nuke(serv);
|
||||
exec("early-hack-template.script", serv, 12);
|
||||
}
|
||||
|
||||
Random Tips
|
||||
-----------
|
||||
* Early on in the game, it's better to spend your money on upgrading RAM and purchasing
|
||||
new servers rather than spending it on Augmentations
|
||||
* The more money available on a server, the more effective the :js:func:`hack` and
|
||||
:js:func:`grow` Netscript functions will be. This is because both of these functions
|
||||
use percentages rather than flat values. :js:func:`hack` steals a percentage of a server's
|
||||
total available money, and :js:func:`grow` increases a server's money by X%.
|
||||
* There is a limit to how much money can exist on a server. This value is different for each
|
||||
server. The :js:func:`getServerMaxMoney` function will tell you this maximum value.
|
||||
* At this stage in the game, your combat stats (strength, defense, etc.) are not nearly
|
||||
as useful as your hacking stat. Do not invest too much time or money into gaining combat
|
||||
stat exp.
|
||||
|
||||
|
||||
|
||||
.. Substitution definitions
|
||||
.. |Alpha Enterprises| replace:: :code:`Alpha Enterprises`
|
||||
.. |Augmentations tab| replace:: :code:`Augmentations` tab
|
||||
.. |AutoLink| replace:: :code:`NUKE.exe`
|
||||
.. |BruteSSH| replace:: :code:`BruteSSH.exe`
|
||||
.. |City tab| replace:: :code:`City` tab
|
||||
.. |CyberSec| replace:: :code:`CyberSec`
|
||||
.. |CyberSec faction| replace:: :code:`CyberSec` :ref:`faction <gameplay_factions>`
|
||||
.. |Factions tab| replace:: :code:`Factions` tab
|
||||
.. |Keyboard shortcut| replace:: :ref:`Keyboard shortcut <shortcuts>`
|
||||
.. |NUKE| replace:: :code:`NUKE.exe`
|
||||
.. |Terminal| replace:: :code:`Terminal`
|
||||
.. |foodnstuff| replace:: :code:`foodnstuff`
|
||||
.. |harakiri-sushi| replace:: :code:`harakiri-sushi`
|
||||
.. |hong-fang-tea| replace:: :code:`hong-fang-tea`
|
||||
.. |joesguns| replace:: :code:`joesguns`
|
||||
.. |nectar-net| replace:: :code:`nectar-net`
|
||||
.. |sigma-cosmetics| replace:: :code:`sigma-cosmetics`
|
||||
|
@ -0,0 +1,20 @@
|
||||
getBitNodeMultipliers() Netscript Function
|
||||
==========================================
|
||||
|
||||
.. js:function:: getBitNodeMultipliers()
|
||||
|
||||
Returns an object containing the current BitNode multipliers. This function requires Source-File 5 in order
|
||||
to run. 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);
|
@ -0,0 +1,15 @@
|
||||
getHackTime(), getGrowTime(), & getWeakenTime()
|
||||
===============================================
|
||||
|
||||
The :js:func:`getHackTime`, :js:func:`getGrowTime`, and :js:func:`getWeakenTime`
|
||||
all take an additional third optional parameter for specifying a specific intelligence
|
||||
level to see how that would affect the hack/grow/weaken times. This parameter
|
||||
defaults to your current intelligence level.
|
||||
|
||||
(Intelligence is unlocked after obtaining Source-File 5).
|
||||
|
||||
The function signatures are then::
|
||||
|
||||
getHackTime(hostname/ip[, hackLvl=current level, intLvl=current level])
|
||||
getGrowTime(hostname/ip[, hackLvl=current level, intLvl=current level])
|
||||
getWeakenTime(hostname/ip[, hackLvl=current level, intLvl=current level])
|
13
doc/source/netscript/basicfunctions/brutessh.rst
Normal file
13
doc/source/netscript/basicfunctions/brutessh.rst
Normal file
@ -0,0 +1,13 @@
|
||||
brutessh() Netscript Function
|
||||
=============================
|
||||
|
||||
.. js:function:: brutessh(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer.
|
||||
|
||||
Example::
|
||||
|
||||
brutessh("foodnstuff");
|
13
doc/source/netscript/basicfunctions/clear.rst
Normal file
13
doc/source/netscript/basicfunctions/clear.rst
Normal file
@ -0,0 +1,13 @@
|
||||
clear() Netscript Function
|
||||
==========================
|
||||
|
||||
.. js:function:: clear(port/fn)
|
||||
|
||||
:param string/number port/fn: Port or text file to clear
|
||||
:RAM cost: 1 GB
|
||||
|
||||
This function is used to clear data in a `Netscript Ports <http://bitburner.wikia.com/wiki/Netscript_Ports>`_ or a text file.
|
||||
|
||||
If the *port/fn* 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 *port/fn* argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.
|
8
doc/source/netscript/basicfunctions/clearLog.rst
Normal file
8
doc/source/netscript/basicfunctions/clearLog.rst
Normal file
@ -0,0 +1,8 @@
|
||||
clearLog() Netscript Function
|
||||
=============================
|
||||
|
||||
.. js:function:: clearLog()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Clears the script's logs
|
14
doc/source/netscript/basicfunctions/deleteServer.rst
Normal file
14
doc/source/netscript/basicfunctions/deleteServer.rst
Normal file
@ -0,0 +1,14 @@
|
||||
deleteServer() Netscript Function
|
||||
=================================
|
||||
|
||||
.. js:function:: deleteServer(hostname)
|
||||
|
||||
:param string hostname: Hostname of the server to delete
|
||||
:RAM cost: 2.25 GB
|
||||
|
||||
Deletes one of your purchased servers, which is specified by its hostname.
|
||||
|
||||
The *hostname* argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from
|
||||
the string. This function will not delete a server that still has scripts running on it.
|
||||
|
||||
Returns true if successful, and false otherwise.
|
16
doc/source/netscript/basicfunctions/disableLog.rst
Normal file
16
doc/source/netscript/basicfunctions/disableLog.rst
Normal file
@ -0,0 +1,16 @@
|
||||
disableLog() Netscript Function
|
||||
===============================
|
||||
|
||||
.. js:function:: disableLog(fn)
|
||||
|
||||
:param string fn: Name of function for which to disable logging
|
||||
:RAM cost: 0 GB
|
||||
|
||||
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
|
10
doc/source/netscript/basicfunctions/enableLog.rst
Normal file
10
doc/source/netscript/basicfunctions/enableLog.rst
Normal file
@ -0,0 +1,10 @@
|
||||
enableLog() Netscript Function
|
||||
=============================
|
||||
|
||||
.. js:function:: enableLog(fn)
|
||||
|
||||
:param string fn: Name of function for which to enable logging
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Re-enables logging for the given function. If 'ALL' is passed into this function
|
||||
as an argument, then it will revert the effects of disableLog('ALL')
|
34
doc/source/netscript/basicfunctions/exec.rst
Normal file
34
doc/source/netscript/basicfunctions/exec.rst
Normal file
@ -0,0 +1,34 @@
|
||||
exec() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: exec(script, hostname/ip, [numThreads=1], [args...])
|
||||
|
||||
:param string script: Filename of script to execute
|
||||
:param string hostname/ip: IP or hostname of the 'target server' on which to execute the script
|
||||
:param number numThreads: Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer
|
||||
:param args...:
|
||||
Additional arguments to pass into the new script that is being run. Note that if any arguments are being
|
||||
passed into the new script, then the third argument *numThreads* must be filled in with a value.
|
||||
:RAM cost: 1.3 GB
|
||||
|
||||
Run a script as a separate process on a specified server. This is similar to the *run* function except
|
||||
that it can be used to run a script on any server, instead of just the current server.
|
||||
|
||||
Returns true if the script is successfully started, and false otherwise.
|
||||
|
||||
Running this function with a *numThreads* argument of 0 will return false without running the script.
|
||||
However, running this function with a negative *numThreads* argument will cause a runtime error.
|
||||
|
||||
The simplest way to use the *exec* command is to call it with just the script name and the target server.
|
||||
The following example will try to run *generic-hack.script* on the *foodnstuff* server::
|
||||
|
||||
exec("generic-hack.script", "foodnstuff");
|
||||
|
||||
The following example will try to run the script *generic-hack.script* on the *joesguns* server with 10 threads::
|
||||
|
||||
exec("generic-hack.script", "joesguns", 10);
|
||||
|
||||
This last example will try to run the script *foo.script* on the *foodnstuff* server with 5 threads. It will also pass
|
||||
the number 1 and the string "test" in as arguments to the script::
|
||||
|
||||
exec("foo.script", "foodnstuff", 5, 1, "test");
|
8
doc/source/netscript/basicfunctions/exit.rst
Normal file
8
doc/source/netscript/basicfunctions/exit.rst
Normal file
@ -0,0 +1,8 @@
|
||||
exit() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: exit()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Terminates the current script immediately
|
25
doc/source/netscript/basicfunctions/fileExists.rst
Normal file
25
doc/source/netscript/basicfunctions/fileExists.rst
Normal file
@ -0,0 +1,25 @@
|
||||
fileExists() Netscript Function
|
||||
===============================
|
||||
|
||||
.. js:function:: fileExists(filename, [hostname/ip])
|
||||
|
||||
:param string filename: Filename of file to check
|
||||
:param string hostname/ip:
|
||||
Hostname or IP of target server. This is optional. If it is not specified then the
|
||||
function will use the current server as the target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns a boolean indicating whether the specified file exists on the target server. The filename
|
||||
for scripts is case-sensitive, but for other types of files it is not. For example, *fileExists("brutessh.exe")*
|
||||
will work fine, even though the actual program is named "BruteSSH.exe".
|
||||
|
||||
If the *hostname/ip* argument is omitted, then the function will search through the current server (the server
|
||||
running the script that calls this function) for the file.
|
||||
|
||||
Examples::
|
||||
|
||||
fileExists("foo.script", "foodnstuff");
|
||||
fileExists("ftpcrack.exe");
|
||||
|
||||
The first example above will return true if the script named *foo.script* exists on the *foodnstuff* server, and false otherwise.
|
||||
The second example above will return true if the current server contains the *FTPCrack.exe* program, and false otherwise.
|
13
doc/source/netscript/basicfunctions/ftpcrack.rst
Normal file
13
doc/source/netscript/basicfunctions/ftpcrack.rst
Normal file
@ -0,0 +1,13 @@
|
||||
ftpcrack() Netscript Function
|
||||
=============================
|
||||
|
||||
.. js:function:: ftpcrack(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer.
|
||||
|
||||
Example::
|
||||
|
||||
ftpcrack("foodnstuff");
|
8
doc/source/netscript/basicfunctions/getFavorToDonate.rst
Normal file
8
doc/source/netscript/basicfunctions/getFavorToDonate.rst
Normal file
@ -0,0 +1,8 @@
|
||||
getFavorToDonate() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: getFavorToDonate()
|
||||
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the amount of Faction favor required to be able to donate to a faction.
|
13
doc/source/netscript/basicfunctions/getGrowTime.rst
Normal file
13
doc/source/netscript/basicfunctions/getGrowTime.rst
Normal file
@ -0,0 +1,13 @@
|
||||
getGrowTime() Netscript Function
|
||||
================================
|
||||
|
||||
.. js:function:: getGrowTime(hostname/ip[, hackLvl=current level])
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:param number hackLvl: Optional hacking level for the calculation. Defaults to player's current hacking level
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns the amount of time in seconds it takes to execute the *grow()* Netscript function on the target 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.
|
13
doc/source/netscript/basicfunctions/getHackTime.rst
Normal file
13
doc/source/netscript/basicfunctions/getHackTime.rst
Normal file
@ -0,0 +1,13 @@
|
||||
getHackTime() Netscript Function
|
||||
================================
|
||||
|
||||
.. js:function:: getHackTime(hostname/ip[, hackLvl=current level])
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:param number hackLvl: Optional hacking level for the calculation. Defaults to player's current hacking level
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns the amount of time in seconds it takes to execute the *hack()* Netscript function on the target 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.
|
8
doc/source/netscript/basicfunctions/getHackingLevel.rst
Normal file
8
doc/source/netscript/basicfunctions/getHackingLevel.rst
Normal file
@ -0,0 +1,8 @@
|
||||
getHackingLevel() Netscript Function
|
||||
====================================
|
||||
|
||||
.. js:function:: getHackingLevel()
|
||||
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns the player's current hacking level
|
@ -0,0 +1,22 @@
|
||||
getHackingMultipliers() Netscript Function
|
||||
==========================================
|
||||
|
||||
.. js:function:: getHackingMultipliers()
|
||||
|
||||
:RAM cost: 4 GB
|
||||
|
||||
Returns an object containing the Player's hacking related multipliers. These multipliers are
|
||||
returned in decimal forms, not percentages (e.g. 1.5 instead of 150%). The object has the following structure::
|
||||
|
||||
{
|
||||
chance: Player's hacking chance multiplier,
|
||||
speed: Player's hacking speed multiplier,
|
||||
money: Player's hacking money stolen multiplier,
|
||||
growth: Player's hacking growth multiplier
|
||||
}
|
||||
|
||||
Example of how this can be used::
|
||||
|
||||
mults = getHackingMultipliers();
|
||||
print(mults.chance);
|
||||
print(mults.growth);
|
@ -0,0 +1,23 @@
|
||||
getHacknetMultipliers() Netscript Function
|
||||
==========================================
|
||||
|
||||
.. js:function:: getHacknetMultipliers()
|
||||
|
||||
:RAM cost: 4 GB
|
||||
|
||||
Returns an object containing the Player's hacknet related multipliers. These multipliers are
|
||||
returned in decimal forms, not percentages (e.g. 1.5 instead of 150%). The object has the following structure::
|
||||
|
||||
{
|
||||
production: Player's hacknet production multiplier,
|
||||
purchaseCost: Player's hacknet purchase cost multiplier,
|
||||
ramCost: Player's hacknet ram cost multiplier,
|
||||
coreCost: Player's hacknet core cost multiplier,
|
||||
levelCost: Player's hacknet level cost multiplier
|
||||
}
|
||||
|
||||
Example of how this can be used::
|
||||
|
||||
mults = getHacknetMultipliers();
|
||||
print(mults.production);
|
||||
print(mults.purchaseCost);
|
8
doc/source/netscript/basicfunctions/getHostname.rst
Normal file
8
doc/source/netscript/basicfunctions/getHostname.rst
Normal file
@ -0,0 +1,8 @@
|
||||
getHostname() Netscript Function
|
||||
================================
|
||||
|
||||
.. js:function:: getHostname()
|
||||
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns a string with the hostname of the server that the script is running on
|
11
doc/source/netscript/basicfunctions/getPortHandle.rst
Normal file
11
doc/source/netscript/basicfunctions/getPortHandle.rst
Normal file
@ -0,0 +1,11 @@
|
||||
getPortHandle() Netscript Function
|
||||
==================================
|
||||
|
||||
.. js:function:: getPortHandle(port)
|
||||
|
||||
:param number port: Port number
|
||||
:RAM cost: 10 GB
|
||||
|
||||
Get a handle to a Netscript Port. See more details here: :ref:`netscript_ports`
|
||||
|
||||
**WARNING:** Port Handles only work in :ref:`netscriptjs`. They will not work in :ref:`netscript1`.
|
@ -0,0 +1,16 @@
|
||||
getPurchasedServerCost() Netscript Function
|
||||
===========================================
|
||||
|
||||
.. js:function:: getPurchasedServerCost(ram)
|
||||
|
||||
:RAM cost: 0.25 GB
|
||||
|
||||
:param number ram: Amount of RAM of a potential purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20)
|
||||
|
||||
Returns the cost to purchase a server with the specified amount of *ram*.
|
||||
|
||||
Examples::
|
||||
|
||||
for (i = 1; i <= 20; i++) {
|
||||
tprint(i + " -- " + getPurchasedServerCost(Math.pow(2, i)));
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
getPurchasedServerLimit() Netscript Function
|
||||
============================================
|
||||
|
||||
.. js:function:: getPurchasedServerLimit()
|
||||
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns the maximum number of servers you can purchase
|
@ -0,0 +1,8 @@
|
||||
getPurchasedServerMaxRam() Netscript Function
|
||||
=============================================
|
||||
|
||||
.. js:function:: getPurchasedServerMaxRam()
|
||||
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns the maximum RAM that a purchased server can have
|
11
doc/source/netscript/basicfunctions/getPurchasedServers.rst
Normal file
11
doc/source/netscript/basicfunctions/getPurchasedServers.rst
Normal file
@ -0,0 +1,11 @@
|
||||
getPurchasedServers() Netscript Function
|
||||
========================================
|
||||
|
||||
.. js:function:: getPurchasedServers([hostname=true])
|
||||
|
||||
:param boolean hostname:
|
||||
Specifies whether hostnames or IP addresses should be returned. If it's true then hostnames will be returned, and if false
|
||||
then IPs will be returned. If this argument is omitted then it is true by default
|
||||
:RAM cost: 2.25 GB
|
||||
|
||||
Returns an array with either the hostnames or IPs of all of the servers you have purchased.
|
14
doc/source/netscript/basicfunctions/getScriptExpGain.rst
Normal file
14
doc/source/netscript/basicfunctions/getScriptExpGain.rst
Normal file
@ -0,0 +1,14 @@
|
||||
getScriptExpGain() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: getScriptExpGain([scriptname], [hostname/ip], [args...])
|
||||
|
||||
: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
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for offline experience gains).
|
||||
Remember that a script is uniquely identified by both its name and its arguments.
|
||||
|
||||
This function can also return the total experience gain rate of all of your active scripts by running the function with no arguments.
|
18
doc/source/netscript/basicfunctions/getScriptIncome.rst
Normal file
18
doc/source/netscript/basicfunctions/getScriptIncome.rst
Normal file
@ -0,0 +1,18 @@
|
||||
getScriptIncome() Netscript Function
|
||||
====================================
|
||||
|
||||
.. js:function:: getScriptIncome([scriptname], [hostname/ip], [args...])
|
||||
|
||||
: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
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the amount of income the specified script generates while online (when the game is open, does not apply for offline income).
|
||||
Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script with the arguments
|
||||
"foodnstuff" and "5" then in order to use this function to get that script's income you must specify those same arguments in the same order
|
||||
in this function call.
|
||||
|
||||
This function can also be called with no arguments. If called with no arguments, then 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.
|
33
doc/source/netscript/basicfunctions/getScriptLogs.rst
Normal file
33
doc/source/netscript/basicfunctions/getScriptLogs.rst
Normal file
@ -0,0 +1,33 @@
|
||||
getScriptLogs() Netscript Function
|
||||
==================================
|
||||
|
||||
.. js:function:: getScriptLogs([fn], [hostname/ip=current ip], [args...])
|
||||
|
||||
:param string fn: Optional. Filename of script to get logs from.
|
||||
:param string ip: Optional. IP or hostname of the server that the script is on
|
||||
:param args...: Arguments to identify which scripts to get logs for
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Returns a script's logs. The logs are returned as an array, where each
|
||||
line is an element in the array. The most recently logged line is at the
|
||||
end of the array.
|
||||
|
||||
Note that 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 `fn`, `hostname/ip,` 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.
|
||||
|
||||
Examples::
|
||||
|
||||
// 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");
|
8
doc/source/netscript/basicfunctions/getScriptName.rst
Normal file
8
doc/source/netscript/basicfunctions/getScriptName.rst
Normal file
@ -0,0 +1,8 @@
|
||||
getScriptName() Netscript Function
|
||||
==================================
|
||||
|
||||
.. js:function:: getScriptName()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Returns the current script name
|
11
doc/source/netscript/basicfunctions/getScriptRam.rst
Normal file
11
doc/source/netscript/basicfunctions/getScriptRam.rst
Normal file
@ -0,0 +1,11 @@
|
||||
getScriptRam() Netscript Function
|
||||
===========================
|
||||
|
||||
.. js:function:: getScriptRam(scriptname[, hostname/ip])
|
||||
|
||||
:param string scriptname: Filename of script. This is case-sensitive.
|
||||
:param string hostname/ip: Hostname or IP of target server the script is located on. This is optional, If it is not specified then the function will set the current server as the target server.
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the amount of RAM required to run the specified script on the target server. Returns
|
||||
0 if the script does not exist.
|
@ -0,0 +1,12 @@
|
||||
getServerBaseSecurityLevel() Netscript Function
|
||||
===============================================
|
||||
|
||||
.. js:function:: getServerBaseSecurityLevel(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the base security level of the target server. This is the security level that the server starts out with.
|
||||
This is different than *getServerSecurityLevel()* because *getServerSecurityLevel()* returns the current
|
||||
security level of a server, which can constantly change due to *hack()*, *grow()*, and *weaken()*, calls on that
|
||||
server. The base security level will stay the same until you reset by installing an Augmentation(s).
|
12
doc/source/netscript/basicfunctions/getServerGrowth.rst
Normal file
12
doc/source/netscript/basicfunctions/getServerGrowth.rst
Normal file
@ -0,0 +1,12 @@
|
||||
getServerGrowth() Netscript Function
|
||||
====================================
|
||||
|
||||
.. js:function:: getServerGrowth(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the server's instrinsic "growth parameter". This growth parameter is a number
|
||||
between 1 and 100 that represents how quickly the server's money grows. This parameter affects the
|
||||
percentage by which the server's money is increased when using the *grow()* function. A higher
|
||||
growth parameter will result in a higher percentage increase from *grow()*.
|
@ -0,0 +1,9 @@
|
||||
getServerMaxMoney() Netscript Function
|
||||
======================================
|
||||
|
||||
.. js:function:: getServerMaxMoney(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the maximum amount of money that can be available on a server
|
@ -0,0 +1,9 @@
|
||||
getServerMinSecurityLevel() Netscript Function
|
||||
==============================================
|
||||
|
||||
.. js:function:: getServerMinSecurityLevel(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the minimum security level of the target server
|
@ -0,0 +1,15 @@
|
||||
getServerMoneyAvailable() Netscript Function
|
||||
============================================
|
||||
|
||||
.. js:function:: getServerMoneyAvailable(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the amount of money available on a server. **Running this function on the home computer will return
|
||||
the player's money.**
|
||||
|
||||
Example::
|
||||
|
||||
getServerMoneyAvailable("foodnstuff");
|
||||
getServerMoneyAvailable("home"); //Returns player's money
|
@ -0,0 +1,9 @@
|
||||
getServerNumPortsRequired() Netscript Function
|
||||
==============================================
|
||||
|
||||
.. js:function:: getServerNumPortsRequired(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the number of open ports required to successfully run NUKE.exe on the specified server.
|
17
doc/source/netscript/basicfunctions/getServerRam.rst
Normal file
17
doc/source/netscript/basicfunctions/getServerRam.rst
Normal file
@ -0,0 +1,17 @@
|
||||
getServerRam() Netscript Function
|
||||
=================================
|
||||
|
||||
.. js:function:: getServerRam(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
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::
|
||||
|
||||
res = getServerRam("helios");
|
||||
totalRam = res[0];
|
||||
ramUsed = res[1];
|
@ -0,0 +1,9 @@
|
||||
getServerRequiredHackingLevel() Netscript Function
|
||||
==================================================
|
||||
|
||||
.. js:function:: getServerRequiredHackingLevel(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the required hacking level of the target server
|
@ -0,0 +1,10 @@
|
||||
getServerSecurityLevel() Netscript Function
|
||||
===========================================
|
||||
|
||||
.. js:function:: getServerSecurityLevel(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns the security level of the target server. A server's security level is denoted by a number, typically
|
||||
between 1 and 100 (but it can go above 100).
|
@ -0,0 +1,8 @@
|
||||
getTimeSinceLastAug() Netscript Function
|
||||
========================================
|
||||
|
||||
.. js:function:: getTimeSinceLastAug()
|
||||
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns the amount of time in milliseconds that have passed since you last installed Augmentations
|
13
doc/source/netscript/basicfunctions/getWeakenTime.rst
Normal file
13
doc/source/netscript/basicfunctions/getWeakenTime.rst
Normal file
@ -0,0 +1,13 @@
|
||||
getWeakenTime() Netscript Function
|
||||
==================================
|
||||
|
||||
.. js:function:: getWeakenTime(hostname/ip[, hackLvl=current level])
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:param number hackLvl: Optional hacking level for the calculation. Defaults to player's current hacking level
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns the amount of time in seconds it takes to execute the *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.
|
21
doc/source/netscript/basicfunctions/grow.rst
Normal file
21
doc/source/netscript/basicfunctions/grow.rst
Normal file
@ -0,0 +1,21 @@
|
||||
grow() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: grow(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server to grow
|
||||
:returns: The number by which the money on the server was multiplied for the growth
|
||||
:RAM cost: 0.15 GB
|
||||
|
||||
Use your hacking skills to increase the amount of money available on a server. The runtime for this command depends on your hacking
|
||||
level and the target server's security level. When grow() completes, the money available on a target server will be increased by a
|
||||
certain, fixed percentage. This percentage is determined by the target server's growth rate (which varies between servers) and security level.
|
||||
Generally, higher-level servers have higher growth rates. The getServerGrowth() function can be used to obtain a server's growth rate.
|
||||
|
||||
Like hack(), grow() can be called on any server, regardless of where the script is running. The grow() command requires
|
||||
root access to the target server, but there is no required hacking level to run the command. It also raises the security level
|
||||
of the target server by 0.004.
|
||||
|
||||
Example::
|
||||
|
||||
grow("foodnstuff");
|
24
doc/source/netscript/basicfunctions/growthAnalyze.rst
Normal file
24
doc/source/netscript/basicfunctions/growthAnalyze.rst
Normal file
@ -0,0 +1,24 @@
|
||||
growthAnalyze() Netscript Function
|
||||
==================================
|
||||
|
||||
.. js:function:: growthAnalyze(hostname/ip, growthAmount)
|
||||
|
||||
:param string hostname/ip: IP or hostname of server to analyze
|
||||
:param number growthAmount: Multiplicative factor by which the server is grown. Decimal form.
|
||||
:returns: The amount of grow() calls needed to grow the specified server by the specified amount
|
||||
:RAM cost: 1 GB
|
||||
|
||||
This function returns the number of "growths" needed in order to increase the amount
|
||||
of money available on the specified server by the specified amount.
|
||||
|
||||
The specified amount is multiplicative and is in decimal form, not percentage.
|
||||
|
||||
For example, if you want to determine how many `grow()` calls you need
|
||||
to double the amount of money on `foodnstuff`, you would use::
|
||||
|
||||
growthAnalyze("foodnstuff", 2);
|
||||
|
||||
If this returns 100, then this means you need to call `grow()` 100 times
|
||||
in order to double the money (or once with 100 threads).
|
||||
|
||||
**Warning**: The value returned by this function isn't necessarily a whole number.
|
22
doc/source/netscript/basicfunctions/hack.rst
Normal file
22
doc/source/netscript/basicfunctions/hack.rst
Normal file
@ -0,0 +1,22 @@
|
||||
hack() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: hack(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server to hack
|
||||
:returns: The amount of money stolen if the hack is successful, and zero otherwise
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends
|
||||
on your hacking level and the target server's security level. In order to hack a server you must first gain root access
|
||||
to that server and also have the required hacking level.
|
||||
|
||||
A script can hack a server from anywhere. It does not need to be running on the same server to hack that server. For example,
|
||||
you can create a script that hacks the 'foodnstuff' server and run that script on any server in the game.
|
||||
|
||||
A successful hack() on a server will raise that server's security level by 0.002.
|
||||
|
||||
Example::
|
||||
|
||||
hack("foodnstuff");
|
||||
hack("10.1.2.3");
|
20
doc/source/netscript/basicfunctions/hackAnalyzePercent.rst
Normal file
20
doc/source/netscript/basicfunctions/hackAnalyzePercent.rst
Normal file
@ -0,0 +1,20 @@
|
||||
hackAnalyzePercent() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: hackAnalyzePercent(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of target server
|
||||
:returns: The percentage of money you will steal from the target server with a single hack
|
||||
:RAM cost: 1 GB
|
||||
|
||||
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 (Netscript
|
||||
functions typically return in decimal form, but not this one).**
|
||||
|
||||
For example, assume the following returns 1::
|
||||
|
||||
hackAnalyzePercent("foodnstuff");
|
||||
|
||||
This means that if hack the `foodnstuff` server, then you will steal 1% of its
|
||||
total money. If you `hack()` using N threads, then you will steal N% of its total
|
||||
money.
|
24
doc/source/netscript/basicfunctions/hackAnalyzeThreads.rst
Normal file
24
doc/source/netscript/basicfunctions/hackAnalyzeThreads.rst
Normal file
@ -0,0 +1,24 @@
|
||||
hackAnalyzeThreads() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: hackAnalyzeThreads(hostname/ip, hackAmount)
|
||||
|
||||
:param string hostname/ip: IP or 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 hack() the server for *hackAmount* money
|
||||
:RAM cost: 1 GB
|
||||
|
||||
This function returns the number of script threads you need when running
|
||||
the `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::
|
||||
|
||||
hackAnalyzeThreads("foodnstuff", 1e6);
|
||||
|
||||
If this function returns 50, this means that if your next `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.
|
11
doc/source/netscript/basicfunctions/hackChance.rst
Normal file
11
doc/source/netscript/basicfunctions/hackChance.rst
Normal file
@ -0,0 +1,11 @@
|
||||
hackChance() Netscript Function
|
||||
===============================
|
||||
|
||||
.. js:function:: hackChance(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of target server
|
||||
:returns: The chance you have of successfully hacking the target server
|
||||
:RAM cost: 1 GB
|
||||
|
||||
Returns the chance you have of successfully hacking the specified server. This
|
||||
returned value is in decimal form, not percentage.
|
15
doc/source/netscript/basicfunctions/hasRootAccess.rst
Normal file
15
doc/source/netscript/basicfunctions/hasRootAccess.rst
Normal file
@ -0,0 +1,15 @@
|
||||
hasRootAccess() Netscript Function
|
||||
==================================
|
||||
|
||||
.. js:function:: hasRootAccess(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of the target server
|
||||
:RAM cost: 0.05 GB
|
||||
|
||||
Returns a boolean indicating whether or not the player has root access to the specified target server.
|
||||
|
||||
Example::
|
||||
|
||||
if (hasRootAccess("foodnstuff") == false) {
|
||||
nuke("foodnstuff");
|
||||
}
|
13
doc/source/netscript/basicfunctions/httpworm.rst
Normal file
13
doc/source/netscript/basicfunctions/httpworm.rst
Normal file
@ -0,0 +1,13 @@
|
||||
httpworm() Netscript Function
|
||||
=============================
|
||||
|
||||
.. js:function:: httpworm(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer.
|
||||
|
||||
Example::
|
||||
|
||||
httpworm("foodnstuff");
|
10
doc/source/netscript/basicfunctions/isLogEnabled.rst
Normal file
10
doc/source/netscript/basicfunctions/isLogEnabled.rst
Normal file
@ -0,0 +1,10 @@
|
||||
isLogEnabled() Netscript Function
|
||||
=================================
|
||||
|
||||
.. js:function:: isLogEnabled(fn)
|
||||
|
||||
:param string fn: Name of function to check
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Returns a boolean indicating whether or not logging is enabled for that
|
||||
function (or 'ALL')
|
29
doc/source/netscript/basicfunctions/isRunning.rst
Normal file
29
doc/source/netscript/basicfunctions/isRunning.rst
Normal file
@ -0,0 +1,29 @@
|
||||
isRunning() Netscript Function
|
||||
==============================
|
||||
|
||||
.. js:function:: isRunning(filename, hostname/ip, [args...])
|
||||
|
||||
:param string filename: Filename of script to check. This is case-sensitive.
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:param args...: Arguments to specify/identify which scripts to search for
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns a boolean indicating whether the specified script is running on the target server. Remember that a script is
|
||||
uniquely identified by both its name and its arguments.
|
||||
|
||||
**Examples:**
|
||||
|
||||
In this first example below, the function call will return true if there is a script named *foo.script* with no arguments
|
||||
running on the *foodnstuff* server, and false otherwise::
|
||||
|
||||
isRunning("foo.script", "foodnstuff");
|
||||
|
||||
In this second example below, the function call will return true if there is a script named *foo.script* with no arguments
|
||||
running on the current server, and false otherwise::
|
||||
|
||||
isRunning("foo.script", getHostname());
|
||||
|
||||
In this next example below, the function call will return true if there is a script named *foo.script* running with the arguments
|
||||
1, 5, and "test" (in that order) on the *joesguns* server, and false otherwise::
|
||||
|
||||
isRunning("foo.script", "joesguns", 1, 5, "test");
|
29
doc/source/netscript/basicfunctions/kill.rst
Normal file
29
doc/source/netscript/basicfunctions/kill.rst
Normal file
@ -0,0 +1,29 @@
|
||||
kill() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: kill(script, hostname/ip, [args...])
|
||||
|
||||
:param string script: Filename of the script to kill
|
||||
:param string hostname/ip: IP or hostname of the server on which to kill the script
|
||||
:param args...: Arguments to identify which script to kill
|
||||
:RAM cost: 0.5 GB
|
||||
|
||||
Kills the script on the target server specified by the script's name and arguments. Remember that scripts
|
||||
are uniquely identified by both their name and arguments. For example, if *foo.script* is run with the argument 1, then this
|
||||
is not the same as *foo.script* run with the argument 2, even though they have the same code.
|
||||
|
||||
If this function successfully kills the specified script, then it will return true. Otherwise, it will return false.
|
||||
|
||||
Examples:
|
||||
|
||||
The following example will try to kill a script named *foo.script* on the *foodnstuff* server that was ran with no arguments::
|
||||
|
||||
kill("foo.script", "foodnstuff");
|
||||
|
||||
The following will try to kill a script named *foo.script* on the current server that was ran with no arguments::
|
||||
|
||||
kill("foo.script", getHostname());
|
||||
|
||||
The following will try to kill a script named *foo.script* on the current server that was ran with the arguments 1 and "foodnstuff"::
|
||||
|
||||
kill("foo.script", getHostname(), 1, "foodnstuff");
|
10
doc/source/netscript/basicfunctions/killall.rst
Normal file
10
doc/source/netscript/basicfunctions/killall.rst
Normal file
@ -0,0 +1,10 @@
|
||||
killall() Netscript Function
|
||||
============================
|
||||
|
||||
.. js:function:: killall(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the server on which to kill all scripts
|
||||
:RAM cost: 0.5 GB
|
||||
|
||||
Kills all running scripts on the specified server. This function returns true if any scripts were killed, and
|
||||
false otherwise. In other words, it will return true if there are any scripts running on the target server.
|
11
doc/source/netscript/basicfunctions/ls.rst
Normal file
11
doc/source/netscript/basicfunctions/ls.rst
Normal file
@ -0,0 +1,11 @@
|
||||
ls() Netscript Function
|
||||
=======================
|
||||
|
||||
.. js:function:: ls(hostname/ip, [grep])
|
||||
|
||||
:param string hostname/ip: Hostname or IP of the target server
|
||||
:param string grep: a substring to search for in the filename
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Returns an array with the filenames of all files on the specified server (as strings). The returned array
|
||||
is sorted in alphabetic order
|
19
doc/source/netscript/basicfunctions/nFormat.rst
Normal file
19
doc/source/netscript/basicfunctions/nFormat.rst
Normal file
@ -0,0 +1,19 @@
|
||||
nFormat() Netscript Function
|
||||
============================
|
||||
|
||||
.. js:function:: nFormat(n, format)
|
||||
|
||||
:param number n: Number to format
|
||||
:param string format: Formatter
|
||||
|
||||
Converts a number into a string with the specified formatter. This uses the
|
||||
`numeraljs <http://numeraljs.com/>`_ library, so the formatters must be compatible
|
||||
with that.
|
||||
|
||||
This is the same function that the game itself uses to display numbers.
|
||||
|
||||
Examples::
|
||||
|
||||
nFormat(1.23e9, "$0.000a"); // Returns "$1.230b"
|
||||
nFormat(12345.678, "0,0"); // Returns "12,346"
|
||||
nFormat(0.84, "0.0%"); // Returns "84.0%
|
13
doc/source/netscript/basicfunctions/nuke.rst
Normal file
13
doc/source/netscript/basicfunctions/nuke.rst
Normal file
@ -0,0 +1,13 @@
|
||||
nuke() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: nuke(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer.
|
||||
|
||||
Example::
|
||||
|
||||
nuke("foodnstuff");
|
12
doc/source/netscript/basicfunctions/peek.rst
Normal file
12
doc/source/netscript/basicfunctions/peek.rst
Normal file
@ -0,0 +1,12 @@
|
||||
peek() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: peek(port)
|
||||
|
||||
:param number port: Port to peek. Must be an integer between 1 and 20
|
||||
:RAM cost: 1 GB
|
||||
|
||||
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
|
9
doc/source/netscript/basicfunctions/print.rst
Normal file
9
doc/source/netscript/basicfunctions/print.rst
Normal file
@ -0,0 +1,9 @@
|
||||
print() Netscript Function
|
||||
===========================
|
||||
|
||||
.. js:function:: print(x)
|
||||
|
||||
:param x: Value to be printed
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Prints a value or a variable to the script's logs.
|
10
doc/source/netscript/basicfunctions/prompt.rst
Normal file
10
doc/source/netscript/basicfunctions/prompt.rst
Normal file
@ -0,0 +1,10 @@
|
||||
prompt() Netscript Function
|
||||
===========================
|
||||
|
||||
.. js:function:: prompt(txt)
|
||||
|
||||
:param string txt: Text to appear in the prompt dialog box
|
||||
:RAM cost: 0 GB
|
||||
|
||||
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.
|
28
doc/source/netscript/basicfunctions/ps.rst
Normal file
28
doc/source/netscript/basicfunctions/ps.rst
Normal file
@ -0,0 +1,28 @@
|
||||
ps() Netscript Function
|
||||
=======================
|
||||
|
||||
.. js:function:: ps(hostname/ip=current ip)
|
||||
|
||||
:param string ip: Hostname or IP address of the target server.
|
||||
If not specified, it will be the current server's IP by default
|
||||
:RAM cost: 0.2 GB
|
||||
|
||||
Returns an array with general information about all scripts running on the specified
|
||||
target server. The information for each server is given in an object with
|
||||
the following structure::
|
||||
|
||||
{
|
||||
filename: Script name,
|
||||
threads: Number of threads script is running with,
|
||||
args: Script's arguments
|
||||
}
|
||||
|
||||
Example usage (using :ref:`netscriptjs`)::
|
||||
|
||||
export async function main(ns) {
|
||||
const ps = ns.ps("home");
|
||||
for (let i = 0; i < ps.length; ++i) {
|
||||
ns.tprint(ps[i].filename + ' ' + ps[i].threads);
|
||||
ns.tprint(ps[i].args);
|
||||
}
|
||||
}
|
30
doc/source/netscript/basicfunctions/purchaseServer.rst
Normal file
30
doc/source/netscript/basicfunctions/purchaseServer.rst
Normal file
@ -0,0 +1,30 @@
|
||||
purchaseServer() Netscript Function
|
||||
===================================
|
||||
|
||||
.. js:function:: purchaseServer(hostname, ram)
|
||||
|
||||
:param string hostname: Hostname of the purchased server
|
||||
:param number ram: Amount of RAM of the purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20)
|
||||
:RAM cost: 2.25 GB
|
||||
|
||||
Purchased a server with the specified hostname and amount of RAM.
|
||||
|
||||
The *hostname* argument can be any data type, but it will be converted to a string and have whitespace removed. Anything that resolves to an empty string will
|
||||
cause the function to fail. If there is already a server with the specified hostname, then the function will automatically append
|
||||
a number at the end of the *hostname* argument value until it finds a unique hostname. For example, if the script calls
|
||||
*purchaseServer("foo", 4)* but a server named "foo" already exists, the it will automatically change the hostname to "foo-0". If there is already
|
||||
a server with the hostname "foo-0", then it will change the hostname to "foo-1", and so on.
|
||||
|
||||
Note that there is a maximum limit to the amount of servers you can purchase.
|
||||
|
||||
Returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return an
|
||||
empty string. The function will fail if the arguments passed in are invalid, if the player does not have enough money to purchase
|
||||
the specified server, or if the player has exceeded the maximum amount of servers.
|
||||
|
||||
Example::
|
||||
|
||||
ram = 64;
|
||||
hn = "pserv-";
|
||||
for (i = 0; i < 5; ++i) {
|
||||
purchaseServer(hn + i, ram);
|
||||
}
|
16
doc/source/netscript/basicfunctions/read.rst
Normal file
16
doc/source/netscript/basicfunctions/read.rst
Normal file
@ -0,0 +1,16 @@
|
||||
read() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: read(port/fn)
|
||||
|
||||
:param string/number port/fn: Port or text file to read from
|
||||
:RAM cost: 1 GB
|
||||
|
||||
This function is used to read data from a port, a text file (.txt), or a script (.script, .js, .ns)
|
||||
|
||||
If the argument *port/fn* 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 *port/fn* 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.
|
13
doc/source/netscript/basicfunctions/relaysmtp.rst
Normal file
13
doc/source/netscript/basicfunctions/relaysmtp.rst
Normal file
@ -0,0 +1,13 @@
|
||||
relaysmtp() Netscript Function
|
||||
==============================
|
||||
|
||||
.. js:function:: relaysmtp(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer.
|
||||
|
||||
Example::
|
||||
|
||||
relaysmtp("foodnstuff");
|
11
doc/source/netscript/basicfunctions/rm.rst
Normal file
11
doc/source/netscript/basicfunctions/rm.rst
Normal file
@ -0,0 +1,11 @@
|
||||
rm() Netscript Function
|
||||
=======================
|
||||
|
||||
.. js:function:: rm(fn[, hostname/ip=current server])
|
||||
|
||||
:param string fn: Filename of file to remove. Must include the extension
|
||||
:param string hostname/ip: Hostname or IP Address of the server on which to delete the file. Optional. Defaults to current server
|
||||
:returns: True if it successfully deletes the file, and false otherwise
|
||||
:RAM cost: 1 GB
|
||||
|
||||
Removes the specified file from the current server. This function works for every file type except message (.msg) files.
|
33
doc/source/netscript/basicfunctions/run.rst
Normal file
33
doc/source/netscript/basicfunctions/run.rst
Normal file
@ -0,0 +1,33 @@
|
||||
run() Netscript Function
|
||||
========================
|
||||
|
||||
.. js:function:: run(script, [numThreads=1], [args...])
|
||||
|
||||
:param string script: Filename of script to run
|
||||
:param number numThreads: Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer
|
||||
:param args...:
|
||||
Additional arguments to pass into the new script that is being run. Note that if any arguments are being
|
||||
passed into the new script, then the second argument *numThreads* must be filled in with a value.
|
||||
:RAM cost: 1 GB
|
||||
|
||||
Run a script as a separate process. This function can only be used to run scripts located on the current server (the server
|
||||
running the script that calls this function).
|
||||
|
||||
Returns true if the script is successfully started, and false otherwise.
|
||||
|
||||
Running this function with a *numThreads* argument of 0 will return false without running the script.
|
||||
However, running this function with a negative *numThreads* argument will cause a runtime error.
|
||||
|
||||
The simplest way to use the *run* command is to call it with just the script name. The following example will run
|
||||
'foo.script' single-threaded with no arguments::
|
||||
|
||||
run("foo.script");
|
||||
|
||||
The following example will run 'foo.script' but with 5 threads instead of single-threaded::
|
||||
|
||||
run("foo.script", 5);
|
||||
|
||||
This next example will run 'foo.script' single-threaded, and will pass the string 'foodnstuff' into the script
|
||||
as an argument::
|
||||
|
||||
run("foo.script", 1, 'foodnstuff');
|
11
doc/source/netscript/basicfunctions/scan.rst
Normal file
11
doc/source/netscript/basicfunctions/scan.rst
Normal file
@ -0,0 +1,11 @@
|
||||
scan() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: scan(hostname/ip=current ip[, hostnames=true])
|
||||
|
||||
:param string hostname/ip: IP or hostname of the server to scan
|
||||
:param boolean: Optional boolean specifying whether the function should output hostnames (if true) or IP addresses (if false)
|
||||
:RAM cost: 0.2 GB
|
||||
|
||||
Returns an array containing the hostnames or IPs of all servers that are one node way from the specified target server. The
|
||||
hostnames/IPs in the returned array are strings.
|
29
doc/source/netscript/basicfunctions/scp.rst
Normal file
29
doc/source/netscript/basicfunctions/scp.rst
Normal file
@ -0,0 +1,29 @@
|
||||
scp() Netscript Function
|
||||
========================
|
||||
|
||||
.. js:function:: scp(files, [source], destination)
|
||||
|
||||
:param string/array files: Filename or an array of filenames of script/literature files to copy
|
||||
:param string source:
|
||||
Hostname or IP 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 or IP of the destination server, which is the server to which the file will be copied.
|
||||
:RAM cost: 0.6 GB
|
||||
|
||||
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, or an array of strings specifying multiple files to copy.
|
||||
|
||||
Returns true if the script/literature file is successfully copied over and false otherwise. If the *files* argument is an array
|
||||
then this function will return true if at least one of the files in the array is successfully copied.
|
||||
|
||||
Examples::
|
||||
|
||||
//Copies hack-template.script from the current server to foodnstuff
|
||||
scp("hack-template.script", "foodnstuff");
|
||||
|
||||
//Copies foo.lit from the helios server to the home computer
|
||||
scp("foo.lit", "helios", "home");
|
||||
|
||||
//Tries to copy three files from rothman-uni to home computer
|
||||
files = ["foo1.lit", "foo2.script", "foo3.script"];
|
||||
scp(files, "rothman-uni", "home");
|
11
doc/source/netscript/basicfunctions/scriptKill.rst
Normal file
11
doc/source/netscript/basicfunctions/scriptKill.rst
Normal file
@ -0,0 +1,11 @@
|
||||
scriptKill() Netscript Function
|
||||
===============================
|
||||
|
||||
.. js:function:: scriptKill(scriptname, hostname/ip)
|
||||
|
||||
:param string scriptname: Filename of script to kill. This is case-sensitive.
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 1 GB
|
||||
|
||||
Kills all scripts with the specified filename on the target server specified by *hostname/ip*, regardless of arguments. Returns
|
||||
true if one or more scripts were successfully killed, and false if none were.
|
24
doc/source/netscript/basicfunctions/scriptRunning.rst
Normal file
24
doc/source/netscript/basicfunctions/scriptRunning.rst
Normal file
@ -0,0 +1,24 @@
|
||||
scriptRunning() Netscript Function
|
||||
==================================
|
||||
|
||||
.. js:function:: scriptRunning(scriptname, hostname/ip)
|
||||
|
||||
:param string scriptname: Filename of script to check. This is case-sensitive.
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 1 GB
|
||||
|
||||
Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of
|
||||
its arguments.
|
||||
|
||||
This is different than the *isRunning()* function because it does not try to identify a specific instance of a running script
|
||||
by its arguments.
|
||||
|
||||
**Examples:**
|
||||
|
||||
The example below will return true if there is any script named *foo.script* running on the *foodnstuff* server, and false otherwise::
|
||||
|
||||
scriptRunning("foo.script", "foodnstuff");
|
||||
|
||||
The example below will return true if there is any script named "foo.script" running on the current server, and false otherwise::
|
||||
|
||||
scriptRunning("foo.script", getHostname());
|
9
doc/source/netscript/basicfunctions/serverExists.rst
Normal file
9
doc/source/netscript/basicfunctions/serverExists.rst
Normal file
@ -0,0 +1,9 @@
|
||||
serverExists() Netscript Function
|
||||
=================================
|
||||
|
||||
.. js:function:: serverExists(hostname/ip)
|
||||
|
||||
:param string hostname/ip: Hostname or IP of target server
|
||||
:RAM cost: 0.1 GB
|
||||
|
||||
Returns a boolean denoting whether or not the specified server exists
|
9
doc/source/netscript/basicfunctions/sleep.rst
Normal file
9
doc/source/netscript/basicfunctions/sleep.rst
Normal file
@ -0,0 +1,9 @@
|
||||
sleep() Netscript Function
|
||||
==========================
|
||||
|
||||
.. js:function:: sleep(n)
|
||||
|
||||
:param number n: Number of milliseconds to sleep
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Suspends the script for n milliseconds.
|
20
doc/source/netscript/basicfunctions/spawn.rst
Normal file
20
doc/source/netscript/basicfunctions/spawn.rst
Normal file
@ -0,0 +1,20 @@
|
||||
spawn() Netscript Function
|
||||
==========================
|
||||
|
||||
.. js:function:: spawn(script, numThreads, [args...])
|
||||
|
||||
:param string script: Filename of script to execute
|
||||
:param number numThreads: Number of threads to spawn new script with. Will be rounded to nearest integer
|
||||
:param args...:
|
||||
Additional arguments to pass into the new script that is being run.
|
||||
:RAM cost: 2 GB
|
||||
|
||||
Terminates the current script, and then after a delay of about 20 seconds it will execute the newly-specified script.
|
||||
The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one.
|
||||
This function can only be used to run scripts on the local server.
|
||||
|
||||
Because this function immediately terminates the script, it does not have a return value.
|
||||
|
||||
The following example will execute the script 'foo.script' with 10 threads and the arguments 'foodnstuff' and 90::
|
||||
|
||||
spawn('foo.script', 10, 'foodnstuff', 90);
|
8
doc/source/netscript/basicfunctions/sprintf.rst
Normal file
8
doc/source/netscript/basicfunctions/sprintf.rst
Normal file
@ -0,0 +1,8 @@
|
||||
sprintf() Netscript Function
|
||||
============================
|
||||
|
||||
.. js:function:: sprintf()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
See `this link <https://github.com/alexei/sprintf.js>`_ for details.
|
13
doc/source/netscript/basicfunctions/sqlinject.rst
Normal file
13
doc/source/netscript/basicfunctions/sqlinject.rst
Normal file
@ -0,0 +1,13 @@
|
||||
sqlinject() Netscript Function
|
||||
==============================
|
||||
|
||||
.. js:function:: sqlinject(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer.
|
||||
|
||||
Example::
|
||||
|
||||
sqlinject("foodnstuff");
|
9
doc/source/netscript/basicfunctions/tprint.rst
Normal file
9
doc/source/netscript/basicfunctions/tprint.rst
Normal file
@ -0,0 +1,9 @@
|
||||
tprint() Netscript Function
|
||||
===========================
|
||||
|
||||
.. js:function:: tprint(x)
|
||||
|
||||
:param x: Value to be printed
|
||||
:RAM cost: 0 GB
|
||||
|
||||
Prints a value or a variable to the Terminal
|
12
doc/source/netscript/basicfunctions/tryWrite.rst
Normal file
12
doc/source/netscript/basicfunctions/tryWrite.rst
Normal file
@ -0,0 +1,12 @@
|
||||
tryWrite() Netscript Function
|
||||
=============================
|
||||
|
||||
.. js:function:: tryWrite(port, data="")
|
||||
|
||||
: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, and false otherwise
|
||||
:RAM cost: 1 GB
|
||||
|
||||
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
|
8
doc/source/netscript/basicfunctions/vsprintf.rst
Normal file
8
doc/source/netscript/basicfunctions/vsprintf.rst
Normal file
@ -0,0 +1,8 @@
|
||||
vsprintf() Netscript Function
|
||||
=============================
|
||||
|
||||
.. js:function:: vsprintf()
|
||||
|
||||
:RAM cost: 0 GB
|
||||
|
||||
See `this link <https://github.com/alexei/sprintf.js>`_ for details.
|
20
doc/source/netscript/basicfunctions/weaken.rst
Normal file
20
doc/source/netscript/basicfunctions/weaken.rst
Normal file
@ -0,0 +1,20 @@
|
||||
weaken() Netscript Function
|
||||
===========================
|
||||
|
||||
.. js:function:: weaken(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server to weaken
|
||||
:returns: The amount by which the target server's security level was decreased. This is equivalent to 0.05 multiplied
|
||||
by the number of script threads
|
||||
:RAM cost: 0.15 GB
|
||||
|
||||
Use your hacking skills to attack a server's security, lowering the server's security level. The runtime for this command
|
||||
depends on your hacking level and the target server's security level. This function lowers the security level of the target
|
||||
server by 0.05.
|
||||
|
||||
Like hack() and grow(), weaken() can be called on any server, regardless of where the script is running. This command requires
|
||||
root access to the target server, but there is no required hacking level to run the command.
|
||||
|
||||
Example::
|
||||
|
||||
weaken("foodnstuff");
|
31
doc/source/netscript/basicfunctions/wget.rst
Normal file
31
doc/source/netscript/basicfunctions/wget.rst
Normal file
@ -0,0 +1,31 @@
|
||||
wget() Netscript Function
|
||||
=========================
|
||||
|
||||
.. js:function:: wget(url, target[, hostname/ip=current ip])
|
||||
|
||||
: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/ip of server for target file.
|
||||
:RAM cost: 0 GB
|
||||
|
||||
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 :code:`wget` in :ref:`netscriptjs`.
|
||||
|
||||
In NetscriptJS, you must preface any call to
|
||||
:code:`wget` with the :code:`await` keyword (like you would :code:`hack` or :code:`sleep`).
|
||||
|
||||
:code:`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 :code:`wget` in
|
||||
Netscript 1.0.
|
20
doc/source/netscript/basicfunctions/write.rst
Normal file
20
doc/source/netscript/basicfunctions/write.rst
Normal file
@ -0,0 +1,20 @@
|
||||
write() Netscript Function
|
||||
===========================
|
||||
|
||||
.. js:function:: write(port/fn, data="", mode="a")
|
||||
|
||||
:param string/number port/fn: 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.
|
||||
:RAM cost: 1 GB
|
||||
|
||||
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.
|
11
doc/source/netscript/bladeburnerapi/getActionAutolevel.rst
Normal file
11
doc/source/netscript/bladeburnerapi/getActionAutolevel.rst
Normal file
@ -0,0 +1,11 @@
|
||||
getActionAutolevel() Netscript Function
|
||||
=======================================
|
||||
|
||||
.. js:function:: getActionAutolevel(type, name)
|
||||
|
||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||
:param string name: Name of action. Must be an exact match
|
||||
|
||||
Return a boolean indicating whether or not this action is currently set to autolevel.
|
||||
|
||||
Returns false if an invalid action is specified.
|
@ -0,0 +1,12 @@
|
||||
getActionCountRemaining() Netscript Function
|
||||
============================================
|
||||
|
||||
.. js:function:: getActionCountRemaining(type, name)
|
||||
|
||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||
:param string name: Name of action. Must be an exact match
|
||||
|
||||
Returns the remaining count of the specified action.
|
||||
|
||||
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.
|
@ -0,0 +1,11 @@
|
||||
getActionCurrentLevel() Netscript Function
|
||||
==========================================
|
||||
|
||||
.. js:function:: getActionCurrentLevel(type, name)
|
||||
|
||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||
:param string name: Name of action. Must be an exact match
|
||||
|
||||
Returns the current level of this action.
|
||||
|
||||
Returns -1 if an invalid action is specified.
|
@ -0,0 +1,11 @@
|
||||
getActionEstimatedSuccessChance() Netscript Function
|
||||
====================================================
|
||||
|
||||
.. js:function:: getActionEstimatedSuccessChance(type, name)
|
||||
|
||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||
:param string name: Name of action. Must be an exact match
|
||||
|
||||
Returns the estimated success chance for the specified action. This chance
|
||||
is returned as a decimal value, NOT a percentage (e.g. if you have an estimated
|
||||
success chance of 80%, then this function will return 0.80, NOT 80).
|
11
doc/source/netscript/bladeburnerapi/getActionMaxLevel.rst
Normal file
11
doc/source/netscript/bladeburnerapi/getActionMaxLevel.rst
Normal file
@ -0,0 +1,11 @@
|
||||
getActionMaxLevel() Netscript Function
|
||||
======================================
|
||||
|
||||
.. js:function:: getActionMaxLevel(type, name)
|
||||
|
||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||
:param string name: Name of action. Must be an exact match
|
||||
|
||||
Returns the maximum level for this action.
|
||||
|
||||
Returns -1 if an invalid action is specified.
|
12
doc/source/netscript/bladeburnerapi/getActionRepGain.rst
Normal file
12
doc/source/netscript/bladeburnerapi/getActionRepGain.rst
Normal file
@ -0,0 +1,12 @@
|
||||
getActionRepGain() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: getActionRepGain(type, name[, level=current level])
|
||||
|
||||
: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 the 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.
|
9
doc/source/netscript/bladeburnerapi/getActionTime.rst
Normal file
9
doc/source/netscript/bladeburnerapi/getActionTime.rst
Normal file
@ -0,0 +1,9 @@
|
||||
getActionTime() Netscript Function
|
||||
==================================
|
||||
|
||||
.. js:function:: getActionTime(type, name)
|
||||
|
||||
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||
:param string name: Name of action. Must be an exact match
|
||||
|
||||
Returns the number of seconds it takes to complete the specified action
|
6
doc/source/netscript/bladeburnerapi/getBlackOpNames.rst
Normal file
6
doc/source/netscript/bladeburnerapi/getBlackOpNames.rst
Normal file
@ -0,0 +1,6 @@
|
||||
getBlackOpNames() Netscript Function
|
||||
====================================
|
||||
|
||||
.. js:function:: getBlackOpNames()
|
||||
|
||||
Returns an array of strings containing the names of all Bladeburner Black Ops
|
14
doc/source/netscript/bladeburnerapi/getBonusTime.rst
Normal file
14
doc/source/netscript/bladeburnerapi/getBonusTime.rst
Normal file
@ -0,0 +1,14 @@
|
||||
getBonusTime() Netscript Function
|
||||
=================================
|
||||
|
||||
.. js:function:: getBonusTime()
|
||||
|
||||
Returns the 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.
|
6
doc/source/netscript/bladeburnerapi/getCity.rst
Normal file
6
doc/source/netscript/bladeburnerapi/getCity.rst
Normal file
@ -0,0 +1,6 @@
|
||||
getCity() Netscript Function
|
||||
============================
|
||||
|
||||
.. js:function:: getCity()
|
||||
|
||||
Returns the city that the player is currently in (for Bladeburner).
|
8
doc/source/netscript/bladeburnerapi/getCityChaos.rst
Normal file
8
doc/source/netscript/bladeburnerapi/getCityChaos.rst
Normal file
@ -0,0 +1,8 @@
|
||||
getCityChaos() Netscript Function
|
||||
=================================
|
||||
|
||||
.. js:function:: getCityChaos(cityName)
|
||||
|
||||
:param string cityName: Name of city. Case-sensitive
|
||||
|
||||
Returns the chaos in the specified city, or -1 if an invalid city was specified
|
@ -0,0 +1,9 @@
|
||||
getCityEstimatedCommunities() Netscript Function
|
||||
================================================
|
||||
|
||||
.. js:function:: getCityEstimatedCommunities(cityName)
|
||||
|
||||
:param string cityName: Name of city. Case-sensitive
|
||||
|
||||
Returns the estimated number of Synthoid communities in the specified city,
|
||||
or -1 if an invalid city was specified.
|
@ -0,0 +1,9 @@
|
||||
getCityEstimatedPopulation() Netscript Function
|
||||
===============================================
|
||||
|
||||
.. js:function:: getCityEstimatedPopulation(cityName)
|
||||
|
||||
:param string cityName: Name of city. Case-sensitive
|
||||
|
||||
Returns the estimated number of Synthoids in the specified city, or -1
|
||||
if an invalid city was specified.
|
6
doc/source/netscript/bladeburnerapi/getContractNames.rst
Normal file
6
doc/source/netscript/bladeburnerapi/getContractNames.rst
Normal file
@ -0,0 +1,6 @@
|
||||
getContractNames() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: getContractNames()
|
||||
|
||||
Returns an array of strings containing the names of all Bladeburner contracts
|
14
doc/source/netscript/bladeburnerapi/getCurrentAction.rst
Normal file
14
doc/source/netscript/bladeburnerapi/getCurrentAction.rst
Normal file
@ -0,0 +1,14 @@
|
||||
getCurrentAction() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: getCurrentAction()
|
||||
|
||||
Returns an object that represents the player's current Bladeburner action::
|
||||
|
||||
{
|
||||
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".
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user