mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 00:04:22 +02:00
DOCUMENTATION: Better npm run doc, plus minor folder reorganization (#693)
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# Augmentations
|
||||
|
||||
Advances in science and medicine have led to powerful new technologies that allow people to augment themselves beyond normal human capabilities.
|
||||
There are many different types of Augmentations, ranging from cybernetic to genetic to biological.
|
||||
Acquiring these Augmentations enhances the user's physical and mental faculties.
|
||||
|
||||
Augmentations provide persistent upgrades in the form of multipliers.
|
||||
These multipliers apply to a wide variety of things such as stats, experience gain, and [hacking](hacking.md), just to name a few.
|
||||
The effects of Augmentations stack multiplicatively.
|
||||
Your multipliers can be viewed in the `Character` pages.
|
||||
|
||||
## How to acquire Augmentations
|
||||
|
||||
Because of how powerful Augmentations are, the technology behind them is kept private and secret by the corporations and organizations that create them.
|
||||
Therefore, the only way for the player to obtain Augmentations is through [Factions](factions.md).
|
||||
After joining a [Faction](factions.md) and earning enough [Reputation](reputation.md) in it, you will be able to purchase its Augmentations.
|
||||
Different [Factions](factions.md) offer different Augmentations.
|
||||
Augmentations must be purchased in order to be installed, and they are fairly expensive.
|
||||
They also require [Reputation](reputation.md) with a [Faction](factions.md) before they will let you purchase their Augmentations.
|
||||
|
||||
## Installing Augmentations
|
||||
|
||||
You will not gain the benefits of your purchased Augmentations until you install them.
|
||||
You can choose to install Augmentations through the `Augmentations` menu tab, found under `Character`.
|
||||
|
||||
Unfortunately, installing Augmentations has side effects.
|
||||
You will lose most of the progress you've made, including your skills, stats, and money.
|
||||
You will have to start over, but you will have all of the Augmentations you have installed to help you progress.
|
||||
This is the game's "soft reset" or "prestige" mechanic.
|
||||
|
||||
To summarize, here is a list of everything you will **LOSE** when you install an Augmentation:
|
||||
|
||||
- Stats/Skills
|
||||
- Money
|
||||
- [Scripts](scripts.md) on all [servers](servers.md) EXCEPT your home computer
|
||||
- Purchased [servers](servers.md)
|
||||
- [Hacknet Nodes](hacknet_nodes.md)
|
||||
- [Company](companies.md) / [Faction](factions.md) [Reputation](reputation.md), but you gain [Favor](reputation.md).
|
||||
- Jobs and [Faction](factions.md) memberships
|
||||
- Programs
|
||||
- [Stocks](stockmarket.md)
|
||||
- TOR router
|
||||
|
||||
Here is everything you will **KEEP** when you install an Augmentation:
|
||||
|
||||
- Every Augmentation you have previously installed
|
||||
- [Scripts](scripts.md) on your home computer
|
||||
- [RAM](ram.md) / Core Upgrades on your home computer
|
||||
- [World Stock Exchange account](stockmarket.md) and [TIX API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.tix.md) Access
|
||||
|
||||
## Purchasing Multiple Augmentations
|
||||
|
||||
You do not have to install an Augmentation right after you purchase it.
|
||||
You can purchase as many Augmentations as you'd like before you choose to install them.
|
||||
When you install your purchased Augmentations they will **ALL** get installed at once.
|
||||
|
||||
There are a few drawbacks to this, however.
|
||||
First, obviously, you won't gain the benefits of your purchased Augmentations until after you install them.
|
||||
Second, purchasing multiple Augmentations before installing them will cause the Augmentations to get progressively more expensive.
|
||||
When you purchase an Augmentation, the price of purchasing another Augmentation doubles.
|
||||
This multiplier stacks for each Augmentation you purchase.
|
||||
Once you install your purchased Augmentations, their costs are reset back to the original prices.
|
||||
You can only purchase each augmentation once, with the exception of `NeuroFlux Governor`, which can be purchased infinitely at increasing cost.
|
||||
@@ -0,0 +1,71 @@
|
||||
# Coding Contracts
|
||||
|
||||
Coding Contracts are a mechanic that lets players earn rewards in exchange for solving programming problems.
|
||||
|
||||
Coding Contracts are files with the `.cct` extension.
|
||||
They can be accessed through the [Terminal](terminal.md) or through [Scripts](scripts.md) using the [Coding Contract API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.codingcontract.md).
|
||||
|
||||
Each contract has a limited number of attempts.
|
||||
If you provide the wrong answer too many times and exceed the number of attempts, the contract will self destruct (delete itself).
|
||||
|
||||
Currently, Coding Contracts are randomly generated and spawned over time.
|
||||
They can appear on any [server](servers.md) (including your home computer), except for your purchased [servers](servers.md).
|
||||
|
||||
## Running in Terminal
|
||||
|
||||
To run a Coding Contract in the [Terminal](terminal.md), simply use the `run` command:
|
||||
|
||||
$ run some-contract.cct
|
||||
|
||||
Doing this will bring up a popup.
|
||||
The popup will display the contract's problem, the number of attempts remaining, and an area to provide an answer.
|
||||
|
||||
## Interacting through Scripts
|
||||
|
||||
See the [Coding Contract API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.codingcontract.md).
|
||||
Interacting with Coding Contracts via the [Terminal](terminal.md) can be tedious the more contracts you solve.
|
||||
Consider using the [API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.codingcontract.md) to automate various aspects of your solution.
|
||||
For example, some contracts have long solutions while others have even longer solutions.
|
||||
You might want to use the [API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.codingcontract.md) to automate the process of submitting your solution rather than copy and paste a long solution into an answer box.
|
||||
|
||||
However, using the [API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.codingcontract.md) comes at a cost.
|
||||
Like most functions in other APIs, each function in the [Coding Contract API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.codingcontract.md) has a RAM cost.
|
||||
Depending on which function you use, the initial [RAM](ram.md) on your home server might not be enough to allow you to use various [API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.codingcontract.md) functions.
|
||||
Plan on upgrading the [RAM](ram.md) on your home server if you want to use the [Coding Contract API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.codingcontract.md).
|
||||
|
||||
## Submitting Solutions
|
||||
|
||||
Different contract problem types will require different types of solutions.
|
||||
Some may be numbers, others may be strings or arrays.
|
||||
If a contract asks for a specific solution format, then use that.
|
||||
Otherwise, follow these rules when submitting solutions:
|
||||
|
||||
- String-type solutions should **not** have quotation marks surrounding the string (unless specifically asked for).
|
||||
Only quotation marks that are part of the actual string solution should be included.
|
||||
- Array-type solutions should be submitted with each element in the array separated by commas.
|
||||
Brackets are optional.
|
||||
For example, both of the following are valid solution formats:
|
||||
- `1,2,3`
|
||||
- `[1,2,3]`
|
||||
- If the solution is a multidimensional array, then all arrays that are not the outer-most array DO require the brackets.
|
||||
For example, an array of arrays can be submitted as one of the following:
|
||||
- `[1,2],[3,4]`
|
||||
- `[[1,2],[3,4]]`
|
||||
|
||||
Numeric solutions should be submitted normally, as expected
|
||||
|
||||
## Rewards
|
||||
|
||||
There are currently four possible rewards for solving a Coding Contract:
|
||||
|
||||
- [Faction](factions.md) [Reputation](reputation.md) for a specific [Faction](factions.md)
|
||||
- [Faction](factions.md) [Reputation](reputation.md) for all [Factions](factions.md) that you are a member of
|
||||
- [Company](companies.md) [Reputation](reputation.md) for a specific [Company](companies.md)
|
||||
- Money
|
||||
|
||||
The `amount` of the reward varies based on the difficulty of the problem posed by the Coding Contract.
|
||||
There is no way to know what a Coding Contract's exact reward will be until it is solved.
|
||||
|
||||
## Notes
|
||||
|
||||
- The `scp` [Terminal](terminal.md) command does not work on Coding Contracts
|
||||
@@ -0,0 +1,14 @@
|
||||
# Companies
|
||||
|
||||
When exploring the [World](world.md), you can visit various companies.
|
||||
At these companies, you can apply for jobs.
|
||||
|
||||
Working a job lets you earn money, experience, and [Reputation](reputation.md) with that company.
|
||||
|
||||
While working for a company, you can click `Do something else simultaneously` to be able to do things while you continue to work in the background.
|
||||
There is a 20% penalty to the related gains.
|
||||
Clicking the `Focus` button under the overview will return you to the current work.
|
||||
|
||||
If you've been hired to do a job you can click that `Apply for X Job` button again to get a promotion if you meet the requirements.
|
||||
You can see the requirements by hovering your cursor over the button.
|
||||
Higher positions give increased rewards.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Crimes
|
||||
|
||||
Committing crimes is an active gameplay mechanic that allows the player to train their [Stats](stats.md) and potentially earn money.
|
||||
The player can attempt to commit crimes by visiting `The Slums` through the `City` tab (Alt + w).
|
||||
`The Slums` is available in every city.
|
||||
|
||||
## Basic Mechanics
|
||||
|
||||
When you visit `The Slums` you will see a list of buttons that show all of the available crimes.
|
||||
Simply select one of the options to begin attempting that crime.
|
||||
Attempting to commit a crime takes a certain amount of time.
|
||||
This time varies between crimes.
|
||||
|
||||
While doing crimes, you can click `Do something else simultaneously` to be able to do things while you continue to do crimes in the background.
|
||||
There is a 20% penalty to the related gains.
|
||||
Clicking the `Focus` button under the overview will return you to the current task.
|
||||
|
||||
Crimes are not always successful.
|
||||
Your rate of success is determined by your [Stats](stats.md) and [Augmentations](augmentations.md).
|
||||
The odds can be seen on the crime-selection page.
|
||||
If you are unsuccessful at committing a crime you will gain EXP, but you will not earn money.
|
||||
If you are successful at committing the crime you will gain extra EXP (4x of what an unsuccessful attempt would give) and earn money.
|
||||
|
||||
Harder crimes are typically more profitable, and also give more EXP.
|
||||
@@ -0,0 +1,20 @@
|
||||
# Factions
|
||||
|
||||
Throughout the game you may receive invitations from factions.
|
||||
There are many different factions, and each faction has different criteria for determining its potential members.
|
||||
Joining a faction and furthering its cause is crucial to progressing in the game and unlocking endgame content.
|
||||
|
||||
It is possible to join multiple factions if you receive invitations from them.
|
||||
However, note that joining a faction may prevent you from joining other rival factions.
|
||||
(Don't worry, this usually isn't the case.
|
||||
Also, it would only be temporary since resetting the game by installing [Augmentations](augmentations.md) will clear all your factions)
|
||||
|
||||
The `Factions` link on the menu brings up a list of all factions that you have joined.
|
||||
You can select a Faction on this list to go to that Faction page.
|
||||
This page displays general information about the Faction and also lets you perform work for the faction.
|
||||
Working for a Faction is similar to working for a [Company](companies.md) except that you don't get paid a salary.
|
||||
You will only earn [Reputation](reputation.md) in your Faction and train your [Stats](stats.md).
|
||||
|
||||
Earning [Reputation](reputation.md) for a Faction unlocks powerful [Augmentations](augmentations.md).
|
||||
Purchasing and installing these [Augmentations](augmentations.md) will upgrade your abilities.
|
||||
The [Augmentations](augmentations.md) that are available to unlock vary from Faction to Faction.
|
||||
@@ -0,0 +1,83 @@
|
||||
# Hacking
|
||||
|
||||
In the year 2077, currency has become digital and decentralized.
|
||||
People and corporations store their money on [servers](servers.md).
|
||||
By hacking these [servers](servers.md), you can steal their money and gain experience.
|
||||
|
||||
## Gaining Root Access
|
||||
|
||||
The first step to hacking a [server](servers.md) is to gain root access to that [server](servers.md).
|
||||
This can be done using the `NUKE.exe` virus.
|
||||
You start the game with a copy of the `NUKE.exe` virus on your home computer.
|
||||
The `NUKE.exe` virus attacks the target [server](servers.md)'s open ports using buffer overflow exploits.
|
||||
When successful, you are granted root administrative access to the machine.
|
||||
|
||||
In order for the `NUKE.exe` virus to succeed, the target [server](servers.md) needs to have enough open ports.
|
||||
Some [servers](servers.md) have no security and will not need any ports opened.
|
||||
Some will have very high security and will need many ports opened.
|
||||
In order to open ports on another [server](servers.md), you will need to run programs that attack the [server](servers.md) to open specific ports.
|
||||
These programs can be coded once your hacking skill gets high enough, or they can be purchased if you can find a seller.
|
||||
|
||||
**There are two ways to execute port-opening programs and the NUKE virus:**
|
||||
|
||||
- Connect to the target [server](servers.md) through the [Terminal](terminal.md) and use the `run` command: `$ run [programName]`
|
||||
- Use a function:
|
||||
- `nuke`
|
||||
- `brutessh`
|
||||
- `ftpcrack`
|
||||
- `relaysmtp`
|
||||
- `httpworm`
|
||||
- `sqlinject`
|
||||
|
||||
**There are two ways to determine how many ports need to be opened
|
||||
on a [server](servers.md) in order to successfully NUKE it:**
|
||||
|
||||
- Connect to that [server](servers.md) through the [Terminal](terminal.md) and use the `analyze` command.
|
||||
- Use the `getServerNumPortsRequired` function.
|
||||
|
||||
Once you have enough ports opened on a [server](servers.md) and have ran the NUKE virus to gain root access, you will be able to hack it.
|
||||
|
||||
## General Hacking Mechanics
|
||||
|
||||
When you execute the `hack` command, either manually through the [Terminal](terminal.md) or automatically through a script, you attempt to hack the [server](servers.md).
|
||||
This action takes time.
|
||||
The more advanced a [server](servers.md)'s security is, the more time it will take.
|
||||
Your hacking skill level also affects the hacking time, with a higher hacking skill leading to shorter hacking times.
|
||||
Also, running the hack command manually through [Terminal](terminal.md)
|
||||
is faster than hacking from a script.
|
||||
|
||||
Your attempt to hack a [server](servers.md) will not always succeed.
|
||||
The chance you have to successfully hack a [server](servers.md) is also determined by the [server](servers.md)'s security and your hacking skill level.
|
||||
Even if your hacking attempt is unsuccessful, you will still gain experience points.
|
||||
|
||||
When you successfully hack a [server](servers.md).
|
||||
You steal a certain percentage of that [server](servers.md)'s total money.
|
||||
This percentage is, once again, determined by the [server](servers.md)'s security and your hacking skill level.
|
||||
The amount of money on a [server](servers.md) is not limitless.
|
||||
So, if you constantly hack a [server](servers.md) and deplete its money, then you will encounter diminishing returns in your hacking (since you are only hacking a certain percentage).
|
||||
You can increase the amount of money on a [server](servers.md) using a script and the `grow` function.
|
||||
|
||||
## Server Security
|
||||
|
||||
Each [server](servers.md) has a security level, typically between `1` and `100`.
|
||||
A higher number means the [server](servers.md) has stronger security.
|
||||
|
||||
As mentioned above, a [server](servers.md)'s security level is an important factor to consider when hacking.
|
||||
You can check a [server](servers.md)'s security level using the `analyze` [Terminal](terminal.md) command.
|
||||
You can also check a [server](servers.md)'s security in a script, using the `getServerSecurityLevel` function.
|
||||
|
||||
Whenever a [server](servers.md) is hacked manually or through a script, its security level increases by a small amount.
|
||||
Calling the `grow` function in a script will also increase security level of the target [server](servers.md).
|
||||
These actions will make it harder for you to hack the [server](servers.md), and decrease the amount of money you can steal.
|
||||
You can lower a [server](servers.md)'s security level in a script using the `weaken` function.
|
||||
|
||||
This means that a [server](servers.md)'s security level will not fall below this value if you are trying to `weaken` it.
|
||||
|
||||
## Backdoors
|
||||
|
||||
[Servers](servers.md) that can be hacked can also have backdoors installed.
|
||||
These backdoors will provide you with a benefit - the services may be cheaper, penalties may be reduced or there may be other results.
|
||||
Honeypots exist and will let factions know when you have succeeded at backdooring their system.
|
||||
Once you have a backdoor installed, you can connect to that [server](servers.md) directly.
|
||||
|
||||
When you visit a location in the city and see that the name is partially scrambled, this indicates that you have backdoored the [server](servers.md) related to the location.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Hacknet nodes
|
||||
|
||||
This distributed network of computers allows you to gain money passively.
|
||||
By upgrading a node's stats you can increase the amount of money it earns.
|
||||
If the cost gets too high, it is also possile to purchase brand new nodes.
|
||||
|
||||
Hacknet nodes won't make as much money as scripts, but they can be useful at the start.
|
||||
|
||||
There is a very powerful upgrade to them called [Hacknet Servers](../advanced/hacknetservers.md)
|
||||
@@ -0,0 +1,66 @@
|
||||
# Infiltration
|
||||
|
||||
Infiltration is a gameplay mechanic that allows you to infiltrate a [Company](companies.md)'s facility to try and steal the [Company](companies.md)'s classified secrets.
|
||||
These secrets can be sold for money or for [Reputation](reputation.md) with a [Faction](factions.md).
|
||||
|
||||
## Overview
|
||||
|
||||
Many companies have facilities that you can attempt to infiltrate.
|
||||
By infiltrating, you can steal classified [Company](companies.md) secrets and then sell these for money or for [Faction](factions.md) [Reputation](reputation.md).
|
||||
To try and infiltrate a [Company](companies.md), visit a [Company](companies.md) through the [World](world.md) menu.
|
||||
There will be an option that says 'Infiltrate [Company](companies.md)'.
|
||||
|
||||
When infiltrating a [Company](companies.md), you will be presented with short active challenges.
|
||||
None of the challenges use the mouse.
|
||||
|
||||
The difficulty at the top lowers with better combat stats and charisma.
|
||||
It is not recommended to attempt infiltrations above mid-normal.
|
||||
|
||||
The `maximum level` is the number of challenges you will need to pass to receive the infiltration reward.
|
||||
|
||||
Every time you fail an infiltration challenge, you will take damage based on the difficulty of the infiltration.
|
||||
If you are reduced to `0` hp or below, the infiltration will immediately end.
|
||||
|
||||
- Most use spacebar as `action`
|
||||
- Some use WASD or arrows interchangeably.
|
||||
- A few others use the rest of the keyboard.
|
||||
|
||||
### Slash when his guard is down!
|
||||
|
||||
Press space when the guard is preparing to attack you.
|
||||
|
||||
There are 3 phases:
|
||||
|
||||
1. guarding - attacking back will result in failure.
|
||||
2. preparing - attacking will result in a victory.
|
||||
3. attacking - the guard will attack you resulting in failure.
|
||||
|
||||
### Close the brackets
|
||||
|
||||
Enter all the matching brackets in reverse order.
|
||||
|
||||
### Type it backward
|
||||
|
||||
Type the words that are written backward.
|
||||
|
||||
### Say something nice about the guard.
|
||||
|
||||
Use the arrows to find a compliment for the guard.
|
||||
|
||||
### Enter the Code!
|
||||
|
||||
Match the arrows as they appear.
|
||||
|
||||
### Match the symbols!
|
||||
|
||||
Move the cursor to the matching symbol and press space to confirm.
|
||||
|
||||
### Remember all the mines!
|
||||
|
||||
At first, the cursor cannot be moved - remember the positions of the mines.
|
||||
Next, move the cursor and press space to mark the mines on the board.
|
||||
|
||||
### Cut the wires
|
||||
|
||||
Follow the instructions and press the numbers `1` through `9` to cut the appropriate
|
||||
wires.
|
||||
@@ -0,0 +1,8 @@
|
||||
# RAM
|
||||
|
||||
In Bitburner, RAM determines how many [Scripts](scripts.md) can run on a [Server](servers.md).
|
||||
|
||||
Multiplying the number of threads a [Script](scripts.md) uses multiplies its RAM cost, but also multiplies the effectiveness of several functions such as `ns.hack()`, `ns.grow()`, and `ns.weaken()`.
|
||||
|
||||
You can purchase more RAM for your home computer from tech vendors.
|
||||
You can also use other computers as source of additional RAM.
|
||||
@@ -0,0 +1,14 @@
|
||||
# Reputation
|
||||
|
||||
In order to acquire [Augmentations](augmentations.md) from [Factions](factions.md), you need to earn their trust.
|
||||
|
||||
This can be done in a variety of ways, but the most common is offering your services to a [Faction](faction.md).
|
||||
Another option is to give them intel from [Infiltrations](infiltration.md).
|
||||
|
||||
When installing [Augmentations](augmentations.md), all your reputation gets converted to favor.
|
||||
Favor increases the rate at which reputation is gained with that faction.
|
||||
|
||||
With enough favor, donations are unlocked.
|
||||
Donations allow you to spend money to acquire reputation directly.
|
||||
Without working for the faction.
|
||||
This feature is particularily useful when a very large amount of reputation is needed for an augmentation.
|
||||
@@ -0,0 +1,145 @@
|
||||
# Scripts
|
||||
|
||||
Scripts are programs that can be used to automate the hacking process and almost every other part of the game.
|
||||
Scripts must be written in JavaScript.
|
||||
|
||||
It is highly recommended that you have a basic background in programming to start writing scripts.
|
||||
You by no means need to be an expert.
|
||||
All you need is some familiarity with basic programming constructs like `for`/`while` loops, conditionals (`if`/`else`), `functions`, `variables`, etc.
|
||||
If you'd like to learn a little bit about programming, see [this page](../programming/learn.md).
|
||||
|
||||
## Script Arguments
|
||||
|
||||
When running a script, you can choose to pass arguments to that script.
|
||||
The script's logic can access and act on these arguments.
|
||||
This allows for flexibility in your scripts.
|
||||
|
||||
## Identifying a Script
|
||||
|
||||
Many commands and functions act on an executing script (i.e. a script that is running).
|
||||
Therefore, there must be a way to specify which script you want those commands & functions to act on.
|
||||
|
||||
The best way to identify a script is by its PID (Process IDentifier).
|
||||
This unique number is returned from `run`, `exec`, etc., and also shows in the output of `ps`.
|
||||
|
||||
A secondary way to identify scripts is by name **and** arguments.
|
||||
However (by default) you can run a multiple copies of a script with the same arguments, so this does not necessarily **uniquely** identify a script.
|
||||
In case of multiple matches, most functions will return an arbitrary one (typically the first one to be started).
|
||||
An exception is `kill`, which will kill all the matching scripts.
|
||||
|
||||
The arguments must be an **exact** match.
|
||||
This means that both the order and type of the arguments matter.
|
||||
|
||||
## Multithreading scripts
|
||||
|
||||
A script can be run with multiple threads.
|
||||
This is also called multithreading.
|
||||
The effect of multithreading is that every call to the `hack`, `grow`, and `weaken` functions will have their results multiplied by the number of threads.
|
||||
For example, if a normal single-threaded script is able to hack $10,000, then running the same script with 5 threads would yield $50,000.
|
||||
|
||||
(This is the **only** affect of running a script with multiple threads.
|
||||
Scripts will not actually become multithreaded in the real-world sense.)
|
||||
|
||||
When multithreading a script, the total [RAM](ram.md) cost can be calculated by simply multiplying the base [RAM](ram.md) cost of the script with the number of threads, where the base cost refers to the amount of [RAM](ram.md) required to run the script single-threaded.
|
||||
In the [terminal](terminal.md), you can run the `mem` [Terminal](terminal.md) command to see how much [RAM](ram.md) a script requires with `n` threads:
|
||||
|
||||
$ mem [scriptname] -t n
|
||||
|
||||
## Working with Scripts in Terminal
|
||||
|
||||
Running a script requires [RAM](ram.md).
|
||||
The more complex a script is, the more [RAM](ram.md) it requires to run.
|
||||
Scripts can be run on any [server](server.md) you have root access to.
|
||||
|
||||
Here are some [terminal](terminal.md) commands that are useful when working with scripts:
|
||||
|
||||
**check [script] [args...]**
|
||||
|
||||
Prints the logs of the script specified by the name and arguments to [Terminal](terminal.md).
|
||||
Arguments should be separated by a space.
|
||||
Remember that scripts are uniquely identified by their arguments as well as their name.
|
||||
For example, if you ran a script `foo.js` with the argument `foodnstuff` then in order to 'check' it you must also add the `foodnstuff` argument to the check command::
|
||||
|
||||
$ check foo.js foodnstuff
|
||||
|
||||
**free**
|
||||
|
||||
Shows the current server's [RAM](ram.md) usage and availability
|
||||
|
||||
**kill [pid]** or **kill [script] [args...]**
|
||||
|
||||
Stops a script that is running with the specified PID, or script name and arguments.
|
||||
Arguments should be separated by a space.
|
||||
Remember that scripts are identified by their arguments as well as their name.
|
||||
For example, if you ran a script `foo.js` with the argument 1 and 2, then just typing `kill foo.js` will not work.
|
||||
You have to use:
|
||||
|
||||
$ kill foo.js 1 2
|
||||
|
||||
**mem [script] [-t] [n]**
|
||||
|
||||
Check how much [RAM](ram.md) a script requires to run with n threads
|
||||
|
||||
**nano [script]**
|
||||
|
||||
Create/Edit a script.
|
||||
The name of the script must end with `.js`
|
||||
|
||||
**ps**
|
||||
|
||||
Displays all scripts that are actively running on the current [server](servers.md)
|
||||
|
||||
**rm [script]**
|
||||
|
||||
Delete a script from the [server](servers.md). This is permanent
|
||||
|
||||
**run [script] [-t] [n] [args...]**
|
||||
|
||||
Run a script with n threads and the specified arguments.
|
||||
Each argument should be separated by a space.
|
||||
Both the arguments and thread specification are optional.
|
||||
If neither are specified, then the script will be run single-threaded with no arguments.
|
||||
|
||||
Examples:
|
||||
|
||||
Run `foo.js` single-threaded with no arguments::
|
||||
|
||||
$ run foo.js
|
||||
|
||||
Run `foo.js` with 10 threads and no arguments:
|
||||
|
||||
$ run foo.js -t 10
|
||||
|
||||
Run `foo.js` single-threaded with three arguments: [foodnstuff, sigma-cosmetics, 10]:
|
||||
|
||||
$ run foo.js foodnstuff sigma-cosmetics 10
|
||||
|
||||
Run `foo.js` with 50 threads and a single argument: [foodnstuff]:
|
||||
|
||||
$ run foo.js -t 50 foodnstuff
|
||||
|
||||
**tail [pid]** or **tail [script] [args...]**
|
||||
|
||||
Displays the logs of the script specified by the PID or name and arguments.
|
||||
Note that scripts are identified by their arguments as well as their name.
|
||||
For example, if you ran a script `foo.js` with the argument `foodnstuff` then in order to `tail` it you must also add the `foodnstuff` argument to the tail command as so: `tail foo.js foodnstuff`
|
||||
|
||||
**top**
|
||||
|
||||
Displays all active scripts and their [RAM](ram.md) usage
|
||||
|
||||
## Notes about how Scripts work offline
|
||||
|
||||
The scripts that you write and execute are in JavaScript.
|
||||
For this reason, it is not possible for these scripts to run while offline (when the game is closed).
|
||||
It is important to note that for this reason, conditionals such as `if`/`else` statements and certain commands such as `purchaseHacknetNode()` or `nuke()` will not work while the game is offline.
|
||||
|
||||
However, Scripts WILL continue to generate money and hacking exp for you while the game is offline.
|
||||
This offline production is based off of the scripts' production while the game is online.
|
||||
|
||||
`grow()` and `weaken()` are two functions that will also be applied when the game is offline, although at a slower rate compared to if the game was open.
|
||||
This is done by having each script keep track of the rate at which the `grow()` and `weaken()` commands are called when the game is online.
|
||||
These calculated rates are used to determine how many times these function calls would be made while the game is offline.
|
||||
|
||||
Also, note that because of the way the JavaScript engine works, whenever you reload or re-open the game all of the scripts that you are running will start running from the BEGINNING of the code.
|
||||
The game does not keep track of where exactly the execution of a script is when it saves/loads.
|
||||
@@ -0,0 +1,58 @@
|
||||
# Servers
|
||||
|
||||
In this game, a server refers to a computer that can be connected to, accessed, and manipulated through the [Terminal](terminal.md).
|
||||
All servers in the game are connected to each other to form a large, global network.
|
||||
To learn about how to navigate this network and connect to other servers, see the [terminal](terminal.md) page.
|
||||
|
||||
## Server Statistics
|
||||
|
||||
Each server has its own statistics, such as [RAM](ram.md), required hacking level, and number of ports required to successfully `NUKE` it.
|
||||
|
||||
Perhaps the most important property of a server to make note of is its [RAM](ram.md), which refers to how much memory is available on that machine. [RAM](ram.md) is important because it is required to run [Scripts](scripts.md).
|
||||
More [RAM](ram.md) allows the user to run more powerful and complicated [scripts](scripts.md), as well as executing scripts with more threads.
|
||||
|
||||
The `free`, `scan-analyze`, and `analyze` [Terminal](terminal.md) commands can be used to check how much [RAM](ram.md) a server has.
|
||||
|
||||
Some servers have some randomized statistics, such as [RAM](ram.md), max Money, or required hacking level.
|
||||
These statistics are randomly generated from a range of values.
|
||||
|
||||
## Identifying Servers
|
||||
|
||||
A server is identified by its hostname.
|
||||
A hostname is a label assigned to a server.
|
||||
A hostname will usually give you a general idea of what the server is.
|
||||
For example, the company Nova Medical might have a server with the hostname `nova-med`.
|
||||
|
||||
Hostnames are unique.
|
||||
This means that if one server has the the hostname `some-server`, then no other server in the game can have that that hostname.
|
||||
|
||||
There are many `functions` and [terminal](terminal.md) commands in the game that will require you to target a specific server by hostname.
|
||||
|
||||
## Player-owned Servers
|
||||
|
||||
The player starts with a single server: his/her home computer.
|
||||
This server will have the hostname `home`.
|
||||
The player's home computer is special for a variety of reasons:
|
||||
|
||||
- The home computer's [RAM](ram.md) can be upgraded.
|
||||
This can be done by visiting certain locations in the [World](world.md).
|
||||
- The home computer persists through [Augmentation](augmentations.md) installations.
|
||||
This means that you will not lose any [RAM](ram.md) upgrades or [Scripts](scripts.md) on your home computer when you install [Augmentations](augmentations.md)
|
||||
(you will, however, lose programs and messages on your home computer).
|
||||
|
||||
The player can also purchase additional servers.
|
||||
This can be done by visiting certain locations in the [World](world.md), or it can be done automatically through a script using the `purchaseServer` function.
|
||||
The advantage of purchased servers is that, in terms of [RAM](ram.md), they are cheaper than upgrading your home computer.
|
||||
The disadvantage is that your purchased servers are lost when you install [Augmentations](augmentations.md).
|
||||
|
||||
## Hackable Servers
|
||||
|
||||
Most servers that are not owned by the player can be [hacked](hacking.md) for money and exp.
|
||||
|
||||
Different servers have different levels of security, but also offer different rewards when being hacked.
|
||||
|
||||
## Server Connections
|
||||
|
||||
The servers are in a randomly organized tree-structure.
|
||||
The distance from the home computer to each server is fixed, but the exact route to them is randomized when you install [augmentations](augmentations.md).
|
||||
In general, the further away from home computer a server is the higher its statistics are.
|
||||
@@ -0,0 +1,113 @@
|
||||
# Stats
|
||||
|
||||
The player has several stats that can be increased in order to progress in the game.
|
||||
|
||||
## Hacking
|
||||
|
||||
Represents the player's ability to code and hack.
|
||||
|
||||
Affects:
|
||||
|
||||
- Time it takes to hack a server
|
||||
- Time it takes to execute the `grow()` and `weaken()` function
|
||||
- Chance to successfully hack a server
|
||||
- Percent of money stolen when hacking a server
|
||||
- Success rate of certain [crimes](crimes.md)
|
||||
- Time it takes to create a program
|
||||
- [Faction](factions.md) [Reputation](reputation.md) gain when carrying out Hacking Contracts or Field Work
|
||||
- [Company](companies.md) [Reputation](reputation.md) gain for certain jobs
|
||||
|
||||
Gain experience by:
|
||||
|
||||
- Manually hacking servers through [Terminal](terminal.md)
|
||||
- Executing `hack()`, `grow()`, or `weaken()` through a script
|
||||
- Committing certain [crimes](crimes.md)
|
||||
- Carrying out Hacking Contracts or doing Field work for [Factions](factions.md)
|
||||
- Working certain jobs at a [Company](companies.md)
|
||||
- Studying at a university
|
||||
|
||||
## Strength
|
||||
|
||||
Represents the player's physical offensive power
|
||||
|
||||
Affects:
|
||||
|
||||
- Success rate of certain [crimes](crimes.md)
|
||||
- [Faction](factions.md) [Reputation](reputation.md) gain for Security and Field Work
|
||||
- [Company](companies.md) [Reputation](reputation.md) gain for certain jobs
|
||||
|
||||
Gain experience by:
|
||||
|
||||
- Committing certain [crimes](crimes.md)
|
||||
- Working out at a gym
|
||||
- Doing Security/Field Work for a [Faction](factions.md)
|
||||
- Working certain jobs at a [Company](companies.md)
|
||||
|
||||
## Defense
|
||||
|
||||
Represents the player's ability to withstand damage
|
||||
|
||||
Affects:
|
||||
|
||||
- Success rate of certain [crimes](crimes.md)
|
||||
- The player's HP
|
||||
- [Faction](factions.md) [Reputation](reputation.md) gain for Security and Field Work
|
||||
- [Company](companies.md) [Reputation](reputation.md) gain for certain jobs
|
||||
|
||||
Gain experience by:
|
||||
|
||||
- Committing certain [crimes](crimes.md)
|
||||
- Working out at a gym
|
||||
- Doing Security/Field Work for a [Faction](factions.md)
|
||||
- Working certain jobs at a [Company](companies.md)
|
||||
|
||||
## Dexterity
|
||||
|
||||
Represents the player's skill and adeptness in performing certain tasks
|
||||
|
||||
Affects:
|
||||
|
||||
- Success rate of certain [crimes](crimes.md)
|
||||
- [Faction](factions.md) [Reputation](reputation.md) gain for Security and Field Work
|
||||
- [Company](companies.md) [Reputation](reputation.md) gain for certain jobs
|
||||
|
||||
Gain experience by:
|
||||
|
||||
- Committing certain [crimes](crimes.md)
|
||||
- Working out at a gym
|
||||
- Doing Security/Field Work for a [Faction](factions.md)
|
||||
- Working certain jobs at a [Company](companies.md)
|
||||
|
||||
## Agility
|
||||
|
||||
Represents the player's speed and ability to move
|
||||
|
||||
Affects:
|
||||
|
||||
- Success rate of certain [crimes](crimes.md)
|
||||
- [Faction](factions.md) [Reputation](reputation.md) gain for Security and Field Work
|
||||
- [Company](companies.md) [Reputation](reputation.md) gain for certain jobs
|
||||
|
||||
Gain experience by:
|
||||
|
||||
- Committing certain [crimes](crimes.md)
|
||||
- Working out at a gym
|
||||
- Doing Security/Field Work for a [Faction](factions.md)
|
||||
- Working certain jobs at a [Company](companies.md)
|
||||
|
||||
## Charisma
|
||||
|
||||
Represents the player's social abilities
|
||||
|
||||
Affects:
|
||||
|
||||
- Success rate of certain [crimes](crimes.md)
|
||||
- [Faction](factions.md) [Reputation](reputation.md) gain for Field Work
|
||||
- [Company](companies.md) [Reputation](reputation.md) gain for most jobs
|
||||
|
||||
Gain experience by:
|
||||
|
||||
- Committing certain [crimes](crimes.md)
|
||||
- Studying at a university
|
||||
- Working a relevant job at a [Company](companies.md)
|
||||
- Doing Field work for a [Faction](factions.md)
|
||||
@@ -0,0 +1,172 @@
|
||||
# Stock Market
|
||||
|
||||
The Stock Market refers to the World Stock Exchange (WSE), through which you can buy and sell stocks in order to make money.
|
||||
|
||||
The WSE can be found in the `City` tab, and is accessible in every city.
|
||||
|
||||
## Fundamentals
|
||||
|
||||
The Stock Market is not as simple as "buy at price X and sell at price Y".
|
||||
The following are several fundamental concepts you need to understand about the stock market.
|
||||
|
||||
For those that have experience with finance/trading/investing, please be aware that the game's stock market does not function exactly like it does in the real world.
|
||||
So these concepts below should seem similar, but won't be exactly the same.
|
||||
|
||||
## Positions: Long vs Short
|
||||
|
||||
When making a transaction on the stock market, there are two types of positions: Long and Short.
|
||||
A Long position is the typical scenario where you buy a stock and earn a profit if the price of that stock increases.
|
||||
Meanwhile, a Short position is the exact opposite.
|
||||
In a Short position, you purchase shares of a stock and earn a profit if the price of that stock decreases.
|
||||
This is also called 'shorting' a stock.
|
||||
|
||||
Shorting stocks is not available immediately, and must be unlocked later in the game.
|
||||
|
||||
## Forecast & Second-Order Forecast
|
||||
|
||||
A stock's forecast is its likelihood of increasing or decreasing in value.
|
||||
The forecast is typically represented by its probability of increasing in either a decimal or percentage form.
|
||||
For example, a forecast of `70%` means the stock has a `70%` chance of increasing and a `30%` chance of decreasing.
|
||||
|
||||
A stock's second-order forecast is the target value that its forecast trends towards.
|
||||
For example, if a stock has a forecast of `60%` and a second-order forecast of `70%`, then the stock's forecast should slowly trend towards `70%` over time.
|
||||
However, this is determined by RNG so there is a chance that it may never reach `70%`.
|
||||
|
||||
Both the forecast and the second-order forecast change over time.
|
||||
|
||||
A stock's forecast can be viewed after purchasing Four Sigma (4S) Market Data access.
|
||||
This lets you see the forecast info on the Stock Market UI.
|
||||
If you also purchase access to the 4S Market Data TIX API, then you can view a stock's forecast using the `getStockForecast` function.
|
||||
|
||||
A stock's second-order forecast is always hidden.
|
||||
|
||||
## Spread (Bid Price & Ask Price)
|
||||
|
||||
The **bid price** is the maximum price at which someone will buy a stock on the stock market.
|
||||
|
||||
The **ask price** is the minimum price that a seller is willing to receive for a stock on the stock market
|
||||
|
||||
The ask price will always be higher than the bid price (This is because if a seller is willing to receive less than the bid price, that transaction is guaranteed to happen).
|
||||
The difference between the bid and ask price is known as the **spread**.
|
||||
A stock's "price" will be the average of the bid and ask price.
|
||||
|
||||
The bid and ask price are important because these are the prices at which a transaction actually occurs.
|
||||
If you purchase a stock in the long position, the cost of your purchase depends on that stock's ask price.
|
||||
If you then try to sell that stock (still in the long position), the price at which you sell is the stock's bid price.
|
||||
Note that this is reversed for a short position.
|
||||
Purchasing a stock in the short position will occur at the stock's bid price, and selling a stock in the short position will occur at the stock's ask price.
|
||||
|
||||
## Transactions Influencing Stock Forecast
|
||||
|
||||
Buying or selling a large number of shares of a stock will influence that stock's forecast & second-order forecast.
|
||||
The forecast is the likelihood that the stock will increase or decrease in price.
|
||||
The magnitude of this effect depends on the number of shares being transacted.
|
||||
More shares will have a bigger effect.
|
||||
|
||||
The effect that transactions have on a stock's second-order forecast is significantly smaller than the effect on its forecast.
|
||||
|
||||
## Order Types
|
||||
|
||||
There are three different types of orders you can make to buy or sell stocks on the exchange:
|
||||
Market Order, Limit Order, and Stop Order.
|
||||
|
||||
Limit Orders and Stop Orders are not available immediately, and must be unlocked later in the game.
|
||||
|
||||
When you place a Market Order to buy or sell a stock, the order executes immediately at whatever the current price of the stock is.
|
||||
For example if you choose to short a stock with 5000 shares using a Market Order, you immediately purchase those 5000 shares in a Short position at whatever the current market price is for that stock.
|
||||
|
||||
A Limit Order is an order that only executes under certain conditions.
|
||||
A Limit Order is used to buy or sell a stock at a specified price or better.
|
||||
For example, lets say you purchased a Long position of 100 shares of some stock at a price of $10 per share.
|
||||
You can place a Limit Order to sell those 100 shares at $50 or better.
|
||||
The Limit Order will execute when the price of the stock reaches a value of $50 or higher.
|
||||
|
||||
A Stop Order is the opposite of a Limit Order.
|
||||
It is used to buy or sell a stock at a specified price (before the price gets 'worse').
|
||||
For example, lets say you purchased a Short position of 100 shares of some stock at a price of $100 per share.
|
||||
The current price of the stock is $80 (a profit of $20 per share).
|
||||
You can place a Stop Order to sell the Short position if the stock's price reaches $90 or higher.
|
||||
This can be used to lock in your profits and limit any losses.
|
||||
|
||||
Here is a summary of how each order works and when they execute:
|
||||
|
||||
**In a LONG Position:**
|
||||
|
||||
A Limit Order to buy will execute if the stock's price <= order's price
|
||||
|
||||
A Limit Order to sell will execute if the stock's price >= order's price
|
||||
|
||||
A Stop Order to buy will execute if the stock's price >= order's price
|
||||
|
||||
A Stop Order to sell will execute if the stock's price <= order's price
|
||||
|
||||
**In a SHORT Position:**
|
||||
|
||||
A Limit Order to buy will execute if the stock's price >= order's price
|
||||
|
||||
A Limit Order to sell will execute if the stock's price <= order's price
|
||||
|
||||
A Stop Order to buy will execute if the stock's price <= order's price
|
||||
|
||||
A Stop Order to sell will execute if the stock's price >= order's price.
|
||||
|
||||
## Player Actions Influencing Stocks
|
||||
|
||||
It is possible for your actions elsewhere in the game to influence the stock market.
|
||||
|
||||
### Hacking
|
||||
|
||||
If a server has a corresponding stock (e.g. _foodnstuff_ server -> FoodNStuff stock), then hacking that server can decrease the stock's second-order forecast.
|
||||
This causes the corresponding stock's forecast to trend downwards in value over time.
|
||||
|
||||
This effect only occurs if you set the stock option to true when calling the `hack` function.
|
||||
The chance that hacking a server will cause this effect is based on what percentage of the server's total money you steal.
|
||||
|
||||
A single hack will have a minor effect, but continuously hacking a server for lots of money over time will have a noticeable effect in making the stock's forecast trend downwards.
|
||||
|
||||
### Growing
|
||||
|
||||
If a server has a corresponding stock (e.g. `foodnstuff` server -> FoodNStuff stock), then growing that server's money can increase the stock's second-order forecast.
|
||||
This causes the corresponding stock's forecast to trend upwards in value over time.
|
||||
|
||||
This effect only occurs if you set the `stock` option to true when calling the `grow` function.
|
||||
The chance that growing a server will cause this effect is based on what percentage of the server's total money to add to it.
|
||||
|
||||
A single grow operation will have a minor effect, but continuously growing a server for lots of money over time will have a noticeable effect in making the stock's forecast trend upwards.
|
||||
|
||||
### Working for a Company
|
||||
|
||||
If a [Company](companies.md) has a corresponding stock, then working for that [Company](companies.md) will increase the corresponding stock's second-order forecast.
|
||||
This will cause the stock's forecast to (slowly) trend upwards in value over time.
|
||||
|
||||
The potency of this effect is based on how effective you are when you work (i.e. it's based on your stats and multipliers).
|
||||
|
||||
## Automating the Stock Market
|
||||
|
||||
You can write scripts to perform automatic and algorithmic trading on the Stock Market.
|
||||
See [TIX API](https://github.com/bitburner-official/bitburner-src/blob/dev/markdown/bitburner.tix.md) for more details.
|
||||
|
||||
## Under the Hood
|
||||
|
||||
Stock prices are updated every ~6 seconds.
|
||||
|
||||
Whether a stock's price moves up or down is random.
|
||||
However, stocks have properties that can influence the way their price moves.
|
||||
These properties are hidden, although some of them can be made visible by purchasing the Four Sigma (4S) Market Data upgrade.
|
||||
Some examples of these properties are:
|
||||
|
||||
- Volatility
|
||||
- Likelihood of increasing or decreasing (i.e. the stock's forecast)
|
||||
- Likelihood of forecast increasing or decreasing (i.e. the stock's second-order forecast)
|
||||
- How easily a stock's price/forecast is influenced by transactions
|
||||
- Spread percentage
|
||||
- Maximum price (not a real maximum, more of a "soft cap")
|
||||
|
||||
Each stock has its own unique values for these properties.
|
||||
|
||||
## Offline Progression
|
||||
|
||||
The Stock Market does not change or process anything while the game has closed.
|
||||
However, it does accumulate time when offline.
|
||||
This accumulated time allows the stock market to run `50%` faster when the game is opened again.
|
||||
This means that stock prices will update every ~4 seconds instead of 6.
|
||||
@@ -0,0 +1,123 @@
|
||||
# Terminal
|
||||
|
||||
The Terminal is a console emulator program that lets you interface with all of the [Servers](servers.md) in the game.
|
||||
The Terminal can be accessed by clicking the `Terminal` tab on the navigation menu on the left-hand side of the game (you may need to expand the 'Hacking' header in order to see the `Terminal` tab).
|
||||
Alternatively, the shortcut Alt + t can be used to open the Terminal.
|
||||
|
||||
## Filesystem (Directories)
|
||||
|
||||
The Terminal contains a **very** basic filesystem that allows you to store and organize your files into different directories.
|
||||
Note that this is **not** a true filesystem implementation.
|
||||
Instead, it is done almost entirely using string manipulation.
|
||||
For this reason, many of the nice & useful features you'd find in a real filesystem do not exist.
|
||||
|
||||
Here are the Terminal commands you'll commonly use when dealing with the filesystem.
|
||||
|
||||
- `ls` (view all files in the current folder)
|
||||
- `cd` (change folder)
|
||||
- `mv` (rename a file)
|
||||
|
||||
## Directories
|
||||
|
||||
In order to create a directory, simply name a file using a full absolute Linux-style path:
|
||||
|
||||
/scripts/myScript.js
|
||||
|
||||
This will automatically create a "directory" called `scripts`.
|
||||
This will also work for subdirectories:
|
||||
|
||||
/scripts/hacking/helpers/myHelperScripts.js
|
||||
|
||||
Files in the root directory do not need to begin with a forward slash:
|
||||
|
||||
thisIsAFileInTheRootDirectory.txt
|
||||
|
||||
Note that there is no way to manually create or remove directories.
|
||||
The creation and deletion of directories is automatically handled as you name/rename/delete files.
|
||||
|
||||
## Absolute vs Relative Paths
|
||||
|
||||
Many Terminal commands accept both absolute and relative paths for specifying a file.
|
||||
|
||||
An absolute path specifies the location of the file from the root directory (/).
|
||||
Any path that begins with the forward slash is an absolute path:
|
||||
|
||||
$ nano /scripts/myScript.js
|
||||
$ cat /serverList.txt
|
||||
|
||||
A relative path specifies the location of the file relative to the current working directory.
|
||||
Any path that does **not** begin with a forward slash is a relative path.
|
||||
Note that the Linux-style dot symbols will work for relative paths:
|
||||
|
||||
. (a single dot) - represents the current directory
|
||||
.. (two dots) - represents the parent directory
|
||||
|
||||
$ cd ..
|
||||
$ nano ../scripts/myScript.js
|
||||
$ nano ../../helper.js
|
||||
|
||||
## Scripts
|
||||
|
||||
Note that in order to reference a file, `functions` require the **full** absolute file path.
|
||||
For example
|
||||
|
||||
ns.run("/scripts/hacking/helpers.myHelperScripts.js");
|
||||
ns.rm("/logs/myHackingLogs.txt");
|
||||
ns.rm("thisIsAFileInTheRootDirectory.txt");
|
||||
|
||||
A full file path **must** begin with a forward slash (/) if that file is not in the root directory.
|
||||
|
||||
## Missing Features
|
||||
|
||||
These features that are typically in Linux filesystems have not yet been added to the game:
|
||||
|
||||
- Tab autocompletion does not work with relative paths
|
||||
- `mv` only accepts full filepaths for the destination argument.
|
||||
It does not accept directories
|
||||
|
||||
## Argument Parsing
|
||||
|
||||
When evaluating a terminal command, arguments are initially parsed based on whitespace (usually spaces).
|
||||
Each whitespace character signifies the end of an argument, and potentially the start of new one.
|
||||
For most terminal commands, this is all you need to know.
|
||||
|
||||
When running scripts, however, it is important to know in more detail how arguments are parsed.
|
||||
There are two main points:
|
||||
|
||||
- Quotation marks can be used to wrap a single argument and force it to be parsed as a string.
|
||||
Any whitespace inside the quotation marks will not cause a new argument to be parsed.
|
||||
- Anything that can represent a number is automatically cast to a number, unless it's surrounded by quotation marks.
|
||||
|
||||
Here's an example to show how these rules work.
|
||||
Consider the following script `argType.js`:
|
||||
|
||||
export async function main(ns) {
|
||||
ns.tprint("Number of args: " + ns.args.length);
|
||||
for (var i = 0; i < ns.args.length; ++i) {
|
||||
ns.tprint(typeof ns.args[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Then if we run the following terminal command:
|
||||
|
||||
$ run argType.js 123 1e3 "5" "this is a single argument"
|
||||
|
||||
We'll see the following in the Terminal:
|
||||
|
||||
Running script with 1 thread(s), pid 1 and args: [123, 1000, "5", "this is a single argument"].
|
||||
argType.js: Number of args: 4
|
||||
argType.js: number
|
||||
argType.js: number
|
||||
argType.js: string
|
||||
argType.js: string
|
||||
|
||||
## Chaining Commands
|
||||
|
||||
You can run multiple Terminal commands at once by separating each command
|
||||
with a semicolon (;).
|
||||
|
||||
Example:
|
||||
|
||||
$ run foo.js; tail foo.js
|
||||
|
||||
This does **not** wait for commands with a delay to finish executing, so it generally doesn't work with things like `hack`, `wget`, etc.
|
||||
@@ -0,0 +1,13 @@
|
||||
# World
|
||||
|
||||
In Bitburner, the world consists of six different cities:
|
||||
|
||||
- Sector-12 (this is where you start out)
|
||||
- Aevum
|
||||
- Ishima
|
||||
- New Tokyo
|
||||
- Chongqing
|
||||
- Volhaven
|
||||
|
||||
Each city has its own map and [Factions](factions.md).
|
||||
Each city also offers different services such as gyms, universities, hardware stores, and places of work.
|
||||
Reference in New Issue
Block a user