mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 07:33:48 +01:00
work on making sure all the functions are accounted for
This commit is contained in:
parent
2578ea51c3
commit
c5fb5155f3
401
dist/bitburner.d.ts
vendored
401
dist/bitburner.d.ts
vendored
File diff suppressed because it is too large
Load Diff
BIN
electron/icon.icns
Normal file
BIN
electron/icon.icns
Normal file
Binary file not shown.
BIN
electron/icon.ico
Normal file
BIN
electron/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -5,7 +5,7 @@ function createWindow() {
|
|||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
show: false,
|
show: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
devTools: true,
|
// devTools: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ function createWindow() {
|
|||||||
win.maximize();
|
win.maximize();
|
||||||
win.loadFile("index.html");
|
win.loadFile("index.html");
|
||||||
win.show();
|
win.show();
|
||||||
win.webContents.openDevTools();
|
// win.webContents.openDevTools();
|
||||||
globalShortcut.register("f5", function () {
|
globalShortcut.register("f5", function () {
|
||||||
win.loadFile("index.html");
|
win.loadFile("index.html");
|
||||||
});
|
});
|
||||||
|
@ -3,5 +3,22 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "A cyberpunk-themed programming incremental game",
|
"description": "A cyberpunk-themed programming incremental game",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"author": "Daniel Xie"
|
"author": "Daniel Xie & Olivier Gagnon",
|
||||||
|
"mac": {
|
||||||
|
"icon": "./public/icons/mac/icon.icns",
|
||||||
|
"category": "public.app-category.games"
|
||||||
|
},
|
||||||
|
"win": {
|
||||||
|
"icon": "./public/icons/png/256x256.png"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"./build/**/*",
|
||||||
|
"./dist/**/*",
|
||||||
|
"./node_modules/**/*",
|
||||||
|
"./public/**/*",
|
||||||
|
"*.js"
|
||||||
|
],
|
||||||
|
"directories": {
|
||||||
|
"buildResources": "public"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ Data representing the internal values of an Augmentation.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface AugmentationStats
|
export interface AugmentationStats
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Return value of [getSleevePurchasableAugs](./bitburner.sleeve.getsleevepurchasab
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface AugmentPair
|
export interface AugmentPair
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Options to affect the behavior of [hack](./bitburner.ns.hack.md)<!-- -->, [grow]
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface BasicHGWOptions
|
export interface BasicHGWOptions
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ All multipliers affecting the difficulty of the current challenge.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface BitNodeMultipliers
|
export interface BitNodeMultipliers
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Bladeburner current action.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface BladeburnerCurAction
|
export interface BladeburnerCurAction
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface CharacterInfo
|
export interface CharacterInfo
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface CharacterMult
|
export interface CharacterMult
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Options to affect the behavior of [CodingContract](./bitburner.codingcontract.md
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface CodingAttemptOptions
|
export interface CodingAttemptOptions
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Coding Contact API
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface CodingContract
|
export interface CodingContract
|
||||||
```
|
```
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
@ -9,7 +9,7 @@ Data representing the internal values of a crime.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface CrimeStats
|
export interface CrimeStats
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Object representing data representing a gang member equipment.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface EquipmentStats
|
export interface EquipmentStats
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
32
markdown/bitburner.gang.creategang.md
Normal file
32
markdown/bitburner.gang.creategang.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [bitburner](./bitburner.md) > [Gang](./bitburner.gang.md) > [createGang](./bitburner.gang.creategang.md)
|
||||||
|
|
||||||
|
## Gang.createGang() method
|
||||||
|
|
||||||
|
Create a gang.
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
createGang(faction: string): boolean;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| faction | string | |
|
||||||
|
|
||||||
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
boolean
|
||||||
|
|
||||||
|
True if the gang was created, false otherwise.
|
||||||
|
|
||||||
|
## Remarks
|
||||||
|
|
||||||
|
RAM cost: 1GB
|
||||||
|
|
||||||
|
Create a gang with the specified faction.
|
||||||
|
|
23
markdown/bitburner.gang.ingang.md
Normal file
23
markdown/bitburner.gang.ingang.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [bitburner](./bitburner.md) > [Gang](./bitburner.gang.md) > [inGang](./bitburner.gang.ingang.md)
|
||||||
|
|
||||||
|
## Gang.inGang() method
|
||||||
|
|
||||||
|
Check if you're in a gang.
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
inGang(): boolean;
|
||||||
|
```
|
||||||
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
boolean
|
||||||
|
|
||||||
|
True if you're in a gang, false otherwise.
|
||||||
|
|
||||||
|
## Remarks
|
||||||
|
|
||||||
|
RAM cost: 1GB
|
||||||
|
|
@ -9,7 +9,7 @@ Gang API
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface Gang
|
export interface Gang
|
||||||
```
|
```
|
||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
@ -22,6 +22,7 @@ If you are not in BitNode-2, then you must have Source-File 2 in order to use th
|
|||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [ascendMember(memberName)](./bitburner.gang.ascendmember.md) | Ascend a gang member. |
|
| [ascendMember(memberName)](./bitburner.gang.ascendmember.md) | Ascend a gang member. |
|
||||||
| [canRecruitMember()](./bitburner.gang.canrecruitmember.md) | Check if you can recruit a new gang member. |
|
| [canRecruitMember()](./bitburner.gang.canrecruitmember.md) | Check if you can recruit a new gang member. |
|
||||||
|
| [createGang(faction)](./bitburner.gang.creategang.md) | Create a gang. |
|
||||||
| [getBonusTime()](./bitburner.gang.getbonustime.md) | Get bonus time. |
|
| [getBonusTime()](./bitburner.gang.getbonustime.md) | Get bonus time. |
|
||||||
| [getChanceToWinClash(gangName)](./bitburner.gang.getchancetowinclash.md) | Get chance to win clash with other gang. |
|
| [getChanceToWinClash(gangName)](./bitburner.gang.getchancetowinclash.md) | Get chance to win clash with other gang. |
|
||||||
| [getEquipmentCost(equipName)](./bitburner.gang.getequipmentcost.md) | Get cost of equipment. |
|
| [getEquipmentCost(equipName)](./bitburner.gang.getequipmentcost.md) | Get cost of equipment. |
|
||||||
@ -34,6 +35,7 @@ If you are not in BitNode-2, then you must have Source-File 2 in order to use th
|
|||||||
| [getOtherGangInformation()](./bitburner.gang.getotherganginformation.md) | Get information about the other gangs. |
|
| [getOtherGangInformation()](./bitburner.gang.getotherganginformation.md) | Get information about the other gangs. |
|
||||||
| [getTaskNames()](./bitburner.gang.gettasknames.md) | List member task names. |
|
| [getTaskNames()](./bitburner.gang.gettasknames.md) | List member task names. |
|
||||||
| [getTaskStats(name)](./bitburner.gang.gettaskstats.md) | Get stats of a task. |
|
| [getTaskStats(name)](./bitburner.gang.gettaskstats.md) | Get stats of a task. |
|
||||||
|
| [inGang()](./bitburner.gang.ingang.md) | Check if you're in a gang. |
|
||||||
| [purchaseEquipment(memberName, equipName)](./bitburner.gang.purchaseequipment.md) | Purchase an equipment for a gang member. |
|
| [purchaseEquipment(memberName, equipName)](./bitburner.gang.purchaseequipment.md) | Purchase an equipment for a gang member. |
|
||||||
| [recruitMember(name)](./bitburner.gang.recruitmember.md) | Recruit a new gang member. |
|
| [recruitMember(name)](./bitburner.gang.recruitmember.md) | Recruit a new gang member. |
|
||||||
| [setMemberTask(memberName, taskName)](./bitburner.gang.setmembertask.md) | Set gang member to task. |
|
| [setMemberTask(memberName, taskName)](./bitburner.gang.setmembertask.md) | Set gang member to task. |
|
||||||
|
@ -9,7 +9,7 @@ Gang general info.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface GangGenInfo
|
export interface GangGenInfo
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface GangMemberAscension
|
export interface GangMemberAscension
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface GangMemberInfo
|
export interface GangMemberInfo
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface GangOtherInfo
|
export interface GangOtherInfo
|
||||||
```
|
```
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface GangOtherInfoObject
|
export interface GangOtherInfoObject
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Object representing data representing a gang member task.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface GangTaskStats
|
export interface GangTaskStats
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface GangTerritory
|
export interface GangTerritory
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Hack related multipliers.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface HackingMultipliers
|
export interface HackingMultipliers
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Hacknet API
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface Hacknet
|
export interface Hacknet
|
||||||
```
|
```
|
||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
@ -9,7 +9,7 @@ Hacknet related multipliers.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface HacknetMultipliers
|
export interface HacknetMultipliers
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -9,7 +9,7 @@ Object representing all the values related to a hacknet node.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface NodeStats
|
export interface NodeStats
|
||||||
```
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
@ -14,7 +14,9 @@ readonly args: (string | number)[];
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
RAM cost: 0 GB Arguments passed into a script can be accessed using a normal array using the \[\] operator (args\[0\], args\[1\], etc…).
|
RAM cost: 0 GB
|
||||||
|
|
||||||
|
Arguments passed into a script can be accessed using a normal array using the \[\] operator (args\[0\], args\[1\], etc…).
|
||||||
|
|
||||||
It is also possible to get the number of arguments that was passed into a script using: 'args.length' WARNING: Do not try to modify the args array. This will break the game.
|
It is also possible to get the number of arguments that was passed into a script using: 'args.length' WARNING: Do not try to modify the args array. This will break the game.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.brutessh() method
|
## NS.brutessh() method
|
||||||
|
|
||||||
Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer.
|
Runs BruteSSH.exe on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ void
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB
|
||||||
|
|
||||||
|
Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,11 +4,7 @@
|
|||||||
|
|
||||||
## NS.clear() method
|
## NS.clear() method
|
||||||
|
|
||||||
This function is used to clear data in a Netscript Ports or a text file.
|
Clear data from a port.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,5 +24,11 @@ void
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
RAM cost: 1 GB
|
RAM cost: 0 GB
|
||||||
|
|
||||||
|
This function is used to clear data in a 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.
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.deleteServer() method
|
## NS.deleteServer() method
|
||||||
|
|
||||||
Deletes one of your purchased servers, which is specified by its hostname.
|
Delete a purchased server.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -30,3 +28,7 @@ True if successful, and false otherwise.
|
|||||||
|
|
||||||
2.25 GB
|
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.
|
||||||
|
|
||||||
|
@ -24,7 +24,9 @@ void
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
RAM cost: 0 GB Logging can be disabled for all functions by passing `ALL` as the argument.
|
RAM cost: 0 GB
|
||||||
|
|
||||||
|
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.
|
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.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.enableLog() method
|
## NS.enableLog() method
|
||||||
|
|
||||||
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`<!-- -->).
|
Enable logging for a certain function.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -26,3 +26,5 @@ void
|
|||||||
|
|
||||||
RAM cost: 0 GB
|
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`<!-- -->).
|
||||||
|
|
||||||
|
@ -4,13 +4,7 @@
|
|||||||
|
|
||||||
## NS.exec() method
|
## NS.exec() method
|
||||||
|
|
||||||
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.
|
Start another script on any server.
|
||||||
|
|
||||||
If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.
|
|
||||||
|
|
||||||
PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.
|
|
||||||
|
|
||||||
Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -37,6 +31,14 @@ Returns the PID of a successfully started script, and 0 otherwise.
|
|||||||
|
|
||||||
RAM cost: 1.3 GB
|
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.
|
||||||
|
|
||||||
|
If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.
|
||||||
|
|
||||||
|
PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.
|
||||||
|
|
||||||
|
Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error.
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.fileExists() method
|
## NS.fileExists() method
|
||||||
|
|
||||||
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'.
|
Check if a file exists.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -31,6 +29,10 @@ True if specified file exists, and false otherwise.
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
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.
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.ftpcrack() method
|
## NS.ftpcrack() method
|
||||||
|
|
||||||
Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer.
|
Runs FTPCrack.exe on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ void
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB
|
||||||
|
|
||||||
|
Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.getBitNodeMultipliers() method
|
## NS.getBitNodeMultipliers() method
|
||||||
|
|
||||||
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).
|
Get the current Bitnode multipliers.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -23,6 +21,10 @@ Object containing the current BitNode multipliers.
|
|||||||
|
|
||||||
RAM cost: 4 GB
|
RAM cost: 4 GB
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
## NS.getGrowTime() method
|
## NS.getGrowTime() method
|
||||||
|
|
||||||
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.
|
Get the execution time of a grow() call.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
getGrowTime(host: string, hackLvl?: number, intLvl?: number): number;
|
getGrowTime(host: string): number;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -17,8 +17,6 @@ getGrowTime(host: string, hackLvl?: number, intLvl?: number): number;
|
|||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| host | string | Host of target server. |
|
| host | string | Host of target server. |
|
||||||
| hackLvl | number | Optional hacking level for the calculation. Defaults to player’s current hacking level. |
|
|
||||||
| intLvl | number | Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
@ -30,3 +28,5 @@ Returns the amount of time in seconds it takes to execute the grow Netscript fun
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
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.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.getHackingMultipliers() method
|
## NS.getHackingMultipliers() method
|
||||||
|
|
||||||
Returns an object containing the Player’s hacking related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%).
|
Get hacking related multipliers.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -21,6 +21,8 @@ Object containing the Player’s hacking related multipliers.
|
|||||||
|
|
||||||
RAM cost: 4 GB
|
RAM cost: 4 GB
|
||||||
|
|
||||||
|
Returns an object containing the Player’s hacking related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%).
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.getHacknetMultipliers() method
|
## NS.getHacknetMultipliers() method
|
||||||
|
|
||||||
Returns an object containing the Player’s hacknet related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%).
|
Get hacknet related multipliers.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -21,6 +21,8 @@ Object containing the Player’s hacknet related multipliers.
|
|||||||
|
|
||||||
RAM cost: 4 GB
|
RAM cost: 4 GB
|
||||||
|
|
||||||
|
Returns an object containing the Player’s hacknet related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%).
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
## NS.getHackTime() method
|
## NS.getHackTime() method
|
||||||
|
|
||||||
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.
|
Get the execution time of a hack() call.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
getHackTime(host: string, hackLvl?: number, intLvl?: number): number;
|
getHackTime(host: string): number;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -17,16 +17,16 @@ getHackTime(host: string, hackLvl?: number, intLvl?: number): number;
|
|||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| host | string | Host of target server. |
|
| host | string | Host of target server. |
|
||||||
| hackLvl | number | Optional hacking level for the calculation. Defaults to player’s current hacking level. |
|
|
||||||
| intLvl | number | Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
number
|
number
|
||||||
|
|
||||||
Returns the amount of time in seconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server.
|
Returns the amount of time in milliseconds it takes to execute the hack Netscript function. Returns Infinity if called on a Hacknet Server.
|
||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB
|
||||||
|
|
||||||
|
Returns the amount of time in milliseconds 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.
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.getPortHandle() method
|
## NS.getPortHandle() method
|
||||||
|
|
||||||
Get a handle to a Netscript Port.
|
Get all data on a port.
|
||||||
|
|
||||||
WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,5 +26,9 @@ Data in the specified port.
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
RAM cost: 10 GB
|
RAM cost: 0 GB
|
||||||
|
|
||||||
|
Get a handle to a Netscript Port.
|
||||||
|
|
||||||
|
WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.getPurchasedServerCost() method
|
## NS.getPurchasedServerCost() method
|
||||||
|
|
||||||
Returns the cost to purchase a server with the specified amount of ram.
|
Get cost of purchasing a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,6 +28,8 @@ The cost to purchase a server with the specified amount of ram.
|
|||||||
|
|
||||||
RAM cost: 0.25 GB
|
RAM cost: 0.25 GB
|
||||||
|
|
||||||
|
Returns the cost to purchase a server with the specified amount of ram.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ getPurchasedServers(hostnameMode?: boolean): string[];
|
|||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| hostnameMode | boolean | \] Optional. Defaults to true. Returns hostnames if true, and IPs if false. |
|
| hostnameMode | boolean | Optional. Defaults to true. Returns hostnames if true, and IPs if false. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.getScriptExpGain() method
|
## NS.getScriptExpGain() method
|
||||||
|
|
||||||
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.
|
Get the exp gain of a script.
|
||||||
|
|
||||||
This function can also return the total experience gain rate of all of your active scripts by running the function with no arguments.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -32,3 +30,7 @@ Amount of hacking experience the specified script generates while online.
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
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.
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.getScriptIncome() method
|
## NS.getScriptIncome() method
|
||||||
|
|
||||||
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.
|
Get the income of a script.
|
||||||
|
|
||||||
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 (dollar / second) of all of your active scripts (scripts that are currently running on any server). The second value is the total income (dollar / second) that you’ve earned from scripts since you last installed Augmentations.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -32,3 +30,7 @@ Amount of income the specified script generates while online.
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
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 (dollar / second) of all of your active scripts (scripts that are currently running on any server). The second value is the total income (dollar / second) that you’ve earned from scripts since you last installed Augmentations.
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.getScriptLogs() method
|
## NS.getScriptLogs() method
|
||||||
|
|
||||||
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.
|
Get all the logs of a script.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -32,6 +30,10 @@ Returns an string array, where each line is an element in the array. The most re
|
|||||||
|
|
||||||
RAM cost: 0 GB
|
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.
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.getScriptRam() method
|
## NS.getScriptRam() method
|
||||||
|
|
||||||
Returns the amount of RAM required to run the specified script on the target server. Returns 0 if the script does not exist.
|
Get the ram cost of a script.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,3 +29,5 @@ Amount of RAM required to run the specified script on the target server, and 0 i
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
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.
|
||||||
|
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getServerBaseSecurityLevel](./bitburner.ns.getserverbasesecuritylevel.md)
|
|
||||||
|
|
||||||
## NS.getServerBaseSecurityLevel() method
|
|
||||||
|
|
||||||
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).
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
getServerBaseSecurityLevel(host: string): number;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| host | string | Host of target server. |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
number
|
|
||||||
|
|
||||||
Base security level of the target server.
|
|
||||||
|
|
||||||
## Remarks
|
|
||||||
|
|
||||||
RAM cost: 0.1 GB
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.getServerGrowth() method
|
## NS.getServerGrowth() method
|
||||||
|
|
||||||
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.
|
Get a server growth parameter.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,3 +28,5 @@ Parameter that affects the percentage by which the server’s money is increased
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
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.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.getServerMaxMoney() method
|
## NS.getServerMaxMoney() method
|
||||||
|
|
||||||
Returns the maximum amount of money that can be available on a server.
|
Get maximum money available on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,3 +28,5 @@ Maximum amount of money available on the server.
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
RAM cost: 0.1 GB
|
||||||
|
|
||||||
|
Returns the maximum amount of money that can be available on a server.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.getServerMoneyAvailable() method
|
## NS.getServerMoneyAvailable() method
|
||||||
|
|
||||||
Returns the amount of money available on a server. Running this function on the home computer will return the player’s money.
|
Get money available on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,6 +28,8 @@ Amount of money available on the server.
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
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
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getServerRam](./bitburner.ns.getserverram.md)
|
|
||||||
|
|
||||||
## NS.getServerRam() method
|
|
||||||
|
|
||||||
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).
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
getServerRam(host: string): [number, number];
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| host | string | Host of target server. |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
\[number, number\]
|
|
||||||
|
|
||||||
Array with total and used memory on the specified server.
|
|
||||||
|
|
||||||
## Remarks
|
|
||||||
|
|
||||||
RAM cost: 0.1 GB
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
|
|
||||||
```ts
|
|
||||||
res = getServerRam("helios");
|
|
||||||
totalRam = res[0];
|
|
||||||
ramUsed = res[1];
|
|
||||||
```
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.getServerSecurityLevel() method
|
## NS.getServerSecurityLevel() method
|
||||||
|
|
||||||
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).
|
Get server security level.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,3 +28,5 @@ Security level of the target server.
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
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).
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
## NS.getWeakenTime() method
|
## NS.getWeakenTime() method
|
||||||
|
|
||||||
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.
|
Get the execution time of a weaken() call.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
getWeakenTime(host: string, hackLvl?: number, intLvl?: number): number;
|
getWeakenTime(host: string): number;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -17,8 +17,6 @@ getWeakenTime(host: string, hackLvl?: number, intLvl?: number): number;
|
|||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| host | string | Host of target server. |
|
| host | string | Host of target server. |
|
||||||
| hackLvl | number | Optional hacking level for the calculation. Defaults to player’s current hacking level. |
|
|
||||||
| intLvl | number | Optional intelligence level for the calculation. Defaults to player’s current intelligence level. (Intelligence is unlocked after obtaining Source-File 5). |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
@ -30,3 +28,5 @@ Returns the amount of time in seconds it takes to execute the grow Netscript fun
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
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.
|
||||||
|
|
||||||
|
@ -27,7 +27,9 @@ The number by which the money on the server was multiplied for the growth.
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
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.
|
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.
|
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.
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.growthAnalyze() method
|
## NS.growthAnalyze() method
|
||||||
|
|
||||||
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.
|
Calculate the number of grow thread needed to grow a server by a certain multiplier.
|
||||||
|
|
||||||
Warning: The value returned by this function isn’t necessarily a whole number.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -31,6 +29,10 @@ The amount of grow calls needed to grow the specified server by the specified am
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
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.
|
||||||
|
|
||||||
|
Warning: The value returned by this function isn’t necessarily a whole number.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.growthAnalyzeSecurity() method
|
## NS.growthAnalyzeSecurity() method
|
||||||
|
|
||||||
Returns the security increase that would occur if a grow with this many threads happened.
|
Calculate the security increase for a number of thread.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,3 +28,5 @@ The security increase.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
RAM cost: 1 GB
|
||||||
|
|
||||||
|
Returns the security increase that would occur if a grow with this many threads happened.
|
||||||
|
|
||||||
|
@ -27,7 +27,9 @@ The amount of money stolen if the hack is successful, and zero otherwise.
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
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.
|
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 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.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.hackAnalyzePercent() method
|
## NS.hackAnalyzePercent() method
|
||||||
|
|
||||||
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).
|
Get the percent of money stolen with a single thread.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,6 +28,8 @@ The percentage of money you will steal from the target server with a single hack
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
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).
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.hackAnalyzeSecurity() method
|
## NS.hackAnalyzeSecurity() method
|
||||||
|
|
||||||
Returns the security increase that would occur if a hack with this many threads happened.
|
Get the security increase for a number of thread.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,3 +28,5 @@ The security increase.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
RAM cost: 1 GB
|
||||||
|
|
||||||
|
Returns the security increase that would occur if a hack with this many threads happened.
|
||||||
|
|
||||||
|
@ -27,7 +27,9 @@ The number of threads needed to hack the server for hackAmount money.
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
Warning: The value returned by this function isn’t necessarily a whole number.
|
Warning: The value returned by this function isn’t necessarily a whole number.
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.hackChance() method
|
## NS.hackChance() method
|
||||||
|
|
||||||
Returns the chance you have of successfully hacking the specified server.
|
Get the chance of successfully hacking a server.
|
||||||
|
|
||||||
This returned value is in decimal form, not percentage.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -30,3 +28,7 @@ The chance you have of successfully hacking the target server.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
RAM cost: 1 GB
|
||||||
|
|
||||||
|
Returns the chance you have of successfully hacking the specified server.
|
||||||
|
|
||||||
|
This returned value is in decimal form, not percentage.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.hasRootAccess() method
|
## NS.hasRootAccess() method
|
||||||
|
|
||||||
Returns a boolean indicating whether or not the player has root access to the specified target server.
|
Check if your have root access on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,6 +28,8 @@ True if player has root access to the specified target server, and false otherwi
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB
|
||||||
|
|
||||||
|
Returns a boolean indicating whether or not the player has root access to the specified target server.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.httpworm() method
|
## NS.httpworm() method
|
||||||
|
|
||||||
Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer.
|
Runs HTTPWorm.exe on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ void
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB
|
||||||
|
|
||||||
|
Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.isRunning() method
|
## NS.isRunning() method
|
||||||
|
|
||||||
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.
|
Check if a script is running.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -30,6 +30,8 @@ True if specified script is running on the target server, and false otherwise.
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
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.
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.kill() method
|
## NS.kill() method
|
||||||
|
|
||||||
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.
|
Terminate another script.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -30,6 +30,8 @@ True if the script is successfully killed, and false otherwise.
|
|||||||
|
|
||||||
RAM cost: 0.5 GB
|
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.
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.kill() method
|
## NS.kill() method
|
||||||
|
|
||||||
Kills the script with the specified PID. Killing a script by its PID will typically have better performance, especially if you have many scripts running. If this function successfully kills the specified script, then it will return true. Otherwise, it will return false.
|
Terminate another script.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,6 +28,8 @@ True if the script is successfully killed, and false otherwise.
|
|||||||
|
|
||||||
RAM cost: 0.5 GB
|
RAM cost: 0.5 GB
|
||||||
|
|
||||||
|
Kills the script with the specified PID. Killing a script by its PID will typically have better performance, especially if you have many scripts running. If this function successfully kills the specified script, then it will return true. Otherwise, it will return false.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.killall() method
|
## NS.killall() method
|
||||||
|
|
||||||
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.
|
Terminate all scripts on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,3 +28,5 @@ True if any scripts were killed, and false otherwise.
|
|||||||
|
|
||||||
RAM cost: 0.5 GB
|
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.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.ls() method
|
## NS.ls() method
|
||||||
|
|
||||||
Returns an array with the filenames of all files on the specified server (as strings). The returned array is sorted in alphabetic order.
|
List files on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,3 +29,5 @@ Array with the filenames of all files on the specified server.
|
|||||||
|
|
||||||
RAM cost: 0.2 GB
|
RAM cost: 0.2 GB
|
||||||
|
|
||||||
|
Returns an array with the filenames of all files on the specified server (as strings). The returned array is sorted in alphabetic order.
|
||||||
|
|
||||||
|
@ -29,89 +29,87 @@ export interface NS extends Singularity
|
|||||||
|
|
||||||
| Method | Description |
|
| Method | Description |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [brutessh(host)](./bitburner.ns.brutessh.md) | Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer. |
|
| [brutessh(host)](./bitburner.ns.brutessh.md) | Runs BruteSSH.exe on a server. |
|
||||||
| [clear(handle)](./bitburner.ns.clear.md) | This function is used to clear data in a 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. |
|
| [clear(handle)](./bitburner.ns.clear.md) | Clear data from a port. |
|
||||||
| [clearLog()](./bitburner.ns.clearlog.md) | Clears the script’s logs. |
|
| [clearLog()](./bitburner.ns.clearlog.md) | Clears the script’s logs. |
|
||||||
| [deleteServer(host)](./bitburner.ns.deleteserver.md) | 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. |
|
| [deleteServer(host)](./bitburner.ns.deleteserver.md) | Delete a purchased server. |
|
||||||
| [disableLog(fn)](./bitburner.ns.disablelog.md) | Disables logging for the given function. |
|
| [disableLog(fn)](./bitburner.ns.disablelog.md) | Disables logging for the given function. |
|
||||||
| [enableLog(fn)](./bitburner.ns.enablelog.md) | Re-enables logging for the given function. If <code>ALL</code> is passed into this function as an argument, then it will revert the effects of disableLog(<code>ALL</code>). |
|
| [enableLog(fn)](./bitburner.ns.enablelog.md) | Enable logging for a certain function. |
|
||||||
| [exec(script, host, numThreads, args)](./bitburner.ns.exec.md) | 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.<!-- -->If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.<!-- -->PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.<!-- -->Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error. |
|
| [exec(script, host, numThreads, args)](./bitburner.ns.exec.md) | Start another script on any server. |
|
||||||
| [exit()](./bitburner.ns.exit.md) | Terminates the current script immediately. |
|
| [exit()](./bitburner.ns.exit.md) | Terminates the current script immediately. |
|
||||||
| [fileExists(filename, host)](./bitburner.ns.fileexists.md) | 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. |
|
| [fileExists(filename, host)](./bitburner.ns.fileexists.md) | Check if a file exists. |
|
||||||
| [ftpcrack(host)](./bitburner.ns.ftpcrack.md) | Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer. |
|
| [ftpcrack(host)](./bitburner.ns.ftpcrack.md) | Runs FTPCrack.exe on a server. |
|
||||||
| [getBitNodeMultipliers()](./bitburner.ns.getbitnodemultipliers.md) | 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. |
|
| [getBitNodeMultipliers()](./bitburner.ns.getbitnodemultipliers.md) | Get the current Bitnode multipliers. |
|
||||||
| [getFavorToDonate()](./bitburner.ns.getfavortodonate.md) | Returns the amount of Faction favor required to be able to donate to a faction. |
|
| [getFavorToDonate()](./bitburner.ns.getfavortodonate.md) | Returns the amount of Faction favor required to be able to donate to a faction. |
|
||||||
| [getGrowTime(host, hackLvl, intLvl)](./bitburner.ns.getgrowtime.md) | 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. |
|
| [getGrowTime(host)](./bitburner.ns.getgrowtime.md) | Get the execution time of a grow() call. |
|
||||||
| [getHackingLevel()](./bitburner.ns.gethackinglevel.md) | Returns the player’s current hacking level. |
|
| [getHackingLevel()](./bitburner.ns.gethackinglevel.md) | Returns the player’s current hacking level. |
|
||||||
| [getHackingMultipliers()](./bitburner.ns.gethackingmultipliers.md) | Returns an object containing the Player’s hacking related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). |
|
| [getHackingMultipliers()](./bitburner.ns.gethackingmultipliers.md) | Get hacking related multipliers. |
|
||||||
| [getHacknetMultipliers()](./bitburner.ns.gethacknetmultipliers.md) | Returns an object containing the Player’s hacknet related multipliers. These multipliers are returned in fractional forms, not percentages (e.g. 1.5 instead of 150%). |
|
| [getHacknetMultipliers()](./bitburner.ns.gethacknetmultipliers.md) | Get hacknet related multipliers. |
|
||||||
| [getHackTime(host, hackLvl, intLvl)](./bitburner.ns.gethacktime.md) | 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. |
|
| [getHackTime(host)](./bitburner.ns.gethacktime.md) | Get the execution time of a hack() call. |
|
||||||
| [getHostname()](./bitburner.ns.gethostname.md) | Returns a string with the hostname of the server that the script is running on. |
|
| [getHostname()](./bitburner.ns.gethostname.md) | Returns a string with the hostname of the server that the script is running on. |
|
||||||
| [getPortHandle(port)](./bitburner.ns.getporthandle.md) | Get a handle to a Netscript Port.<!-- -->WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0. |
|
| [getPortHandle(port)](./bitburner.ns.getporthandle.md) | Get all data on a port. |
|
||||||
| [getPurchasedServerCost(ram)](./bitburner.ns.getpurchasedservercost.md) | Returns the cost to purchase a server with the specified amount of ram. |
|
| [getPurchasedServerCost(ram)](./bitburner.ns.getpurchasedservercost.md) | Get cost of purchasing a server. |
|
||||||
| [getPurchasedServerLimit()](./bitburner.ns.getpurchasedserverlimit.md) | Returns the maximum number of servers you can purchase. |
|
| [getPurchasedServerLimit()](./bitburner.ns.getpurchasedserverlimit.md) | Returns the maximum number of servers you can purchase. |
|
||||||
| [getPurchasedServerMaxRam()](./bitburner.ns.getpurchasedservermaxram.md) | Returns the maximum RAM that a purchased server can have. |
|
| [getPurchasedServerMaxRam()](./bitburner.ns.getpurchasedservermaxram.md) | Returns the maximum RAM that a purchased server can have. |
|
||||||
| [getPurchasedServers(hostnameMode)](./bitburner.ns.getpurchasedservers.md) | Returns an array with either the hostnames or IPs of all of the servers you have purchased. |
|
| [getPurchasedServers(hostnameMode)](./bitburner.ns.getpurchasedservers.md) | Returns an array with either the hostnames or IPs of all of the servers you have purchased. |
|
||||||
| [getScriptExpGain(script, host, args)](./bitburner.ns.getscriptexpgain.md) | 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. |
|
| [getScriptExpGain(script, host, args)](./bitburner.ns.getscriptexpgain.md) | Get the exp gain of a script. |
|
||||||
| [getScriptIncome(script, host, args)](./bitburner.ns.getscriptincome.md) | 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 (dollar / second) of all of your active scripts (scripts that are currently running on any server). The second value is the total income (dollar / second) that you’ve earned from scripts since you last installed Augmentations. |
|
| [getScriptIncome(script, host, args)](./bitburner.ns.getscriptincome.md) | Get the income of a script. |
|
||||||
| [getScriptLogs(fn, host, args)](./bitburner.ns.getscriptlogs.md) | 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. |
|
| [getScriptLogs(fn, host, args)](./bitburner.ns.getscriptlogs.md) | Get all the logs of a script. |
|
||||||
| [getScriptName()](./bitburner.ns.getscriptname.md) | Returns the current script name. |
|
| [getScriptName()](./bitburner.ns.getscriptname.md) | Returns the current script name. |
|
||||||
| [getScriptRam(script, host)](./bitburner.ns.getscriptram.md) | Returns the amount of RAM required to run the specified script on the target server. Returns 0 if the script does not exist. |
|
| [getScriptRam(script, host)](./bitburner.ns.getscriptram.md) | Get the ram cost of a script. |
|
||||||
| [getServer(host)](./bitburner.ns.getserver.md) | Returns a server object for the given server. Defaults to the running script's server if host is not specified. |
|
| [getServer(host)](./bitburner.ns.getserver.md) | Returns a server object for the given server. Defaults to the running script's server if host is not specified. |
|
||||||
| [getServerBaseSecurityLevel(host)](./bitburner.ns.getserverbasesecuritylevel.md) | 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). |
|
| [getServerGrowth(host)](./bitburner.ns.getservergrowth.md) | Get a server growth parameter. |
|
||||||
| [getServerGrowth(host)](./bitburner.ns.getservergrowth.md) | 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. |
|
| [getServerMaxMoney(host)](./bitburner.ns.getservermaxmoney.md) | Get maximum money available on a server. |
|
||||||
| [getServerMaxMoney(host)](./bitburner.ns.getservermaxmoney.md) | Returns the maximum amount of money that can be available on a server. |
|
|
||||||
| [getServerMinSecurityLevel(host)](./bitburner.ns.getserverminsecuritylevel.md) | Returns the minimum security level of the target server. |
|
| [getServerMinSecurityLevel(host)](./bitburner.ns.getserverminsecuritylevel.md) | Returns the minimum security level of the target server. |
|
||||||
| [getServerMoneyAvailable(host)](./bitburner.ns.getservermoneyavailable.md) | Returns the amount of money available on a server. Running this function on the home computer will return the player’s money. |
|
| [getServerMoneyAvailable(host)](./bitburner.ns.getservermoneyavailable.md) | Get money available on a server. |
|
||||||
| [getServerNumPortsRequired(host)](./bitburner.ns.getservernumportsrequired.md) | Returns the number of open ports required to successfully run NUKE.exe on the specified server. |
|
| [getServerNumPortsRequired(host)](./bitburner.ns.getservernumportsrequired.md) | Returns the number of open ports required to successfully run NUKE.exe on the specified server. |
|
||||||
| [getServerRam(host)](./bitburner.ns.getserverram.md) | 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). |
|
|
||||||
| [getServerRequiredHackingLevel(host)](./bitburner.ns.getserverrequiredhackinglevel.md) | Returns the required hacking level of the target server. |
|
| [getServerRequiredHackingLevel(host)](./bitburner.ns.getserverrequiredhackinglevel.md) | Returns the required hacking level of the target server. |
|
||||||
| [getServerSecurityLevel(host)](./bitburner.ns.getserversecuritylevel.md) | 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). |
|
| [getServerSecurityLevel(host)](./bitburner.ns.getserversecuritylevel.md) | Get server security level. |
|
||||||
| [getTimeSinceLastAug()](./bitburner.ns.gettimesincelastaug.md) | Returns the amount of time in milliseconds that have passed since you last installed Augmentations. |
|
| [getTimeSinceLastAug()](./bitburner.ns.gettimesincelastaug.md) | Returns the amount of time in milliseconds that have passed since you last installed Augmentations. |
|
||||||
| [getWeakenTime(host, hackLvl, intLvl)](./bitburner.ns.getweakentime.md) | 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. |
|
| [getWeakenTime(host)](./bitburner.ns.getweakentime.md) | Get the execution time of a weaken() call. |
|
||||||
| [grow(host, opts)](./bitburner.ns.grow.md) | Spoof money in a servers bank account, increasing the amount available. |
|
| [grow(host, opts)](./bitburner.ns.grow.md) | Spoof money in a servers bank account, increasing the amount available. |
|
||||||
| [growthAnalyze(host, growthAmount)](./bitburner.ns.growthanalyze.md) | 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.<!-- -->Warning: The value returned by this function isn’t necessarily a whole number. |
|
| [growthAnalyze(host, growthAmount)](./bitburner.ns.growthanalyze.md) | Calculate the number of grow thread needed to grow a server by a certain multiplier. |
|
||||||
| [growthAnalyzeSecurity(threads)](./bitburner.ns.growthanalyzesecurity.md) | Returns the security increase that would occur if a grow with this many threads happened. |
|
| [growthAnalyzeSecurity(threads)](./bitburner.ns.growthanalyzesecurity.md) | Calculate the security increase for a number of thread. |
|
||||||
| [hack(host, opts)](./bitburner.ns.hack.md) | Steal a servers money. |
|
| [hack(host, opts)](./bitburner.ns.hack.md) | Steal a servers money. |
|
||||||
| [hackAnalyzePercent(host)](./bitburner.ns.hackanalyzepercent.md) | 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). |
|
| [hackAnalyzePercent(host)](./bitburner.ns.hackanalyzepercent.md) | Get the percent of money stolen with a single thread. |
|
||||||
| [hackAnalyzeSecurity(threads)](./bitburner.ns.hackanalyzesecurity.md) | Returns the security increase that would occur if a hack with this many threads happened. |
|
| [hackAnalyzeSecurity(threads)](./bitburner.ns.hackanalyzesecurity.md) | Get the security increase for a number of thread. |
|
||||||
| [hackAnalyzeThreads(host, hackAmount)](./bitburner.ns.hackanalyzethreads.md) | Predict the effect of hack. |
|
| [hackAnalyzeThreads(host, hackAmount)](./bitburner.ns.hackanalyzethreads.md) | Predict the effect of hack. |
|
||||||
| [hackChance(host)](./bitburner.ns.hackchance.md) | Returns the chance you have of successfully hacking the specified server.<!-- -->This returned value is in decimal form, not percentage. |
|
| [hackChance(host)](./bitburner.ns.hackchance.md) | Get the chance of successfully hacking a server. |
|
||||||
| [hasRootAccess(host)](./bitburner.ns.hasrootaccess.md) | Returns a boolean indicating whether or not the player has root access to the specified target server. |
|
| [hasRootAccess(host)](./bitburner.ns.hasrootaccess.md) | Check if your have root access on a server. |
|
||||||
| [httpworm(host)](./bitburner.ns.httpworm.md) | Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer. |
|
| [httpworm(host)](./bitburner.ns.httpworm.md) | Runs HTTPWorm.exe on a server. |
|
||||||
| [isLogEnabled(fn)](./bitburner.ns.islogenabled.md) | Checks the status of the logging for the given function. |
|
| [isLogEnabled(fn)](./bitburner.ns.islogenabled.md) | Checks the status of the logging for the given function. |
|
||||||
| [isRunning(script, host, args)](./bitburner.ns.isrunning.md) | 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. |
|
| [isRunning(script, host, args)](./bitburner.ns.isrunning.md) | Check if a script is running. |
|
||||||
| [kill(script, host, args)](./bitburner.ns.kill.md) | 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 <code>foo.script</code> is run with the argument 1, then this is not the same as <code>foo.script</code> run with the argument 2, even though they have the same code. |
|
| [kill(script, host, args)](./bitburner.ns.kill.md) | Terminate another script. |
|
||||||
| [kill(scriptPid)](./bitburner.ns.kill_1.md) | Kills the script with the specified PID. Killing a script by its PID will typically have better performance, especially if you have many scripts running. If this function successfully kills the specified script, then it will return true. Otherwise, it will return false. |
|
| [kill(scriptPid)](./bitburner.ns.kill_1.md) | Terminate another script. |
|
||||||
| [killall(host)](./bitburner.ns.killall.md) | 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. |
|
| [killall(host)](./bitburner.ns.killall.md) | Terminate all scripts on a server. |
|
||||||
| [ls(host, grep)](./bitburner.ns.ls.md) | Returns an array with the filenames of all files on the specified server (as strings). The returned array is sorted in alphabetic order. |
|
| [ls(host, grep)](./bitburner.ns.ls.md) | List files on a server. |
|
||||||
| [nFormat(n, format)](./bitburner.ns.nformat.md) | Converts a number into a string with the specified formatter. This uses the numeraljs library, so the formatters must be compatible with that. This is the same function that the game itself uses to display numbers. |
|
| [nFormat(n, format)](./bitburner.ns.nformat.md) | Format a number |
|
||||||
| [nuke(host)](./bitburner.ns.nuke.md) | Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer. |
|
| [nuke(host)](./bitburner.ns.nuke.md) | Runs NUKE.exe on a server. |
|
||||||
| [peek(port)](./bitburner.ns.peek.md) | 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. |
|
| [peek(port)](./bitburner.ns.peek.md) | Get a copy of the data from a port without popping it. |
|
||||||
| [print(msg)](./bitburner.ns.print.md) | Prints a value or a variable to the script’s logs. |
|
| [print(msg)](./bitburner.ns.print.md) | Prints a value or a variable to the script’s logs. |
|
||||||
| [prompt(txt)](./bitburner.ns.prompt.md) | 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. |
|
| [prompt(txt)](./bitburner.ns.prompt.md) | Prompt the player with a Yes/No modal. |
|
||||||
| [ps(host)](./bitburner.ns.ps.md) | Returns an array with general information about all scripts running on the specified target server. |
|
| [ps(host)](./bitburner.ns.ps.md) | List running scripts on a server. |
|
||||||
| [purchaseServer(hostname, ram)](./bitburner.ns.purchaseserver.md) | 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 <code>purchaseServer(“foo”, 4)</code> but a server named “foo” already exists, the it will automatically change the hostname to <code>foo-0</code>. If there is already a server with the hostname <code>foo-0</code>, then it will change the hostname to <code>foo-1</code>, 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. |
|
| [purchaseServer(hostname, ram)](./bitburner.ns.purchaseserver.md) | Purchase a server. |
|
||||||
| [read(handle)](./bitburner.ns.read.md) | This function is used to read data from a port or from a text file (.txt).<!-- -->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. 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 (.txt) and this function will return the data in the specified text file. If the text file does not exist, an empty string will be returned. |
|
| [read(handle)](./bitburner.ns.read.md) | Read content of a file. |
|
||||||
| [relaysmtp(host)](./bitburner.ns.relaysmtp.md) | Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer. |
|
| [relaysmtp(host)](./bitburner.ns.relaysmtp.md) | Runs relaySMTP.exe on a server. |
|
||||||
| [rm(name, host)](./bitburner.ns.rm.md) | Removes the specified file from the current server. This function works for every file type except message (.msg) files. |
|
| [rm(name, host)](./bitburner.ns.rm.md) | Delete a file. |
|
||||||
| [run(script, numThreads, args)](./bitburner.ns.run.md) | 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). Requires a significant amount of RAM to run this command.<!-- -->If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.<!-- -->PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.<!-- -->Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error. |
|
| [run(script, numThreads, args)](./bitburner.ns.run.md) | Start another script on the current server. |
|
||||||
| [scan(host, hostnames)](./bitburner.ns.scan.md) | 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. |
|
| [scan(host, hostnames)](./bitburner.ns.scan.md) | Get the list servers connected to a server. |
|
||||||
| [scp(files, destination)](./bitburner.ns.scp.md) | 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. |
|
| [scp(files, destination)](./bitburner.ns.scp.md) | Copy file between servers. |
|
||||||
| [scp(files, source, destination)](./bitburner.ns.scp_1.md) | 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. |
|
| [scp(files, source, destination)](./bitburner.ns.scp_1.md) | Copy file between servers. |
|
||||||
| [scriptKill(script, host)](./bitburner.ns.scriptkill.md) | Kills all scripts with the specified filename on the target server specified by hostname, regardless of arguments. |
|
| [scriptKill(script, host)](./bitburner.ns.scriptkill.md) | Kill all scripts with a filename. |
|
||||||
| [scriptRunning(script, host)](./bitburner.ns.scriptrunning.md) | 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. |
|
| [scriptRunning(script, host)](./bitburner.ns.scriptrunning.md) | Check if any script with a filename is running. |
|
||||||
| [serverExists(host)](./bitburner.ns.serverexists.md) | Returns a boolean denoting whether or not the specified server exists. |
|
| [serverExists(host)](./bitburner.ns.serverexists.md) | Returns a boolean denoting whether or not the specified server exists. |
|
||||||
| [sleep(millis)](./bitburner.ns.sleep.md) | Suspends the script for n milliseconds. |
|
| [sleep(millis)](./bitburner.ns.sleep.md) | Suspends the script for n milliseconds. |
|
||||||
| [spawn(script, numThreads, args)](./bitburner.ns.spawn.md) | Terminates the current script, and then after a delay of about 10 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. |
|
| [spawn(script, numThreads, args)](./bitburner.ns.spawn.md) | Terminate current script and start another in 10s. |
|
||||||
| [sprintf(format, args)](./bitburner.ns.sprintf.md) | Complete open source JavaScript sprintf implementation |
|
| [sprintf(format, args)](./bitburner.ns.sprintf.md) | Format a string. |
|
||||||
| [sqlinject(host)](./bitburner.ns.sqlinject.md) | Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer. |
|
| [sqlinject(host)](./bitburner.ns.sqlinject.md) | Runs SQLInject.exe on a server. |
|
||||||
| [tail(fn, host, args)](./bitburner.ns.tail.md) | Opens a script’s logs. This is functionally the same as the tail Terminal command.<!-- -->If the function is called with no arguments, it will open 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. |
|
| [tail(fn, host, args)](./bitburner.ns.tail.md) | Open the tail window of a script. |
|
||||||
| [tprint(msg)](./bitburner.ns.tprint.md) | Prints a value or a variable to the Terminal. |
|
| [tprint(msg)](./bitburner.ns.tprint.md) | Prints a value or a variable to the Terminal. |
|
||||||
| [tryWrite(port, data)](./bitburner.ns.trywrite.md) | 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. |
|
| [tryWrite(port, data)](./bitburner.ns.trywrite.md) | Attempt to write to a port. |
|
||||||
| [vsprintf(format, args)](./bitburner.ns.vsprintf.md) | Complete open source JavaScript sprintf implementation |
|
| [vsprintf(format, args)](./bitburner.ns.vsprintf.md) | Format a string with an array of arguments. |
|
||||||
| [weaken(host, opts)](./bitburner.ns.weaken.md) | Reduce a server security level. |
|
| [weaken(host, opts)](./bitburner.ns.weaken.md) | Reduce a server security level. |
|
||||||
| [weakenAnalyze(threads, cores)](./bitburner.ns.weakenanalyze.md) | Predict the effect of weaken. |
|
| [weakenAnalyze(threads, cores)](./bitburner.ns.weakenanalyze.md) | Predict the effect of weaken. |
|
||||||
| [wget(url, target, host)](./bitburner.ns.wget.md) | 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).<!-- -->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 wget in NetscriptJS (Netscript 2.0).<!-- -->In NetscriptJS, you must preface any call to wget with the await keyword (like you would hack or sleep). wget will still work in Netscript 1.0, 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 wget in Netscript 1.0. |
|
| [wget(url, target, host)](./bitburner.ns.wget.md) | Download a file from the internet. |
|
||||||
| [write(handle, data, mode)](./bitburner.ns.write.md) | This function can be used to either write data to a port or to a text file (.txt).<!-- -->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. 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 (.txt) and this function will write data to that text file. If the specified text file does not exist, then it will be created. The third argument mode, defines how the data will be written to the text file. 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. 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 text file. |
|
| [write(handle, data, mode)](./bitburner.ns.write.md) | Write data to a file. |
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.nFormat() method
|
## NS.nFormat() method
|
||||||
|
|
||||||
Converts a number into a string with the specified formatter. This uses the numeraljs library, so the formatters must be compatible with that. This is the same function that the game itself uses to display numbers.
|
Format a number
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,3 +29,7 @@ Formated number.
|
|||||||
|
|
||||||
RAM cost: 0 GB
|
RAM cost: 0 GB
|
||||||
|
|
||||||
|
Converts a number into a string with the specified formatter. This uses the numeraljs library, so the formatters must be compatible with that. This is the same function that the game itself uses to display numbers.
|
||||||
|
|
||||||
|
see: http://numeraljs.com/
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.nuke() method
|
## NS.nuke() method
|
||||||
|
|
||||||
Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer.
|
Runs NUKE.exe on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ void
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB
|
||||||
|
|
||||||
|
Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.peek() method
|
## NS.peek() method
|
||||||
|
|
||||||
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.
|
Get a copy of the data from a port without popping it.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,3 +28,5 @@ Data in the specified port.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
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.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.prompt() method
|
## NS.prompt() method
|
||||||
|
|
||||||
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.
|
Prompt the player with a Yes/No modal.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,3 +28,5 @@ True if the player click “Yes” and false if the player clicks “No”.
|
|||||||
|
|
||||||
RAM cost: 0 GB
|
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.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.ps() method
|
## NS.ps() method
|
||||||
|
|
||||||
Returns an array with general information about all scripts running on the specified target server.
|
List running scripts on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -28,6 +28,8 @@ Array with general information about all scripts running on the specified target
|
|||||||
|
|
||||||
RAM cost: 0.2 GB
|
RAM cost: 0.2 GB
|
||||||
|
|
||||||
|
Returns an array with general information about all scripts running on the specified target server.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,13 +4,7 @@
|
|||||||
|
|
||||||
## NS.purchaseServer() method
|
## NS.purchaseServer() method
|
||||||
|
|
||||||
Purchased a server with the specified hostname and amount of RAM.
|
Purchase a server.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -35,6 +29,14 @@ The hostname of the newly purchased server.
|
|||||||
|
|
||||||
2.25 GB
|
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
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,11 +4,7 @@
|
|||||||
|
|
||||||
## NS.read() method
|
## NS.read() method
|
||||||
|
|
||||||
This function is used to read data from a port or from a text file (.txt).
|
Read content of a file.
|
||||||
|
|
||||||
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. 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 (.txt) and this function will return the data in the specified text file. If the text file does not exist, an empty string will be returned.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -32,3 +28,9 @@ Data in the specified text file or port.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
RAM cost: 1 GB
|
||||||
|
|
||||||
|
This function is used to read data from a port or from a text file (.txt).
|
||||||
|
|
||||||
|
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. 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 (.txt) and this function will return the data in the specified text file. If the text file does not exist, an empty string will be returned.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.relaysmtp() method
|
## NS.relaysmtp() method
|
||||||
|
|
||||||
Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer.
|
Runs relaySMTP.exe on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ void
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB
|
||||||
|
|
||||||
|
Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.rm() method
|
## NS.rm() method
|
||||||
|
|
||||||
Removes the specified file from the current server. This function works for every file type except message (.msg) files.
|
Delete a file.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,3 +29,5 @@ True if it successfully deletes the file, and false otherwise.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
RAM cost: 1 GB
|
||||||
|
|
||||||
|
Removes the specified file from the current server. This function works for every file type except message (.msg) files.
|
||||||
|
|
||||||
|
@ -4,13 +4,7 @@
|
|||||||
|
|
||||||
## NS.run() method
|
## NS.run() method
|
||||||
|
|
||||||
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). Requires a significant amount of RAM to run this command.
|
Start another script on the current server.
|
||||||
|
|
||||||
If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.
|
|
||||||
|
|
||||||
PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.
|
|
||||||
|
|
||||||
Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -36,6 +30,14 @@ Returns the PID of a successfully started script, and 0 otherwise.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
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). Requires a significant amount of RAM to run this command.
|
||||||
|
|
||||||
|
If the script was successfully started, then this functions returns the PID of that script. Otherwise, it returns 0.
|
||||||
|
|
||||||
|
PID stands for Process ID. The PID is a unique identifier for each script. The PID will always be a positive integer.
|
||||||
|
|
||||||
|
Running this function with a numThreads argument of 0 will return 0 without running the script. However, running this function with a negative numThreads argument will cause a runtime error.
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.scan() method
|
## NS.scan() method
|
||||||
|
|
||||||
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.
|
Get the list servers connected to a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,3 +29,5 @@ Returns an string of hostnames or IP.
|
|||||||
|
|
||||||
RAM cost: 0.2 GB
|
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.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.scp() method
|
## NS.scp() method
|
||||||
|
|
||||||
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.
|
Copy file between servers.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,6 +29,8 @@ True if the script/literature file is successfully copied over and false otherwi
|
|||||||
|
|
||||||
RAM cost: 0.6 GB
|
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.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.scp() method
|
## NS.scp() method
|
||||||
|
|
||||||
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.
|
Copy file between servers.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -35,6 +35,8 @@ True if the script/literature file is successfully copied over and false otherwi
|
|||||||
|
|
||||||
RAM cost: 0.6 GB
|
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.
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.scriptKill() method
|
## NS.scriptKill() method
|
||||||
|
|
||||||
Kills all scripts with the specified filename on the target server specified by hostname, regardless of arguments.
|
Kill all scripts with a filename.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,3 +29,5 @@ true if one or more scripts were successfully killed, and false if none were.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
RAM cost: 1 GB
|
||||||
|
|
||||||
|
Kills all scripts with the specified filename on the target server specified by hostname, regardless of arguments.
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.scriptRunning() method
|
## NS.scriptRunning() method
|
||||||
|
|
||||||
Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of its arguments.
|
Check if any script with a filename is running.
|
||||||
|
|
||||||
This is different than the isRunning function because it does not try to identify a specific instance of a running script by its arguments.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -31,6 +29,10 @@ True if the specified script is running, and false otherwise.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
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.
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
## NS.spawn() method
|
## NS.spawn() method
|
||||||
|
|
||||||
Terminates the current script, and then after a delay of about 10 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.
|
Terminate current script and start another in 10s.
|
||||||
|
|
||||||
Because this function immediately terminates the script, it does not have a return value.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -30,6 +28,10 @@ void
|
|||||||
|
|
||||||
RAM cost: 2 GB
|
RAM cost: 2 GB
|
||||||
|
|
||||||
|
Terminates the current script, and then after a delay of about 10 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.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.sprintf() method
|
## NS.sprintf() method
|
||||||
|
|
||||||
Complete open source JavaScript sprintf implementation
|
Format a string.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,3 +29,5 @@ Formated text.
|
|||||||
|
|
||||||
RAM cost: 0 GB
|
RAM cost: 0 GB
|
||||||
|
|
||||||
|
see: https://github.com/alexei/sprintf.js
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.sqlinject() method
|
## NS.sqlinject() method
|
||||||
|
|
||||||
Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer.
|
Runs SQLInject.exe on a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,11 +4,7 @@
|
|||||||
|
|
||||||
## NS.tail() method
|
## NS.tail() method
|
||||||
|
|
||||||
Opens a script’s logs. This is functionally the same as the tail Terminal command.
|
Open the tail window of a script.
|
||||||
|
|
||||||
If the function is called with no arguments, it will open 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.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -32,6 +28,12 @@ void
|
|||||||
|
|
||||||
RAM cost: 0 GB
|
RAM cost: 0 GB
|
||||||
|
|
||||||
|
Opens a script’s logs. This is functionally the same as the tail Terminal command.
|
||||||
|
|
||||||
|
If the function is called with no arguments, it will open 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.
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.tryWrite() method
|
## NS.tryWrite() method
|
||||||
|
|
||||||
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.
|
Attempt to write to a port.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,3 +29,5 @@ True if the data is successfully written to the port, and false otherwise.
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
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.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.vsprintf() method
|
## NS.vsprintf() method
|
||||||
|
|
||||||
Complete open source JavaScript sprintf implementation
|
Format a string with an array of arguments.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -29,3 +29,5 @@ Formated text.
|
|||||||
|
|
||||||
RAM cost: 0 GB
|
RAM cost: 0 GB
|
||||||
|
|
||||||
|
see: https://github.com/alexei/sprintf.js
|
||||||
|
|
||||||
|
@ -27,7 +27,9 @@ The amount by which the target server’s security level was decreased. This is
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
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.
|
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.
|
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.
|
||||||
|
|
||||||
|
@ -27,5 +27,7 @@ The security decrease.
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
RAM cost: 1 GB Returns the security decrease that would occur if a weaken with this many threads happened.
|
RAM cost: 1 GB
|
||||||
|
|
||||||
|
Returns the security decrease that would occur if a weaken with this many threads happened.
|
||||||
|
|
||||||
|
@ -4,11 +4,7 @@
|
|||||||
|
|
||||||
## NS.wget() method
|
## NS.wget() method
|
||||||
|
|
||||||
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).
|
Download a file from the internet.
|
||||||
|
|
||||||
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 wget in NetscriptJS (Netscript 2.0).
|
|
||||||
|
|
||||||
In NetscriptJS, you must preface any call to wget with the await keyword (like you would hack or sleep). wget will still work in Netscript 1.0, 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 wget in Netscript 1.0.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -34,6 +30,12 @@ True if the data was successfully retrieved from the URL, false otherwise.
|
|||||||
|
|
||||||
RAM cost: 0 GB
|
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).
|
||||||
|
|
||||||
|
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 wget in NetscriptJS (Netscript 2.0).
|
||||||
|
|
||||||
|
In NetscriptJS, you must preface any call to wget with the await keyword (like you would hack or sleep). wget will still work in Netscript 1.0, 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 wget in Netscript 1.0.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,11 +4,7 @@
|
|||||||
|
|
||||||
## NS.write() method
|
## NS.write() method
|
||||||
|
|
||||||
This function can be used to either write data to a port or to a text file (.txt).
|
Write data to a file.
|
||||||
|
|
||||||
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. 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 (.txt) and this function will write data to that text file. If the specified text file does not exist, then it will be created. The third argument mode, defines how the data will be written to the text file. 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. 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 text file.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -32,3 +28,9 @@ void
|
|||||||
|
|
||||||
RAM cost: 1 GB
|
RAM cost: 1 GB
|
||||||
|
|
||||||
|
This function can be used to either write data to a port or to a text file (.txt).
|
||||||
|
|
||||||
|
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. 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 (.txt) and this function will write data to that text file. If the specified text file does not exist, then it will be created. The third argument mode, defines how the data will be written to the text file. 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. 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 text file.
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user