mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 04:05:46 +01:00
doc
This commit is contained in:
parent
fb90e21a31
commit
f4ac7344c4
775
dist/bitburner.d.ts
vendored
775
dist/bitburner.d.ts
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -17,5 +17,5 @@ export interface BasicHGWOptions
|
|||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [stock?](./bitburner.basichgwoptions.stock.md) | boolean | <i>(Optional)</i> Set to true this action will affect the stock market. |
|
| [stock?](./bitburner.basichgwoptions.stock.md) | boolean | <i>(Optional)</i> Set to true this action will affect the stock market. |
|
||||||
| [threads](./bitburner.basichgwoptions.threads.md) | number | Number of threads to use for this function. Must be less than or equal to the number of threads the script is running with. |
|
| [threads?](./bitburner.basichgwoptions.threads.md) | number | <i>(Optional)</i> Number of threads to use for this function. Must be less than or equal to the number of threads the script is running with. |
|
||||||
|
|
||||||
|
@ -9,5 +9,5 @@ Number of threads to use for this function. Must be less than or equal to the nu
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
threads: number;
|
threads?: number;
|
||||||
```
|
```
|
||||||
|
@ -21,13 +21,25 @@ Array containing current stamina and max stamina.
|
|||||||
|
|
||||||
RAM cost: 4 GB Returns an array with two elements: \* \[Current stamina, Max stamina\]
|
RAM cost: 4 GB Returns an array with two elements: \* \[Current stamina, Max stamina\]
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
function getStaminaPercentage() {
|
function getStaminaPercentage() {
|
||||||
let res = bladeburner.getStamina();
|
var res = bladeburner.getStamina();
|
||||||
return res[0] / res[1];
|
return res[0] / res[1];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
function getStaminaPercentage() {
|
||||||
|
const [current, max] = ns.bladeburner.getStamina();
|
||||||
|
return current / max;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## CodingContract interface
|
## CodingContract interface
|
||||||
|
|
||||||
Coding Contact API
|
Coding Contract API
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ interface CorporationInfo
|
|||||||
| [issuedShares](./bitburner.corporationinfo.issuedshares.md) | number | Amount of shares issued |
|
| [issuedShares](./bitburner.corporationinfo.issuedshares.md) | number | Amount of shares issued |
|
||||||
| [name](./bitburner.corporationinfo.name.md) | string | Name of the corporation |
|
| [name](./bitburner.corporationinfo.name.md) | string | Name of the corporation |
|
||||||
| [numShares](./bitburner.corporationinfo.numshares.md) | number | Amount of share owned |
|
| [numShares](./bitburner.corporationinfo.numshares.md) | number | Amount of share owned |
|
||||||
| [public](./bitburner.corporationinfo.public.md) | boolean | Is the company is public |
|
| [public](./bitburner.corporationinfo.public.md) | boolean | Indicating if the company is public |
|
||||||
| [revenue](./bitburner.corporationinfo.revenue.md) | number | Revenue per second this cycle |
|
| [revenue](./bitburner.corporationinfo.revenue.md) | number | Revenue per second this cycle |
|
||||||
| [sharePrice](./bitburner.corporationinfo.shareprice.md) | number | Price of the shares |
|
| [sharePrice](./bitburner.corporationinfo.shareprice.md) | number | Price of the shares |
|
||||||
| [shareSaleCooldown](./bitburner.corporationinfo.sharesalecooldown.md) | number | Cooldown until shares can be sold again |
|
| [shareSaleCooldown](./bitburner.corporationinfo.sharesalecooldown.md) | number | Cooldown until shares can be sold again |
|
||||||
| [state](./bitburner.corporationinfo.state.md) | string | State of the corporation, like PRODUCTION or EXPORT |
|
| [state](./bitburner.corporationinfo.state.md) | string | State of the corporation. Possible states are START, PURCHASE, PRODUCTION, SALE, EXPORT. |
|
||||||
| [totalShares](./bitburner.corporationinfo.totalshares.md) | number | Total number of shares issues by this corporation |
|
| [totalShares](./bitburner.corporationinfo.totalshares.md) | number | Total number of shares issues by this corporation |
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## CorporationInfo.public property
|
## CorporationInfo.public property
|
||||||
|
|
||||||
Is the company is public
|
Indicating if the company is public
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## CorporationInfo.state property
|
## CorporationInfo.state property
|
||||||
|
|
||||||
State of the corporation, like PRODUCTION or EXPORT
|
State of the corporation. Possible states are START, PURCHASE, PRODUCTION, SALE, EXPORT.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangGenInfo.isHacking property
|
## GangGenInfo.isHacking property
|
||||||
|
|
||||||
Boolean indicating whether or not its a hacking gang
|
Indicating whether or not it's a hacking gang
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -17,15 +17,15 @@ export interface GangGenInfo
|
|||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [faction](./bitburner.ganggeninfo.faction.md) | string | Name of faction that the gang belongs to ("Slum Snakes", etc.) |
|
| [faction](./bitburner.ganggeninfo.faction.md) | string | Name of faction that the gang belongs to ("Slum Snakes", etc.) |
|
||||||
| [isHacking](./bitburner.ganggeninfo.ishacking.md) | boolean | Boolean indicating whether or not its a hacking gang |
|
| [isHacking](./bitburner.ganggeninfo.ishacking.md) | boolean | Indicating whether or not it's a hacking gang |
|
||||||
| [moneyGainRate](./bitburner.ganggeninfo.moneygainrate.md) | number | Money earned per game cycle |
|
| [moneyGainRate](./bitburner.ganggeninfo.moneygainrate.md) | number | Money earned per game cycle |
|
||||||
| [power](./bitburner.ganggeninfo.power.md) | number | Gang's power for territory warfare |
|
| [power](./bitburner.ganggeninfo.power.md) | number | Gang's power for territory warfare |
|
||||||
| [respect](./bitburner.ganggeninfo.respect.md) | number | Gang's respect |
|
| [respect](./bitburner.ganggeninfo.respect.md) | number | Gang's respect |
|
||||||
| [respectGainRate](./bitburner.ganggeninfo.respectgainrate.md) | number | Respect earned per game cycle |
|
| [respectGainRate](./bitburner.ganggeninfo.respectgainrate.md) | number | Respect earned per game cycle |
|
||||||
| [territory](./bitburner.ganggeninfo.territory.md) | number | Amount of territory held. |
|
| [territory](./bitburner.ganggeninfo.territory.md) | number | Amount of territory held |
|
||||||
| [territoryClashChance](./bitburner.ganggeninfo.territoryclashchance.md) | number | Clash chance. |
|
| [territoryClashChance](./bitburner.ganggeninfo.territoryclashchance.md) | number | Clash chance |
|
||||||
| [territoryWarfareEngaged](./bitburner.ganggeninfo.territorywarfareengaged.md) | boolean | Boolean indicating if territory warfare is enabled. |
|
| [territoryWarfareEngaged](./bitburner.ganggeninfo.territorywarfareengaged.md) | boolean | Indicating if territory warfare is enabled |
|
||||||
| [wantedLevel](./bitburner.ganggeninfo.wantedlevel.md) | number | Gang's wanted level |
|
| [wantedLevel](./bitburner.ganggeninfo.wantedlevel.md) | number | Gang's wanted level |
|
||||||
| [wantedLevelGainRate](./bitburner.ganggeninfo.wantedlevelgainrate.md) | number | Wanted level gained/lost per game cycle (negative for losses) |
|
| [wantedLevelGainRate](./bitburner.ganggeninfo.wantedlevelgainrate.md) | number | Wanted level gained/lost per game cycle (negative for losses) |
|
||||||
| [wantedPenalty](./bitburner.ganggeninfo.wantedpenalty.md) | number | Number indicating the current wanted penalty. |
|
| [wantedPenalty](./bitburner.ganggeninfo.wantedpenalty.md) | number | Number indicating the current wanted penalty |
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangGenInfo.territory property
|
## GangGenInfo.territory property
|
||||||
|
|
||||||
Amount of territory held.
|
Amount of territory held
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangGenInfo.territoryClashChance property
|
## GangGenInfo.territoryClashChance property
|
||||||
|
|
||||||
Clash chance.
|
Clash chance
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangGenInfo.territoryWarfareEngaged property
|
## GangGenInfo.territoryWarfareEngaged property
|
||||||
|
|
||||||
Boolean indicating if territory warfare is enabled.
|
Indicating if territory warfare is enabled
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangGenInfo.wantedPenalty property
|
## GangGenInfo.wantedPenalty property
|
||||||
|
|
||||||
Number indicating the current wanted penalty.
|
Number indicating the current wanted penalty
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangMemberAscension.agi property
|
## GangMemberAscension.agi property
|
||||||
|
|
||||||
Agility multiplier gained from ascending.
|
Agility multiplier gained from ascending
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangMemberAscension.cha property
|
## GangMemberAscension.cha property
|
||||||
|
|
||||||
Charisma multiplier gained from ascending.
|
Charisma multiplier gained from ascending
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangMemberAscension.def property
|
## GangMemberAscension.def property
|
||||||
|
|
||||||
Defense multiplier gained from ascending.
|
Defense multiplier gained from ascending
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangMemberAscension.dex property
|
## GangMemberAscension.dex property
|
||||||
|
|
||||||
Dexterity multiplier gained from ascending.
|
Dexterity multiplier gained from ascending
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangMemberAscension.hack property
|
## GangMemberAscension.hack property
|
||||||
|
|
||||||
Hacking multiplier gained from ascending.
|
Hacking multiplier gained from ascending
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ export interface GangMemberAscension
|
|||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [agi](./bitburner.gangmemberascension.agi.md) | number | Agility multiplier gained from ascending. |
|
| [agi](./bitburner.gangmemberascension.agi.md) | number | Agility multiplier gained from ascending |
|
||||||
| [cha](./bitburner.gangmemberascension.cha.md) | number | Charisma multiplier gained from ascending. |
|
| [cha](./bitburner.gangmemberascension.cha.md) | number | Charisma multiplier gained from ascending |
|
||||||
| [def](./bitburner.gangmemberascension.def.md) | number | Defense multiplier gained from ascending. |
|
| [def](./bitburner.gangmemberascension.def.md) | number | Defense multiplier gained from ascending |
|
||||||
| [dex](./bitburner.gangmemberascension.dex.md) | number | Dexterity multiplier gained from ascending. |
|
| [dex](./bitburner.gangmemberascension.dex.md) | number | Dexterity multiplier gained from ascending |
|
||||||
| [hack](./bitburner.gangmemberascension.hack.md) | number | Hacking multiplier gained from ascending. |
|
| [hack](./bitburner.gangmemberascension.hack.md) | number | Hacking multiplier gained from ascending |
|
||||||
| [respect](./bitburner.gangmemberascension.respect.md) | number | Amount of respect lost from ascending |
|
| [respect](./bitburner.gangmemberascension.respect.md) | number | Amount of respect lost from ascending |
|
||||||
| [str](./bitburner.gangmemberascension.str.md) | number | Strength multiplier gained from ascending. |
|
| [str](./bitburner.gangmemberascension.str.md) | number | Strength multiplier gained from ascending |
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## GangMemberAscension.str property
|
## GangMemberAscension.str property
|
||||||
|
|
||||||
Strength multiplier gained from ascending.
|
Strength multiplier gained from ascending
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -25,10 +25,19 @@ This function is only applicable for Hacknet Servers (the upgraded version of a
|
|||||||
|
|
||||||
Returns the list of all available hash upgrades that can be used in the spendHashes function.
|
Returns the list of all available hash upgrades that can be used in the spendHashes function.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const upgrades = hacknet.getHashUpgrades(); // ["Sell for Money","Sell for Corporation Funds",...]
|
// NS1:
|
||||||
|
var upgrades = hacknet.getHashUpgrades(); // ["Sell for Money","Sell for Corporation Funds",...]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
const upgrades = ns.hacknet.getHashUpgrades(); // ["Sell for Money","Sell for Corporation Funds",...]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -32,13 +32,25 @@ This function is only applicable for Hacknet Servers (the upgraded version of a
|
|||||||
|
|
||||||
Returns the number of hashes required for the specified upgrade. The name of the upgrade must be an exact match.
|
Returns the number of hashes required for the specified upgrade. The name of the upgrade must be an exact match.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
var upgradeName = "Sell for Corporation Funds";
|
var upgradeName = "Sell for Corporation Funds";
|
||||||
if (hacknet.numHashes() > hacknet.hashCost(upgradeName)) {
|
if (hacknet.numHashes() > hacknet.hashCost(upgradeName)) {
|
||||||
hacknet.spendHashes(upgName);
|
hacknet.spendHashes(upgName);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
const upgradeName = "Sell for Corporation Funds";
|
||||||
|
if (ns.hacknet.numHashes() > ns.hacknet.hashCost(upgradeName)) {
|
||||||
|
ns.hacknet.spendHashes(upgName);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -35,11 +35,21 @@ Spend the hashes generated by your Hacknet Servers on an upgrade. Returns a bool
|
|||||||
|
|
||||||
The name of the upgrade must be an exact match. The `upgTarget` argument is used for upgrades such as `Reduce Minimum Security`<!-- -->, which applies to a specific server. In this case, the `upgTarget` argument must be the hostname of the server.
|
The name of the upgrade must be an exact match. The `upgTarget` argument is used for upgrades such as `Reduce Minimum Security`<!-- -->, which applies to a specific server. In this case, the `upgTarget` argument must be the hostname of the server.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
hacknet.spendHashes("Sell for Corporation Funds");
|
hacknet.spendHashes("Sell for Corporation Funds");
|
||||||
hacknet.spendHashes("Increase Maximum Money", "foodnstuff");
|
hacknet.spendHashes("Increase Maximum Money", "foodnstuff");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
NS2:
|
||||||
|
ns.hacknet.spendHashes("Sell for Corporation Funds");
|
||||||
|
ns.hacknet.spendHashes("Increase Maximum Money", "foodnstuff");
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -28,10 +28,19 @@ RAM cost: 0.05 GB
|
|||||||
|
|
||||||
Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer.
|
Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
brutessh("foodnstuff");
|
brutessh("foodnstuff");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
ns.brutessh("foodnstuff");
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -30,5 +30,3 @@ 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.
|
||||||
|
|
||||||
Notable functions that cannot have their logs disabled: run, exec, exit.
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Start another script on any server.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
exec(script: string, host: string, numThreads?: number, ...args: string[]): number;
|
exec(script: string, host: string, numThreads?: number, ...args: Array<string | number | boolean>): number;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -19,7 +19,7 @@ exec(script: string, host: string, numThreads?: number, ...args: string[]): numb
|
|||||||
| script | string | Filename of script to execute. |
|
| script | string | Filename of script to execute. |
|
||||||
| host | string | Hostname of the <code>target server</code> on which to execute the script. |
|
| host | string | Hostname of the <code>target server</code> on which to execute the script. |
|
||||||
| numThreads | number | Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer. |
|
| numThreads | number | Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer. |
|
||||||
| args | string\[\] | Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the third argument numThreads must be filled in with a value. |
|
| args | Array<string \| number \| boolean> | Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the third argument numThreads must be filled in with a value. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
@ -43,23 +43,30 @@ Running this function with a numThreads argument of 0 will return 0 without runn
|
|||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run generic-hack.script on the foodnstuff server:
|
//The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run generic-hack.script on the foodnstuff server:
|
||||||
exec("generic-hack.script", "foodnstuff");
|
exec("generic-hack.script", "foodnstuff");
|
||||||
|
|
||||||
|
//The following example will try to run the script generic-hack.script on the joesguns server with 10 threads:
|
||||||
|
exec("generic-hack.script", "joesguns", 10);
|
||||||
|
|
||||||
|
//This last example will try to run the script foo.script on the foodnstuff server with 5 threads. It will also pass the number 1 and the string “test” in as arguments to the script:
|
||||||
|
exec("foo.script", "foodnstuff", 5, 1, "test");
|
||||||
```
|
```
|
||||||
|
\*
|
||||||
|
|
||||||
## Example 2
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//The simplest way to use the exec command is to call it with just the script name and the target server. The following example will try to run generic-hack.script on the foodnstuff server:
|
||||||
|
ns.exec("generic-hack.script", "foodnstuff");
|
||||||
|
|
||||||
//The following example will try to run the script generic-hack.script on the joesguns server with 10 threads:
|
//The following example will try to run the script generic-hack.script on the joesguns server with 10 threads:
|
||||||
exec("generic-hack.script", "joesguns", 10);
|
ns.exec("generic-hack.script", "joesguns", 10);
|
||||||
```
|
|
||||||
|
|
||||||
## Example 3
|
|
||||||
|
|
||||||
|
|
||||||
```ts
|
|
||||||
//This last example will try to run the script foo.script on the foodnstuff server with 5 threads. It will also pass the number 1 and the string “test” in as arguments to the script:
|
//This last example will try to run the script foo.script on the foodnstuff server with 5 threads. It will also pass the number 1 and the string “test” in as arguments to the script:
|
||||||
exec("foo.script", "foodnstuff", 5, 1, "test");
|
ns.exec("foo.script", "foodnstuff", 5, 1, "test");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -37,15 +37,24 @@ If the hostname/ip argument is omitted, then the function will search through th
|
|||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//The function call will return true if the script named foo.script exists on the foodnstuff server, and false otherwise.
|
//The function call will return true if the script named foo.script exists on the foodnstuff server, and false otherwise.
|
||||||
fileExists("foo.script", "foodnstuff");
|
fileExists("foo.script", "foodnstuff");
|
||||||
|
|
||||||
|
//The function call will return true if the current server contains the FTPCrack.exe program, and false otherwise.
|
||||||
|
fileExists("ftpcrack.exe");
|
||||||
```
|
```
|
||||||
|
\*
|
||||||
|
|
||||||
## Example 2
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
//The function call will return true if the current server contains the FTPCrack.exe program, and false otherwise.
|
// NS2:
|
||||||
fileExists("ftpcrack.exe");
|
// The function call will return true if the script named foo.script exists on the foodnstuff server, and false otherwise.
|
||||||
|
ns.fileExists("foo.script", "foodnstuff");
|
||||||
|
|
||||||
|
// The function call will return true if the current server contains the FTPCrack.exe program, and false otherwise.
|
||||||
|
ns.fileExists("ftpcrack.exe");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -41,6 +41,17 @@ var data = flags([
|
|||||||
]);
|
]);
|
||||||
tprint(data);
|
tprint(data);
|
||||||
|
|
||||||
|
// example.ns
|
||||||
|
export async function main(ns) {
|
||||||
|
const data = ns.flags([
|
||||||
|
['delay', 0], // a default number means this flag is a number
|
||||||
|
['server', 'foodnstuff'], // a default string means this flag is a string
|
||||||
|
['exclude', []], // a default array means this flag is a default array of string
|
||||||
|
['help', false], // a default boolean means this flag is a boolean
|
||||||
|
]);
|
||||||
|
ns.tprint(data);
|
||||||
|
}
|
||||||
|
|
||||||
// [home ~/]> run example.script
|
// [home ~/]> run example.script
|
||||||
// {"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":false}
|
// {"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":false}
|
||||||
// [home ~/]> run example.script --delay 3000
|
// [home ~/]> run example.script --delay 3000
|
||||||
|
@ -28,10 +28,19 @@ RAM cost: 0.05 GB
|
|||||||
|
|
||||||
Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer.
|
Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
ftpcrack("foodnstuff");
|
ftpcrack("foodnstuff");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
ns.ftpcrack("foodnstuff");
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -21,16 +21,27 @@ 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).
|
Returns an object containing the current BitNode multipliers. This function requires you to be in Bitnode 5 or have 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.
|
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 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
mults = getBitNodeMultipliers();
|
// NS1:
|
||||||
|
var mults = getBitNodeMultipliers();
|
||||||
print(mults.ServerMaxMoney);
|
print(mults.ServerMaxMoney);
|
||||||
print(mults.HackExpGain);
|
print(mults.HackExpGain);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
const {ServerMaxMoney, HackExpGain} = ns.getBitNodeMultipliers();
|
||||||
|
print(ServerMaxMoney);
|
||||||
|
print(HackExpGain);
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -28,5 +28,5 @@ Returns the amount of time in milliseconds it takes to execute the grow Netscrip
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB
|
||||||
|
|
||||||
Returns the amount of time in milliseconds it takes to execute the grow Netscript function on the target server.
|
Returns the amount of time in milliseconds 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. The required time is increased by the security level of the target server and decreased by the player's hacking level.
|
||||||
|
|
||||||
|
@ -23,13 +23,25 @@ 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%).
|
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 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
//Example of how this can be used:
|
// NS1:
|
||||||
mults = getHackingMultipliers();
|
// Example of how this can be used:
|
||||||
|
var mults = getHackingMultipliers();
|
||||||
print(mults.chance);
|
print(mults.chance);
|
||||||
print(mults.growth);
|
print(mults.growth);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
// Example of how this can be used:
|
||||||
|
const {chance, growth} = ns.getHackingMultipliers();
|
||||||
|
print(chance);
|
||||||
|
print(growth);
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -23,13 +23,25 @@ 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%).
|
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 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
//Example of how this can be used:
|
// NS1:
|
||||||
mults = getHacknetMultipliers();
|
// Example of how this can be used:
|
||||||
|
var mults = getHacknetMultipliers();
|
||||||
print(mults.production);
|
print(mults.production);
|
||||||
print(mults.purchaseCost);
|
print(mults.purchaseCost);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
// Example of how this can be used:
|
||||||
|
const {production, purchaseCost} = ns.getHacknetMultipliers();
|
||||||
|
print(production);
|
||||||
|
print(purchaseCost);
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -26,7 +26,5 @@ Returns the amount of time in milliseconds it takes to execute the hack Netscrip
|
|||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB When `hack` completes an amount of money is stolen depending on the player's skills. 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. The required time is increased by the security level of the target server and decreased by the player's hacking level.
|
||||||
|
|
||||||
Returns the amount of time in milliseconds it takes to execute the hack Netscript function on the target server.
|
|
||||||
|
|
||||||
|
@ -17,3 +17,9 @@ getPlayer(): Player;
|
|||||||
|
|
||||||
Player info
|
Player info
|
||||||
|
|
||||||
|
## Remarks
|
||||||
|
|
||||||
|
RAM cost: 0.5 GB
|
||||||
|
|
||||||
|
Returns an object with information on the current player.
|
||||||
|
|
||||||
|
@ -30,12 +30,23 @@ RAM cost: 0.25 GB
|
|||||||
|
|
||||||
Returns the cost to purchase a server with the specified amount of ram.
|
Returns the cost to purchase a server with the specified amount of ram.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
for (i = 1; i <= 20; i++) {
|
for (i = 1; i <= 20; i++) {
|
||||||
tprint(i + " -- " + getPurchasedServerCost(Math.pow(2, i)));
|
tprint(i + " -- " + getPurchasedServerCost(Math.pow(2, i)));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
for (i = 1; i <= 20; i++) {
|
||||||
|
ns.tprint(i + " -- " + ns.getPurchasedServerCost(Math.pow(2, i)));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Get general info about a running script.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
getRunningScript(filename: string | number, hostname: string, ...args: (string | number)[]): RunningScript;
|
getRunningScript(filename?: string | number, hostname?: string, ...args: (string | number)[]): RunningScript;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -30,3 +30,5 @@ info about a running script
|
|||||||
|
|
||||||
RAM cost: 0.3 GB
|
RAM cost: 0.3 GB
|
||||||
|
|
||||||
|
Running with no args returns curent script.
|
||||||
|
|
||||||
|
@ -9,17 +9,8 @@ Get the exp gain of a script.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
getScriptExpGain(script: string, host: string, ...args: string[]): number;
|
getScriptExpGain(): number;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| script | string | Filename of script. |
|
|
||||||
| host | string | Server on which script is running. |
|
|
||||||
| args | string\[\] | Arguments that the script is running with. |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
number
|
number
|
||||||
|
24
markdown/bitburner.ns.getscriptexpgain_1.md
Normal file
24
markdown/bitburner.ns.getscriptexpgain_1.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getScriptExpGain](./bitburner.ns.getscriptexpgain_1.md)
|
||||||
|
|
||||||
|
## NS.getScriptExpGain() method
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
getScriptExpGain(script: string, host: string, ...args: string[]): number;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| script | string | |
|
||||||
|
| host | string | |
|
||||||
|
| args | string\[\] | |
|
||||||
|
|
||||||
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
number
|
||||||
|
|
@ -9,20 +9,11 @@ Get the income of a script.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
getScriptIncome(script: string, host: string, ...args: string[]): number | [number, number];
|
getScriptIncome(): [number, number];
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| script | string | Filename of script. |
|
|
||||||
| host | string | Server on which script is running. |
|
|
||||||
| args | string\[\] | Arguments that the script is running with. |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
number \| \[number, number\]
|
\[number, number\]
|
||||||
|
|
||||||
Amount of income the specified script generates while online.
|
Amount of income the specified script generates while online.
|
||||||
|
|
||||||
|
24
markdown/bitburner.ns.getscriptincome_1.md
Normal file
24
markdown/bitburner.ns.getscriptincome_1.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [getScriptIncome](./bitburner.ns.getscriptincome_1.md)
|
||||||
|
|
||||||
|
## NS.getScriptIncome() method
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
getScriptIncome(script: string, host: string, ...args: string[]): number;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| script | string | |
|
||||||
|
| host | string | |
|
||||||
|
| args | string\[\] | |
|
||||||
|
|
||||||
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
number
|
||||||
|
|
@ -38,23 +38,29 @@ Otherwise, the fn, hostname/ip, and args… arguments can be used to get the log
|
|||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//Get logs from foo.script on the current server that was run with no args
|
//Get logs from foo.script on the current server that was run with no args
|
||||||
getScriptLogs("foo.script");
|
getScriptLogs("foo.script");
|
||||||
|
|
||||||
|
//Open logs from foo.script on the foodnstuff server that was run with no args
|
||||||
|
getScriptLogs("foo.script", "foodnstuff");
|
||||||
|
|
||||||
|
//Open logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
|
||||||
|
getScriptLogs("foo.script", "foodnstuff", 1, "test");
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example 2
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//Get logs from foo.script on the current server that was run with no args
|
||||||
|
ns.getScriptLogs("foo.script");
|
||||||
|
|
||||||
//Open logs from foo.script on the foodnstuff server that was run with no args
|
//Open logs from foo.script on the foodnstuff server that was run with no args
|
||||||
getScriptLogs("foo.script", "foodnstuff");
|
ns.getScriptLogs("foo.script", "foodnstuff");
|
||||||
```
|
|
||||||
|
|
||||||
## Example 3
|
|
||||||
|
|
||||||
|
|
||||||
```ts
|
|
||||||
//Open logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
|
//Open logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
|
||||||
getScriptLogs("foo.script", "foodnstuff", 1, "test");
|
ns.getScriptLogs("foo.script", "foodnstuff", 1, "test");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -30,11 +30,21 @@ 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.
|
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
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
getServerMoneyAvailable("foodnstuff");
|
getServerMoneyAvailable("foodnstuff");
|
||||||
getServerMoneyAvailable("home"); //Returns player's money
|
getServerMoneyAvailable("home"); //Returns player's money
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
ns.getServerMoneyAvailable("foodnstuff");
|
||||||
|
ns.getServerMoneyAvailable("home"); // Returns player's money
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -33,12 +33,21 @@ RAM cost: 0.1 GB
|
|||||||
|
|
||||||
Returns an array with two elements that gives information about a server’s memory (RAM). The first element in the array is the amount of RAM that the server has total (in GB). The second element in the array is the amount of RAM that is currently being used on the server (in GB).
|
Returns an array with two elements that gives information about a server’s memory (RAM). The first element in the array is the amount of RAM that the server has total (in GB). The second element in the array is the amount of RAM that is currently being used on the server (in GB).
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
res = getServerRam("helios");
|
// NS1:
|
||||||
totalRam = res[0];
|
var serverRam = getServerRam("helios");
|
||||||
ramUsed = res[1];
|
var totalRam = serverRam[0];
|
||||||
|
var ramUsed = serverRam[1];
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
const [totalRam, ramUsed] = ns.getServerRam("helios");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -22,11 +22,11 @@ getWeakenTime(host: string): number;
|
|||||||
|
|
||||||
number
|
number
|
||||||
|
|
||||||
Returns the amount of time in milliseconds it takes to execute the weaken() Netscript function on the target server. Returns Infinity if called on a Hacknet Server.
|
Returns the amount of time in milliseconds it takes to execute the weaken 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 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. The required time is increased by the security level of the target server and decreased by the player's hacking level.
|
||||||
|
|
||||||
|
@ -33,11 +33,23 @@ Use your hacking skills to increase the amount of money available on a server. T
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
grow("foodnstuff");
|
// NS1:
|
||||||
grow("foodnstuff", { threads: 5 }); // Only use 5 threads to grow
|
var availableMoney = getServerMoneyAvailable("foodnstuff");
|
||||||
|
currentMoney = currentMoney * (1 + grow("foodnstuff"));
|
||||||
|
currentMoney = currentMoney * (1 + grow("foodnstuff", { threads: 5 })); // Only use 5 threads to grow
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
let availableMoney = ns.getServerMoneyAvailable("foodnstuff");
|
||||||
|
currentMoney *= (1 + await ns.grow("foodnstuff"));
|
||||||
|
currentMoney *= (1 + await ns.grow("foodnstuff", { threads: 5 })); // Only use 5 threads to grow
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -34,12 +34,23 @@ This function returns the number of “growths” needed in order to increase th
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//For example, if you want to determine how many grow calls you need to double the amount of money on foodnstuff, you would use:
|
//For example, if you want to determine how many grow calls you need to double the amount of money on foodnstuff, you would use:
|
||||||
growthAnalyze("foodnstuff", 2);
|
var growTimes = growthAnalyze("foodnstuff", 2);
|
||||||
|
//If this returns 100, then this means you need to call grow 100 times in order to double the money (or once with 100 threads).
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//For example, if you want to determine how many grow calls you need to double the amount of money on foodnstuff, you would use:
|
||||||
|
const growTimes = ns.growthAnalyze("foodnstuff", 2);
|
||||||
//If this returns 100, then this means you need to call grow 100 times in order to double the money (or once with 100 threads).
|
//If this returns 100, then this means you need to call grow 100 times in order to double the money (or once with 100 threads).
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -29,17 +29,27 @@ The amount of money stolen if the hack is successful, and zero otherwise.
|
|||||||
|
|
||||||
RAM cost: 0.1 GB
|
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.
|
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 when this function is called. 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.
|
||||||
|
|
||||||
A successful `hack()` on a server will raise that server’s security level by 0.002.
|
A successful `hack()` on a server will raise that server’s security level by 0.002.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
hack("foodnstuff");
|
// NS1:
|
||||||
hack("foodnstuff", { threads: 5 }); // Only use 5 threads to hack
|
var earnedMoney = hack("foodnstuff");
|
||||||
|
earnedMoney = earnedMoney + hack("foodnstuff", { threads: 5 }); // Only use 5 threads to hack
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
let earnedMoney = await ns.hack("foodnstuff");
|
||||||
|
earnedMoney += await ns.hack("foodnstuff", { threads: 5 }); // Only use 5 threads to hack
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -30,12 +30,23 @@ RAM cost: 1 GB
|
|||||||
|
|
||||||
Returns the part of the specified server’s money you will steal with a single thread hack.
|
Returns the part of the specified server’s money you will steal with a single thread hack.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//For example, assume the following returns 0.01:
|
//For example, assume the following returns 0.01:
|
||||||
hackAnalyze("foodnstuff");
|
var hackAmount = hackAnalyze("foodnstuff");
|
||||||
|
//This means that if hack the foodnstuff server using a single thread, then you will steal 1%, or 0.01 of its total money. If you hack using N threads, then you will steal N*0.01 times its total money.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//For example, assume the following returns 0.01:
|
||||||
|
const hackAmount = ns.hackAnalyze("foodnstuff");
|
||||||
//This means that if hack the foodnstuff server using a single thread, then you will steal 1%, or 0.01 of its total money. If you hack using N threads, then you will steal N*0.01 times its total money.
|
//This means that if hack the foodnstuff server using a single thread, then you will steal 1%, or 0.01 of its total money. If you hack using N threads, then you will steal N*0.01 times its total money.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -30,12 +30,23 @@ RAM cost: 0.05 GB
|
|||||||
|
|
||||||
Returns a boolean indicating whether or not the player has root access to the specified target server.
|
Returns a boolean indicating whether or not the player has root access to the specified target server.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
if (hasRootAccess("foodnstuff") == false) {
|
if (hasRootAccess("foodnstuff") == false) {
|
||||||
nuke("foodnstuff");
|
nuke("foodnstuff");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
if (ns.hasRootAccess("foodnstuff") == false) {
|
||||||
|
ns.nuke("foodnstuff");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -28,10 +28,19 @@ RAM cost: 0.05 GB
|
|||||||
|
|
||||||
Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer.
|
Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
httpworm("foodnstuff");
|
httpworm("foodnstuff");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
ns.httpworm("foodnstuff");
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -36,23 +36,29 @@ Returns a boolean indicating whether the specified script is running on the targ
|
|||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//The function call will return true if there is a script named foo.script with no arguments running on the foodnstuff server, and false otherwise:
|
//The function call will return true if there is a script named foo.script with no arguments running on the foodnstuff server, and false otherwise:
|
||||||
isRunning("foo.script", "foodnstuff");
|
isRunning("foo.script", "foodnstuff");
|
||||||
|
|
||||||
|
//The function call will return true if there is a script named foo.script with no arguments running on the current server, and false otherwise:
|
||||||
|
isRunning("foo.script", getHostname());
|
||||||
|
|
||||||
|
//The function call will return true if there is a script named foo.script running with the arguments 1, 5, and “test” (in that order) on the joesguns server, and false otherwise:
|
||||||
|
isRunning("foo.script", "joesguns", 1, 5, "test");
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example 2
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//The function call will return true if there is a script named foo.script with no arguments running on the foodnstuff server, and false otherwise:
|
||||||
|
ns.isRunning("foo.script", "foodnstuff");
|
||||||
|
|
||||||
//The function call will return true if there is a script named foo.script with no arguments running on the current server, and false otherwise:
|
//The function call will return true if there is a script named foo.script with no arguments running on the current server, and false otherwise:
|
||||||
isRunning("foo.script", getHostname());
|
ns.isRunning("foo.script", ns.getHostname());
|
||||||
```
|
|
||||||
|
|
||||||
## Example 3
|
|
||||||
|
|
||||||
|
|
||||||
```ts
|
|
||||||
//The function call will return true if there is a script named foo.script running with the arguments 1, 5, and “test” (in that order) on the joesguns server, and false otherwise:
|
//The function call will return true if there is a script named foo.script running with the arguments 1, 5, and “test” (in that order) on the joesguns server, and false otherwise:
|
||||||
isRunning("foo.script", "joesguns", 1, 5, "test");
|
ns.isRunning("foo.script", "joesguns", 1, 5, "test");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -9,16 +9,14 @@ Terminate another script.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
kill(script: string | number, host: string, ...args: string[]): boolean;
|
kill(script: number): boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| script | string \| number | Filename or pid of the script to kill |
|
| script | number | Filename or pid of the script to kill |
|
||||||
| host | string | Hostname of the server on which to kill the script. |
|
|
||||||
| args | string\[\] | Arguments to identify which script to kill. |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
@ -36,23 +34,29 @@ Kills the script on the target server specified by the script’s name and argum
|
|||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
|
//The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
|
||||||
kill("foo.script", "foodnstuff");
|
kill("foo.script", "foodnstuff");
|
||||||
|
|
||||||
|
//The following will try to kill a script named foo.script on the current server that was ran with no arguments:
|
||||||
|
kill("foo.script", getHostname());
|
||||||
|
|
||||||
|
//The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
|
||||||
|
kill("foo.script", getHostname(), 1, "foodnstuff");
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example 2
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
|
||||||
|
ns.kill("foo.script", "foodnstuff");
|
||||||
|
|
||||||
//The following will try to kill a script named foo.script on the current server that was ran with no arguments:
|
//The following will try to kill a script named foo.script on the current server that was ran with no arguments:
|
||||||
kill("foo.script", getHostname());
|
ns.kill("foo.script", getHostname());
|
||||||
```
|
|
||||||
|
|
||||||
## Example 3
|
|
||||||
|
|
||||||
|
|
||||||
```ts
|
|
||||||
//The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
|
//The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
|
||||||
kill("foo.script", getHostname(), 1, "foodnstuff");
|
ns.kill("foo.script", getHostname(), 1, "foodnstuff");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
24
markdown/bitburner.ns.kill_1.md
Normal file
24
markdown/bitburner.ns.kill_1.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [kill](./bitburner.ns.kill_1.md)
|
||||||
|
|
||||||
|
## NS.kill() method
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
kill(script: string, host: string, ...args: string[]): boolean;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| script | string | |
|
||||||
|
| host | string | |
|
||||||
|
| args | string\[\] | |
|
||||||
|
|
||||||
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
boolean
|
||||||
|
|
@ -9,7 +9,7 @@ Terminate all scripts on a server.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
killall(host: string): boolean;
|
killall(host?: string): boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -28,5 +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.
|
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. If no host is defined, it will kill all scripts, where the script is running.
|
||||||
|
|
||||||
|
@ -88,8 +88,10 @@ export async function main(ns) {
|
|||||||
| [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()](./bitburner.ns.getpurchasedservers.md) | Returns an array with the hostnames of all of the servers you have purchased. |
|
| [getPurchasedServers()](./bitburner.ns.getpurchasedservers.md) | Returns an array with the hostnames of all of the servers you have purchased. |
|
||||||
| [getRunningScript(filename, hostname, args)](./bitburner.ns.getrunningscript.md) | Get general info about a running script. |
|
| [getRunningScript(filename, hostname, args)](./bitburner.ns.getrunningscript.md) | Get general info about a running script. |
|
||||||
| [getScriptExpGain(script, host, args)](./bitburner.ns.getscriptexpgain.md) | Get the exp gain of a script. |
|
| [getScriptExpGain()](./bitburner.ns.getscriptexpgain.md) | Get the exp gain of a script. |
|
||||||
| [getScriptIncome(script, host, args)](./bitburner.ns.getscriptincome.md) | Get the income of a script. |
|
| [getScriptExpGain(script, host, args)](./bitburner.ns.getscriptexpgain_1.md) | |
|
||||||
|
| [getScriptIncome()](./bitburner.ns.getscriptincome.md) | Get the income of a script. |
|
||||||
|
| [getScriptIncome(script, host, args)](./bitburner.ns.getscriptincome_1.md) | |
|
||||||
| [getScriptLogs(fn, host, args)](./bitburner.ns.getscriptlogs.md) | Get all the logs of a script. |
|
| [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) | Get the ram cost of a script. |
|
| [getScriptRam(script, host)](./bitburner.ns.getscriptram.md) | Get the ram cost of a script. |
|
||||||
@ -119,13 +121,14 @@ export async function main(ns) {
|
|||||||
| [httpworm(host)](./bitburner.ns.httpworm.md) | Runs HTTPWorm.exe on a server. |
|
| [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) | Check if a script is running. |
|
| [isRunning(script, host, args)](./bitburner.ns.isrunning.md) | Check if a script is running. |
|
||||||
| [kill(script, host, args)](./bitburner.ns.kill.md) | Terminate another script. |
|
| [kill(script)](./bitburner.ns.kill.md) | Terminate another script. |
|
||||||
|
| [kill(script, host, args)](./bitburner.ns.kill_1.md) | |
|
||||||
| [killall(host)](./bitburner.ns.killall.md) | Terminate all scripts on a server. |
|
| [killall(host)](./bitburner.ns.killall.md) | Terminate all scripts on a server. |
|
||||||
| [ls(host, grep)](./bitburner.ns.ls.md) | List files on a server. |
|
| [ls(host, grep)](./bitburner.ns.ls.md) | List files on a server. |
|
||||||
| [nFormat(n, format)](./bitburner.ns.nformat.md) | Format a number |
|
| [nFormat(n, format)](./bitburner.ns.nformat.md) | Format a number |
|
||||||
| [nuke(host)](./bitburner.ns.nuke.md) | Runs NUKE.exe on a server. |
|
| [nuke(host)](./bitburner.ns.nuke.md) | Runs NUKE.exe on a server. |
|
||||||
| [peek(port)](./bitburner.ns.peek.md) | Get a copy of the data from a port without popping it. |
|
| [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(args)](./bitburner.ns.print.md) | Prints one or move values or variables to the script’s logs. |
|
||||||
| [prompt(txt)](./bitburner.ns.prompt.md) | Prompt the player with a Yes/No modal. |
|
| [prompt(txt)](./bitburner.ns.prompt.md) | Prompt the player with a Yes/No modal. |
|
||||||
| [ps(host)](./bitburner.ns.ps.md) | List running scripts on a server. |
|
| [ps(host)](./bitburner.ns.ps.md) | List running scripts on a server. |
|
||||||
| [purchaseServer(hostname, ram)](./bitburner.ns.purchaseserver.md) | Purchase a server. |
|
| [purchaseServer(hostname, ram)](./bitburner.ns.purchaseserver.md) | Purchase a server. |
|
||||||
@ -134,7 +137,7 @@ export async function main(ns) {
|
|||||||
| [relaysmtp(host)](./bitburner.ns.relaysmtp.md) | Runs relaySMTP.exe on a server. |
|
| [relaysmtp(host)](./bitburner.ns.relaysmtp.md) | Runs relaySMTP.exe on a server. |
|
||||||
| [rm(name, host)](./bitburner.ns.rm.md) | Delete a file. |
|
| [rm(name, host)](./bitburner.ns.rm.md) | Delete a file. |
|
||||||
| [run(script, numThreads, args)](./bitburner.ns.run.md) | Start another script on the current server. |
|
| [run(script, numThreads, args)](./bitburner.ns.run.md) | Start another script on the current server. |
|
||||||
| [scan(host)](./bitburner.ns.scan.md) | Get the list servers connected to a server. |
|
| [scan(host)](./bitburner.ns.scan.md) | Get the list of servers connected to a server. |
|
||||||
| [scp(files, source, destination)](./bitburner.ns.scp.md) | Copy file between servers. |
|
| [scp(files, source, destination)](./bitburner.ns.scp.md) | Copy file between servers. |
|
||||||
| [scriptKill(script, host)](./bitburner.ns.scriptkill.md) | Kill all scripts with a filename. |
|
| [scriptKill(script, host)](./bitburner.ns.scriptkill.md) | Kill all scripts with a filename. |
|
||||||
| [scriptRunning(script, host)](./bitburner.ns.scriptrunning.md) | Check if any script with a filename is running. |
|
| [scriptRunning(script, host)](./bitburner.ns.scriptrunning.md) | Check if any script with a filename is running. |
|
||||||
@ -145,8 +148,8 @@ export async function main(ns) {
|
|||||||
| [sqlinject(host)](./bitburner.ns.sqlinject.md) | Runs SQLInject.exe on a server. |
|
| [sqlinject(host)](./bitburner.ns.sqlinject.md) | Runs SQLInject.exe on a server. |
|
||||||
| [tail(fn, host, args)](./bitburner.ns.tail.md) | Open the tail window of a script. |
|
| [tail(fn, host, args)](./bitburner.ns.tail.md) | Open the tail window of a script. |
|
||||||
| [tFormat(milliseconds, milliPrecision)](./bitburner.ns.tformat.md) | Format time to readable string |
|
| [tFormat(milliseconds, milliPrecision)](./bitburner.ns.tformat.md) | Format time to readable string |
|
||||||
| [toast(msg, variant)](./bitburner.ns.toast.md) | Queue a toast (bottom-right notification). |
|
| [toast(msg, variant, duration)](./bitburner.ns.toast.md) | Queue a toast (bottom-right notification). |
|
||||||
| [tprint(msg)](./bitburner.ns.tprint.md) | Prints a value or a variable to the Terminal. |
|
| [tprint(args)](./bitburner.ns.tprint.md) | Prints one or more values or variables to the Terminal. |
|
||||||
| [tprintf(format, values)](./bitburner.ns.tprintf.md) | Prints a raw value or a variable to the Terminal. |
|
| [tprintf(format, values)](./bitburner.ns.tprintf.md) | Prints a raw value or a variable to the Terminal. |
|
||||||
| [tryWritePort(port, data)](./bitburner.ns.trywriteport.md) | Attempt to write to a port. |
|
| [tryWritePort(port, data)](./bitburner.ns.trywriteport.md) | Attempt to write to a port. |
|
||||||
| [vsprintf(format, args)](./bitburner.ns.vsprintf.md) | Format a string with an array of arguments. |
|
| [vsprintf(format, args)](./bitburner.ns.vsprintf.md) | Format a string with an array of arguments. |
|
||||||
|
@ -9,7 +9,7 @@ Format a number
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
nFormat(n: number, format: string): number;
|
nFormat(n: number, format: string): string;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -21,7 +21,7 @@ nFormat(n: number, format: string): number;
|
|||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
number
|
string
|
||||||
|
|
||||||
Formated number.
|
Formated number.
|
||||||
|
|
||||||
|
@ -26,12 +26,21 @@ 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.
|
Running NUKE.exe on a target server gives you root access which means you can executes scripts on said server. NUKE.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
nuke("foodnstuff");
|
nuke("foodnstuff");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
ns.nuke("foodnstuff");
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -4,19 +4,19 @@
|
|||||||
|
|
||||||
## NS.print() method
|
## NS.print() method
|
||||||
|
|
||||||
Prints a value or a variable to the script’s logs.
|
Prints one or move values or variables to the script’s logs.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
print(msg: any): void;
|
print(...args: any[]): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| msg | any | Value to be printed. |
|
| args | any\[\] | Value(s) to be printed. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
@ -30,17 +30,27 @@ RAM cost: 0.2 GB
|
|||||||
|
|
||||||
Returns an array with general information about all scripts running on the specified target server.
|
Returns an array with general information about all scripts running on the specified target server.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
//(using NetscriptJS (Netscript 2.0))
|
// NS1:
|
||||||
export async function main(ns) {
|
const scripts = ps("home");
|
||||||
const ps = ns.ps("home");
|
for (let i = 0; i < scripts.length; ++i) {
|
||||||
for (let i = 0; i < ps.length; ++i) {
|
tprint(scripts[i].filename + ' ' + scripts[i].threads);
|
||||||
ns.tprint(ps[i].filename + ' ' + ps[i].threads);
|
tprint(scripts[i].args);
|
||||||
ns.tprint(ps[i].args);
|
}
|
||||||
}
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
const ps = ns.ps("home");
|
||||||
|
for (script of ps) {
|
||||||
|
ns.tprint(`${script.filename} ${ps[i].threads}`);
|
||||||
|
ns.tprint(script.args);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -31,20 +31,33 @@ The hostname of the newly purchased server.
|
|||||||
|
|
||||||
Purchased a server with the specified hostname and amount of RAM.
|
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, 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.
|
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 number of servers you can purchase.
|
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.
|
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 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
ram = 64;
|
// NS1:
|
||||||
hn = "pserv-";
|
var ram = 64;
|
||||||
|
var prefix = "pserv-";
|
||||||
for (i = 0; i < 5; ++i) {
|
for (i = 0; i < 5; ++i) {
|
||||||
purchaseServer(hn + i, ram);
|
purchaseServer(prefix + i, ram);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
const ram = 64;
|
||||||
|
const prefix = "pserv-";
|
||||||
|
for (i = 0; i < 5; ++i) {
|
||||||
|
ns.purchaseServer(prefix + i, ram);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -28,10 +28,19 @@ RAM cost: 0.05 GB
|
|||||||
|
|
||||||
Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer.
|
Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
relaysmtp("foodnstuff");
|
relaysmtp("foodnstuff");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
ns.relaysmtp("foodnstuff");
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ run(script: string, numThreads?: number, ...args: Array<string | number | boolea
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| script | string | Filename of script to run. |
|
| script | string | Filename of script to run. |
|
||||||
| numThreads | number | Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer. |
|
| numThreads | number | Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer. |
|
||||||
| args | Array<string | number | boolean> | Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the second argument numThreads must be filled in with a value. |
|
| args | Array<string \| number \| boolean> | Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the second argument numThreads must be filled in with a value. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
@ -42,23 +42,29 @@ Running this function with a numThreads argument of 0 will return 0 without runn
|
|||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//The simplest way to use the run command is to call it with just the script name. The following example will run ‘foo.script’ single-threaded with no arguments:
|
//The simplest way to use the run command is to call it with just the script name. The following example will run ‘foo.script’ single-threaded with no arguments:
|
||||||
run("foo.script");
|
run("foo.script");
|
||||||
|
|
||||||
|
//The following example will run ‘foo.script’ but with 5 threads instead of single-threaded:
|
||||||
|
run("foo.script", 5);
|
||||||
|
|
||||||
|
//This next example will run ‘foo.script’ single-threaded, and will pass the string ‘foodnstuff’ into the script as an argument:
|
||||||
|
run("foo.script", 1, 'foodnstuff');
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example 2
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//The simplest way to use the run command is to call it with just the script name. The following example will run ‘foo.script’ single-threaded with no arguments:
|
||||||
|
ns.run("foo.script");
|
||||||
|
|
||||||
//The following example will run ‘foo.script’ but with 5 threads instead of single-threaded:
|
//The following example will run ‘foo.script’ but with 5 threads instead of single-threaded:
|
||||||
run("foo.script", 5);
|
ns.run("foo.script", 5);
|
||||||
```
|
|
||||||
|
|
||||||
## Example 3
|
|
||||||
|
|
||||||
|
|
||||||
```ts
|
|
||||||
//This next example will run ‘foo.script’ single-threaded, and will pass the string ‘foodnstuff’ into the script as an argument:
|
//This next example will run ‘foo.script’ single-threaded, and will pass the string ‘foodnstuff’ into the script as an argument:
|
||||||
run("foo.script", 1, 'foodnstuff');
|
ns.run("foo.script", 1, 'foodnstuff');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NS.scan() method
|
## NS.scan() method
|
||||||
|
|
||||||
Get the list servers connected to a server.
|
Get the list of servers connected to a server.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ scan(host?: string): string[];
|
|||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| host | string | Hostname of the server to scan. |
|
| host | string | Optional, Hostname of the server to scan, default to current server. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
@ -36,16 +36,35 @@ Copies a script or literature (.lit) file(s) to another server. The files argume
|
|||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//Copies foo.lit from the helios server to the home computer:
|
//Copies foo.lit from the helios server to the home computer:
|
||||||
scp("foo.lit", "helios", "home");
|
scp("foo.lit", "helios", "home");
|
||||||
|
|
||||||
|
//Tries to copy three files from rothman-uni to home computer:
|
||||||
|
files = ["foo1.lit", "foo2.script", "foo3.script"];
|
||||||
|
scp(files, "rothman-uni", "home");
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example 2
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//Copies foo.lit from the helios server to the home computer:
|
||||||
|
await ns.scp("foo.lit", "helios", "home");
|
||||||
|
|
||||||
//Tries to copy three files from rothman-uni to home computer:
|
//Tries to copy three files from rothman-uni to home computer:
|
||||||
files = ["foo1.lit", "foo2.script", "foo3.script"];
|
files = ["foo1.lit", "foo2.script", "foo3.script"];
|
||||||
scp(files, "rothman-uni", "home");
|
await ns.scp(files, "rothman-uni", "home");
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 3
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
//ns2, copies files from home to a target server
|
||||||
|
const server = ns.args[0];
|
||||||
|
const files = ["hack.js","weaken.js","grow.js"];
|
||||||
|
await ns.scp(files, "home", server);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -37,15 +37,24 @@ This is different than the isRunning function because it does not try to identif
|
|||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//The function call will return true if there is any script named foo.script running on the foodnstuff server, and false otherwise:
|
//The function call will return true if there is any script named foo.script running on the foodnstuff server, and false otherwise:
|
||||||
scriptRunning("foo.script", "foodnstuff");
|
scriptRunning("foo.script", "foodnstuff");
|
||||||
|
|
||||||
|
//The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise:
|
||||||
|
scriptRunning("foo.script", getHostname());
|
||||||
```
|
```
|
||||||
|
\*
|
||||||
|
|
||||||
## Example 2
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//The function call will return true if there is any script named foo.script running on the foodnstuff server, and false otherwise:
|
||||||
|
ns.scriptRunning("foo.script", "foodnstuff");
|
||||||
|
|
||||||
//The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise:
|
//The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise:
|
||||||
scriptRunning("foo.script", getHostname());
|
ns.scriptRunning("foo.script", ns.getHostname());
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -27,3 +27,27 @@ Promise<void>
|
|||||||
|
|
||||||
RAM cost: 0 GB
|
RAM cost: 0 GB
|
||||||
|
|
||||||
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS1:
|
||||||
|
// This will count from 1 to 10 in your terminal, with one number every 5 seconds
|
||||||
|
for (var i=0; i<10; i++) {
|
||||||
|
tprint(i + 1);
|
||||||
|
sleep(5000);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
// This will count from 1 to 10 in your terminal, with one number every 5 seconds
|
||||||
|
for (var i=0; i<10; i++) {
|
||||||
|
ns.tprint(i + 1);
|
||||||
|
await ns.sleep(5000);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -32,11 +32,21 @@ Terminates the current script, and then after a delay of about 10 seconds it wil
|
|||||||
|
|
||||||
Because this function immediately terminates the script, it does not have a return value.
|
Because this function immediately terminates the script, it does not have a return value.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//The following example will execute the script ‘foo.script’ with 10 threads and the arguments ‘foodnstuff’ and 90:
|
//The following example will execute the script ‘foo.script’ with 10 threads and the arguments ‘foodnstuff’ and 90:
|
||||||
spawn('foo.script', 10, 'foodnstuff', 90);
|
spawn('foo.script', 10, 'foodnstuff', 90);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//The following example will execute the script ‘foo.script’ with 10 threads and the arguments ‘foodnstuff’ and 90:
|
||||||
|
ns.spawn('foo.script', 10, 'foodnstuff', 90);
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -26,10 +26,19 @@ void
|
|||||||
|
|
||||||
RAM cost: 0.05 GB
|
RAM cost: 0.05 GB
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
sqlinject("foodnstuff");
|
sqlinject("foodnstuff");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
ns.sqlinject("foodnstuff");
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -38,23 +38,29 @@ Otherwise, the fn, hostname/ip, and args… arguments can be used to get the log
|
|||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//Open logs from foo.script on the current server that was run with no args
|
//Open logs from foo.script on the current server that was run with no args
|
||||||
tail("foo.script");
|
tail("foo.script");
|
||||||
|
|
||||||
|
//Get logs from foo.script on the foodnstuff server that was run with no args
|
||||||
|
tail("foo.script", "foodnstuff");
|
||||||
|
|
||||||
|
//Get logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
|
||||||
|
tail("foo.script", "foodnstuff", 1, "test");
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example 2
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//Open logs from foo.script on the current server that was run with no args
|
||||||
|
ns.tail("foo.script");
|
||||||
|
|
||||||
//Get logs from foo.script on the foodnstuff server that was run with no args
|
//Get logs from foo.script on the foodnstuff server that was run with no args
|
||||||
tail("foo.script", "foodnstuff");
|
ns.tail("foo.script", "foodnstuff");
|
||||||
```
|
|
||||||
|
|
||||||
## Example 3
|
|
||||||
|
|
||||||
|
|
||||||
```ts
|
|
||||||
//Get logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
|
//Get logs from foo.script on the foodnstuff server that was run with the arguments [1, "test"]
|
||||||
tail("foo.script", "foodnstuff", 1, "test");
|
ns.tail("foo.script", "foodnstuff", 1, "test");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Queue a toast (bottom-right notification).
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
toast(msg: any, variant?: string): void;
|
toast(msg: any, variant?: string, duration?: number): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -18,6 +18,7 @@ toast(msg: any, variant?: string): void;
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| msg | any | Message in the toast. |
|
| msg | any | Message in the toast. |
|
||||||
| variant | string | Type of toast, must be one of success, info, warning, error. Defaults to success. |
|
| variant | string | Type of toast, must be one of success, info, warning, error. Defaults to success. |
|
||||||
|
| duration | number | Duration of toast in ms, defaults to 2000 |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
@ -4,19 +4,19 @@
|
|||||||
|
|
||||||
## NS.tprint() method
|
## NS.tprint() method
|
||||||
|
|
||||||
Prints a value or a variable to the Terminal.
|
Prints one or more values or variables to the Terminal.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
tprint(msg: any): void;
|
tprint(...args: any[]): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| msg | any | Value to be printed. |
|
| args | any\[\] | Value(s) to be printed. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
|
@ -29,15 +29,27 @@ The amount by which the target server’s security level was decreased. This is
|
|||||||
|
|
||||||
RAM cost: 0.15 GB
|
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.
|
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 when this function is called. 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.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
weaken("foodnstuff");
|
// NS1:
|
||||||
weaken("foodnstuff", { threads: 5 }); // Only use 5 threads to weaken
|
var currentSecurity = getServerSecurityLevel("foodnstuff");
|
||||||
|
currentSecurity = currentSecurity - weaken("foodnstuff");
|
||||||
|
currentSecurity = currentSecurity - weaken("foodnstuff", { threads: 5 }); // Only use 5 threads to weaken
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
let currentSecurity = ns.getServerSecurityLevel("foodnstuff");
|
||||||
|
currentSecurity -= await ns.weaken("foodnstuff");
|
||||||
|
currentSecurity -= await ns.weaken("foodnstuff", { threads: 5 }); // Only use 5 threads to weaken
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -36,10 +36,19 @@ IMPORTANT: This is an asynchronous function that returns a Promise. The Promise
|
|||||||
|
|
||||||
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.
|
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 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
wget("https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md", "game_readme.txt");
|
wget("https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md", "game_readme.txt");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
await ns.wget("https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md", "game_readme.txt");
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Write data to a file.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
write(handle: string, data?: string[] | number, mode?: "w" | "a"): Promise<void>;
|
write(handle: string, data?: string[] | number | string, mode?: "w" | "a"): Promise<void>;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -17,7 +17,7 @@ write(handle: string, data?: string[] | number, mode?: "w" | "a"): Promise<void>
|
|||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| handle | string | Port or text file that will be written to. |
|
| handle | string | Port or text file that will be written to. |
|
||||||
| data | string\[\] \| number | Data to write. |
|
| data | string\[\] \| number \| string | Data to write. |
|
||||||
| mode | "w" \| "a" | Defines the write mode. Only valid when writing to text files. |
|
| mode | "w" \| "a" | Defines the write mode. Only valid when writing to text files. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
@ -18,5 +18,6 @@ export interface ProcessInfo
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [args](./bitburner.processinfo.args.md) | string\[\] | Script's arguments |
|
| [args](./bitburner.processinfo.args.md) | string\[\] | Script's arguments |
|
||||||
| [filename](./bitburner.processinfo.filename.md) | string | Script name. |
|
| [filename](./bitburner.processinfo.filename.md) | string | Script name. |
|
||||||
|
| [pid](./bitburner.processinfo.pid.md) | number | Process ID |
|
||||||
| [threads](./bitburner.processinfo.threads.md) | number | Number of threads script is running with |
|
| [threads](./bitburner.processinfo.threads.md) | number | Number of threads script is running with |
|
||||||
|
|
||||||
|
13
markdown/bitburner.processinfo.pid.md
Normal file
13
markdown/bitburner.processinfo.pid.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [bitburner](./bitburner.md) > [ProcessInfo](./bitburner.processinfo.md) > [pid](./bitburner.processinfo.pid.md)
|
||||||
|
|
||||||
|
## ProcessInfo.pid property
|
||||||
|
|
||||||
|
Process ID
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
pid: number;
|
||||||
|
```
|
@ -34,10 +34,19 @@ This function returns true if you successfully start working on the specified pr
|
|||||||
|
|
||||||
Note that creating a program using this function has the same hacking level requirements as it normally would. These level requirements are: \* BruteSSH.exe: 50 \* FTPCrack.exe: 100 \* relaySMTP.exe: 250 \* HTTPWorm.exe: 500 \* SQLInject.exe: 750 \* DeepscanV1.exe: 75 \* DeepscanV2.exe: 400 \* ServerProfiler.exe: 75 \* AutoLink.exe: 25
|
Note that creating a program using this function has the same hacking level requirements as it normally would. These level requirements are: \* BruteSSH.exe: 50 \* FTPCrack.exe: 100 \* relaySMTP.exe: 250 \* HTTPWorm.exe: 500 \* SQLInject.exe: 750 \* DeepscanV1.exe: 75 \* DeepscanV2.exe: 400 \* ServerProfiler.exe: 75 \* AutoLink.exe: 25
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
createProgram(“relaysmtp.exe”);
|
createProgram(“relaysmtp.exe”);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
ns.createProgram(“relaysmtp.exe”);
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -65,6 +65,6 @@ This API requires Source-File 4 level 1 / 2 / 3 to use.
|
|||||||
| [universityCourse(universityName, courseName)](./bitburner.singularity.universitycourse.md) | SF4.1 - Take university class. |
|
| [universityCourse(universityName, courseName)](./bitburner.singularity.universitycourse.md) | SF4.1 - Take university class. |
|
||||||
| [upgradeHomeCores()](./bitburner.singularity.upgradehomecores.md) | SF4.2 - Upgrade home computer cores. |
|
| [upgradeHomeCores()](./bitburner.singularity.upgradehomecores.md) | SF4.2 - Upgrade home computer cores. |
|
||||||
| [upgradeHomeRam()](./bitburner.singularity.upgradehomeram.md) | SF4.2 - Upgrade home computer RAM. |
|
| [upgradeHomeRam()](./bitburner.singularity.upgradehomeram.md) | SF4.2 - Upgrade home computer RAM. |
|
||||||
| [workForCompany(companyName)](./bitburner.singularity.workforcompany.md) | SF4.2 - Work for a company. |
|
| [workForCompany(companyName, focus)](./bitburner.singularity.workforcompany.md) | SF4.2 - Work for a company. |
|
||||||
| [workForFaction(faction, workType)](./bitburner.singularity.workforfaction.md) | SF4.2 - Work for a faction. |
|
| [workForFaction(faction, workType, focus)](./bitburner.singularity.workforfaction.md) | SF4.2 - Work for a faction. |
|
||||||
|
|
||||||
|
@ -30,10 +30,19 @@ RAM cost: 2 GB
|
|||||||
|
|
||||||
This function allows you to automatically purchase programs. You MUST have a TOR router in order to use this function. The cost of purchasing programs using this function is the same as if you were purchasing them through the Dark Web using the Terminal buy command.
|
This function allows you to automatically purchase programs. You MUST have a TOR router in order to use this function. The cost of purchasing programs using this function is the same as if you were purchasing them through the Dark Web using the Terminal buy command.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1
|
||||||
purchaseProgram("brutessh.exe");
|
purchaseProgram("brutessh.exe");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2
|
||||||
|
ns.purchaseProgram("brutessh.exe");
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ SF4.2 - Work for a company.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
workForCompany(companyName?: string): boolean;
|
workForCompany(companyName?: string, focus?: boolean): boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -17,6 +17,7 @@ workForCompany(companyName?: string): boolean;
|
|||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| companyName | string | Name of company to work for. Must be an exact match. Optional. If not specified, this argument defaults to the last job that you worked |
|
| companyName | string | Name of company to work for. Must be an exact match. Optional. If not specified, this argument defaults to the last job that you worked |
|
||||||
|
| focus | boolean | Acquire player focus on this work operation. Optional. Defaults to true. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
@ -34,10 +35,11 @@ This function will return true if the player starts working, and false otherwise
|
|||||||
|
|
||||||
Note that when you are working for a company, you will not actually receive your earnings (reputation, money, experience) until you FINISH the action.
|
Note that when you are working for a company, you will not actually receive your earnings (reputation, money, experience) until you FINISH the action.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//If you only want to work until you get 100,000 company reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
|
//If you only want to work until you get 100,000 company reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
|
||||||
while (getCompanyRep(COMPANY HERE) < VALUE) {
|
while (getCompanyRep(COMPANY HERE) < VALUE) {
|
||||||
workForCompany();
|
workForCompany();
|
||||||
@ -46,3 +48,16 @@ while (getCompanyRep(COMPANY HERE) < VALUE) {
|
|||||||
//This way, your company reputation will be updated every minute.
|
//This way, your company reputation will be updated every minute.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//If you only want to work until you get 100,000 company reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
|
||||||
|
while (ns.getCompanyRep(COMPANY HERE) < VALUE) {
|
||||||
|
ns.workForCompany();
|
||||||
|
await ns.sleep(60000);
|
||||||
|
}
|
||||||
|
//This way, your company reputation will be updated every minute.
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ SF4.2 - Work for a faction.
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
workForFaction(faction: string, workType: string): boolean;
|
workForFaction(faction: string, workType: string, focus?: boolean): boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -18,6 +18,7 @@ workForFaction(faction: string, workType: string): boolean;
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| faction | string | Name of faction to work for. |
|
| faction | string | Name of faction to work for. |
|
||||||
| workType | string | Type of work to perform for the faction. |
|
| workType | string | Type of work to perform for the faction. |
|
||||||
|
| focus | boolean | Acquire player focus on this work operation. Optional. Defaults to true. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
@ -35,10 +36,11 @@ This function will return true if you successfully start working for the specifi
|
|||||||
|
|
||||||
Note that when you are working for a faction, you will not actually receive your earnings (reputation, experience) until you FINISH the action.
|
Note that when you are working for a faction, you will not actually receive your earnings (reputation, experience) until you FINISH the action.
|
||||||
|
|
||||||
## Example
|
## Example 1
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
// NS1:
|
||||||
//If you only want to work until you get 100,000 faction reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
|
//If you only want to work until you get 100,000 faction reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
|
||||||
while (getFactionRep(FACTION NAME) < VALUE) {
|
while (getFactionRep(FACTION NAME) < VALUE) {
|
||||||
workForFaction(FACNAME, WORKTYPE);
|
workForFaction(FACNAME, WORKTYPE);
|
||||||
@ -47,3 +49,16 @@ while (getFactionRep(FACTION NAME) < VALUE) {
|
|||||||
//This way, your faction reputation will be updated every minute.
|
//This way, your faction reputation will be updated every minute.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example 2
|
||||||
|
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// NS2:
|
||||||
|
//If you only want to work until you get 100,000 faction reputation. One small hack to get around this is to continuously restart the action to receive your earnings:
|
||||||
|
while (ns.getFactionRep(FACTION NAME) < VALUE) {
|
||||||
|
ns.workForFaction(FACNAME, WORKTYPE);
|
||||||
|
await ns.sleep(60000);
|
||||||
|
}
|
||||||
|
//This way, your faction reputation will be updated every minute.
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.city property
|
## SleeveInformation.city property
|
||||||
|
|
||||||
location of the sleeve
|
Location of the sleeve
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.earningsForPlayer property
|
## SleeveInformation.earningsForPlayer property
|
||||||
|
|
||||||
earnings synchronized to the player
|
Earnings synchronized to the player
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.earningsForSleeves property
|
## SleeveInformation.earningsForSleeves property
|
||||||
|
|
||||||
earnings synchronized to other sleeves
|
Earnings synchronized to other sleeves
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.earningsForTask property
|
## SleeveInformation.earningsForTask property
|
||||||
|
|
||||||
earnings for this sleeve
|
Earnings for this sleeve
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.hp property
|
## SleeveInformation.hp property
|
||||||
|
|
||||||
current hp of the sleeve
|
Current hp of the sleeve
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.jobs property
|
## SleeveInformation.jobs property
|
||||||
|
|
||||||
jobs available to the sleeve
|
Jobs available to the sleeve
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.jobTitle property
|
## SleeveInformation.jobTitle property
|
||||||
|
|
||||||
job titles available to the sleeve
|
Job titles available to the sleeve
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.maxHp property
|
## SleeveInformation.maxHp property
|
||||||
|
|
||||||
max hp of the sleeve
|
Max hp of the sleeve
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -16,16 +16,16 @@ export interface SleeveInformation
|
|||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [city](./bitburner.sleeveinformation.city.md) | string | location of the sleeve |
|
| [city](./bitburner.sleeveinformation.city.md) | string | Location of the sleeve |
|
||||||
| [earningsForPlayer](./bitburner.sleeveinformation.earningsforplayer.md) | [SleeveWorkGains](./bitburner.sleeveworkgains.md) | earnings synchronized to the player |
|
| [earningsForPlayer](./bitburner.sleeveinformation.earningsforplayer.md) | [SleeveWorkGains](./bitburner.sleeveworkgains.md) | Earnings synchronized to the player |
|
||||||
| [earningsForSleeves](./bitburner.sleeveinformation.earningsforsleeves.md) | [SleeveWorkGains](./bitburner.sleeveworkgains.md) | earnings synchronized to other sleeves |
|
| [earningsForSleeves](./bitburner.sleeveinformation.earningsforsleeves.md) | [SleeveWorkGains](./bitburner.sleeveworkgains.md) | Earnings synchronized to other sleeves |
|
||||||
| [earningsForTask](./bitburner.sleeveinformation.earningsfortask.md) | [SleeveWorkGains](./bitburner.sleeveworkgains.md) | earnings for this sleeve |
|
| [earningsForTask](./bitburner.sleeveinformation.earningsfortask.md) | [SleeveWorkGains](./bitburner.sleeveworkgains.md) | Earnings for this sleeve |
|
||||||
| [hp](./bitburner.sleeveinformation.hp.md) | number | current hp of the sleeve |
|
| [hp](./bitburner.sleeveinformation.hp.md) | number | Current hp of the sleeve |
|
||||||
| [jobs](./bitburner.sleeveinformation.jobs.md) | string\[\] | jobs available to the sleeve |
|
| [jobs](./bitburner.sleeveinformation.jobs.md) | string\[\] | Jobs available to the sleeve |
|
||||||
| [jobTitle](./bitburner.sleeveinformation.jobtitle.md) | string\[\] | job titles available to the sleeve |
|
| [jobTitle](./bitburner.sleeveinformation.jobtitle.md) | string\[\] | Job titles available to the sleeve |
|
||||||
| [maxHp](./bitburner.sleeveinformation.maxhp.md) | number | max hp of the sleeve |
|
| [maxHp](./bitburner.sleeveinformation.maxhp.md) | number | Max hp of the sleeve |
|
||||||
| [mult](./bitburner.sleeveinformation.mult.md) | [CharacterMult](./bitburner.charactermult.md) | sleeve multipliers |
|
| [mult](./bitburner.sleeveinformation.mult.md) | [CharacterMult](./bitburner.charactermult.md) | Sleeve multipliers |
|
||||||
| [timeWorked](./bitburner.sleeveinformation.timeworked.md) | number | time spent on the current task in milliseconds |
|
| [timeWorked](./bitburner.sleeveinformation.timeworked.md) | number | Time spent on the current task in milliseconds |
|
||||||
| [tor](./bitburner.sleeveinformation.tor.md) | boolean | does this sleeve have access to the tor router |
|
| [tor](./bitburner.sleeveinformation.tor.md) | boolean | Does this sleeve have access to the tor router |
|
||||||
| [workRepGain](./bitburner.sleeveinformation.workrepgain.md) | number | faction or company reputation gained for the current task |
|
| [workRepGain](./bitburner.sleeveinformation.workrepgain.md) | number | Faction or company reputation gained for the current task |
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.mult property
|
## SleeveInformation.mult property
|
||||||
|
|
||||||
sleeve multipliers
|
Sleeve multipliers
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.timeWorked property
|
## SleeveInformation.timeWorked property
|
||||||
|
|
||||||
time spent on the current task in milliseconds
|
Time spent on the current task in milliseconds
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.tor property
|
## SleeveInformation.tor property
|
||||||
|
|
||||||
does this sleeve have access to the tor router
|
Does this sleeve have access to the tor router
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveInformation.workRepGain property
|
## SleeveInformation.workRepGain property
|
||||||
|
|
||||||
faction or company reputation gained for the current task
|
Faction or company reputation gained for the current task
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveSkills.agility property
|
## SleeveSkills.agility property
|
||||||
|
|
||||||
current agility of the sleeve
|
Current agility of the sleeve
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveSkills.charisma property
|
## SleeveSkills.charisma property
|
||||||
|
|
||||||
current charisma of the sleeve
|
Current charisma of the sleeve
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## SleeveSkills.defense property
|
## SleeveSkills.defense property
|
||||||
|
|
||||||
current defense of the sleeve
|
Current defense of the sleeve
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user