mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
NETSCRIPT: A minorly breaking change around script launch, and refactoring. (#1213)
This commit is contained in:
@@ -9,7 +9,7 @@ Arguments passed into the script.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
readonly args: (string | number | boolean)[];
|
||||
readonly args: ScriptArg[];
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
@@ -9,12 +9,7 @@ Start another script on any server.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
exec(
|
||||
script: string,
|
||||
hostname: string,
|
||||
threadOrOptions?: number | RunOptions,
|
||||
...args: (string | number | boolean)[]
|
||||
): number;
|
||||
exec(script: string, hostname: string, threadOrOptions?: number | RunOptions, ...args: ScriptArg[]): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -24,7 +19,7 @@ exec(
|
||||
| script | string | Filename of script to execute. This file must already exist on the target server. |
|
||||
| hostname | string | Hostname of the <code>target server</code> on which to execute the script. |
|
||||
| threadOrOptions | number \| [RunOptions](./bitburner.runoptions.md) | _(Optional)_ Either an integer number of threads for new script, or a [RunOptions](./bitburner.runoptions.md) object. Threads defaults to 1. |
|
||||
| args | (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 threadOrOptions must be filled in with a value. |
|
||||
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | 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 threadOrOptions must be filled in with a value. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,11 +9,7 @@ Get general info about a running script.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getRunningScript(
|
||||
filename?: FilenameOrPID,
|
||||
hostname?: string,
|
||||
...args: (string | number | boolean)[]
|
||||
): RunningScript | null;
|
||||
getRunningScript(filename?: FilenameOrPID, hostname?: string, ...args: ScriptArg[]): RunningScript | null;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -22,7 +18,7 @@ getRunningScript(
|
||||
| --- | --- | --- |
|
||||
| filename | [FilenameOrPID](./bitburner.filenameorpid.md) | _(Optional)_ Optional. Filename or PID of the script. |
|
||||
| hostname | string | _(Optional)_ Hostname of target server. Optional, defaults to the server the calling script is running on. |
|
||||
| args | (string \| number \| boolean)\[\] | Arguments to specify/identify the script. Optional, when looking for scripts run without arguments. |
|
||||
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments to specify/identify the script. Optional, when looking for scripts run without arguments. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Get the exp gain of a script.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getScriptExpGain(script: string, host: string, ...args: (string | number | boolean)[]): number;
|
||||
getScriptExpGain(script: string, host: string, ...args: ScriptArg[]): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -18,7 +18,7 @@ getScriptExpGain(script: string, host: string, ...args: (string | number | boole
|
||||
| --- | --- | --- |
|
||||
| script | string | Filename of script. |
|
||||
| host | string | Server on which script is running. |
|
||||
| args | (string \| number \| boolean)\[\] | Arguments that the script is running with. |
|
||||
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments that the script is running with. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Get the income of a script.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getScriptIncome(script: string, host: string, ...args: (string | number | boolean)[]): number;
|
||||
getScriptIncome(script: string, host: string, ...args: ScriptArg[]): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -18,7 +18,7 @@ getScriptIncome(script: string, host: string, ...args: (string | number | boolea
|
||||
| --- | --- | --- |
|
||||
| script | string | Filename of script. |
|
||||
| host | string | Server on which script is running. |
|
||||
| args | (string \| number \| boolean)\[\] | Arguments that the script is running with. |
|
||||
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments that the script is running with. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Get all the logs of a script.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getScriptLogs(fn?: FilenameOrPID, host?: string, ...args: (string | number | boolean)[]): string[];
|
||||
getScriptLogs(fn?: FilenameOrPID, host?: string, ...args: ScriptArg[]): string[];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -18,7 +18,7 @@ getScriptLogs(fn?: FilenameOrPID, host?: string, ...args: (string | number | boo
|
||||
| --- | --- | --- |
|
||||
| fn | [FilenameOrPID](./bitburner.filenameorpid.md) | _(Optional)_ Optional. Filename or PID of script to get logs from. |
|
||||
| host | string | _(Optional)_ Optional. Hostname of the server that the script is on. |
|
||||
| args | (string \| number \| boolean)\[\] | Arguments to identify which scripts to get logs for. |
|
||||
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments to identify which scripts to get logs for. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Check if a script is running.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
isRunning(script: FilenameOrPID, host?: string, ...args: (string | number | boolean)[]): boolean;
|
||||
isRunning(script: FilenameOrPID, host?: string, ...args: ScriptArg[]): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -18,7 +18,7 @@ isRunning(script: FilenameOrPID, host?: string, ...args: (string | number | bool
|
||||
| --- | --- | --- |
|
||||
| script | [FilenameOrPID](./bitburner.filenameorpid.md) | Filename or PID of script to check. This is case-sensitive. |
|
||||
| host | string | _(Optional)_ Hostname of target server. Optional, defaults to the server the calling script is running on. |
|
||||
| args | (string \| number \| boolean)\[\] | Arguments to specify/identify the script. Optional, when looking for scripts run without arguments. |
|
||||
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments to specify/identify the script. Optional, when looking for scripts run without arguments. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function main(ns) {
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [args](./bitburner.ns.args.md) | <code>readonly</code> | (string \| number \| boolean)\[\] | Arguments passed into the script. |
|
||||
| [args](./bitburner.ns.args.md) | <code>readonly</code> | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments passed into the script. |
|
||||
| [bladeburner](./bitburner.ns.bladeburner.md) | <code>readonly</code> | [Bladeburner](./bitburner.bladeburner.md) | Namespace for bladeburner functions. Contains spoilers. |
|
||||
| [codingcontract](./bitburner.ns.codingcontract.md) | <code>readonly</code> | [CodingContract](./bitburner.codingcontract.md) | Namespace for codingcontract functions. |
|
||||
| [corporation](./bitburner.ns.corporation.md) | <code>readonly</code> | [Corporation](./bitburner.corporation.md) | Namespace for corporation functions. Contains spoilers. |
|
||||
|
||||
@@ -9,7 +9,7 @@ Start another script on the current server.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
run(script: string, threadOrOptions?: number | RunOptions, ...args: (string | number | boolean)[]): number;
|
||||
run(script: string, threadOrOptions?: number | RunOptions, ...args: ScriptArg[]): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -18,7 +18,7 @@ run(script: string, threadOrOptions?: number | RunOptions, ...args: (string | nu
|
||||
| --- | --- | --- |
|
||||
| script | string | Filename of script to run. |
|
||||
| threadOrOptions | number \| [RunOptions](./bitburner.runoptions.md) | _(Optional)_ Either an integer number of threads for new script, or a [RunOptions](./bitburner.runoptions.md) object. Threads defaults to 1. |
|
||||
| args | (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 threadOrOptions must be filled in with a value. |
|
||||
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | 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 threadOrOptions must be filled in with a value. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Terminate current script and start another in a defined number of milliseconds.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
spawn(script: string, threadOrOptions?: number | SpawnOptions, ...args: (string | number | boolean)[]): void;
|
||||
spawn(script: string, threadOrOptions?: number | SpawnOptions, ...args: ScriptArg[]): void;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -18,7 +18,7 @@ spawn(script: string, threadOrOptions?: number | SpawnOptions, ...args: (string
|
||||
| --- | --- | --- |
|
||||
| script | string | Filename of script to execute. |
|
||||
| threadOrOptions | number \| [SpawnOptions](./bitburner.spawnoptions.md) | _(Optional)_ Either an integer number of threads for new script, or a [SpawnOptions](./bitburner.spawnoptions.md) object. Threads defaults to 1 and spawnDelay defaults to 10,000 ms. |
|
||||
| args | (string \| number \| boolean)\[\] | Additional arguments to pass into the new script that is being run. |
|
||||
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Additional arguments to pass into the new script that is being run. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Open the tail window of a script.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
tail(fn?: FilenameOrPID, host?: string, ...args: (string | number | boolean)[]): void;
|
||||
tail(fn?: FilenameOrPID, host?: string, ...args: ScriptArg[]): void;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -18,7 +18,7 @@ tail(fn?: FilenameOrPID, host?: string, ...args: (string | number | boolean)[]):
|
||||
| --- | --- | --- |
|
||||
| fn | [FilenameOrPID](./bitburner.filenameorpid.md) | _(Optional)_ Optional. Filename or PID of the script being tailed. If omitted, the current script is tailed. |
|
||||
| host | string | _(Optional)_ Optional. Hostname of the script being tailed. Defaults to the server this script is running on. If args are specified, this is not optional. |
|
||||
| args | (string \| number \| boolean)\[\] | Arguments for the script being tailed. |
|
||||
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments for the script being tailed. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,5 +9,5 @@ Script's arguments
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
args: (string | number | boolean)[];
|
||||
args: ScriptArg[];
|
||||
```
|
||||
|
||||
@@ -16,7 +16,7 @@ interface ProcessInfo
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [args](./bitburner.processinfo.args.md) | | (string \| number \| boolean)\[\] | Script's arguments |
|
||||
| [args](./bitburner.processinfo.args.md) | | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Script's arguments |
|
||||
| [filename](./bitburner.processinfo.filename.md) | | string | Script name. |
|
||||
| [pid](./bitburner.processinfo.pid.md) | | number | Process ID |
|
||||
| [temporary](./bitburner.processinfo.temporary.md) | | boolean | Whether this process is excluded from saves |
|
||||
|
||||
@@ -9,5 +9,5 @@ Arguments the script was called with
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
args: (string | number | boolean)[];
|
||||
args: ScriptArg[];
|
||||
```
|
||||
|
||||
@@ -15,7 +15,7 @@ interface RunningScript
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [args](./bitburner.runningscript.args.md) | | (string \| number \| boolean)\[\] | Arguments the script was called with |
|
||||
| [args](./bitburner.runningscript.args.md) | | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments the script was called with |
|
||||
| [filename](./bitburner.runningscript.filename.md) | | string | Filename of the script |
|
||||
| [logs](./bitburner.runningscript.logs.md) | | string\[\] | Script logs as an array. The newest log entries are at the bottom. Timestamps, if enabled, are placed inside <code>[brackets]</code> at the start of each line. |
|
||||
| [offlineExpGained](./bitburner.runningscript.offlineexpgained.md) | | number | Total amount of hacking experience earned from this script when offline |
|
||||
|
||||
Reference in New Issue
Block a user