diff --git a/markdown/bitburner.autocompletedata.enums.md b/markdown/bitburner.autocompletedata.enums.md index 9621a894c..31c370bd5 100644 --- a/markdown/bitburner.autocompletedata.enums.md +++ b/markdown/bitburner.autocompletedata.enums.md @@ -4,6 +4,8 @@ ## AutocompleteData.enums property +Netscript Enums + **Signature:** ```typescript diff --git a/markdown/bitburner.autocompletedata.filename.md b/markdown/bitburner.autocompletedata.filename.md new file mode 100644 index 000000000..4c44bf25d --- /dev/null +++ b/markdown/bitburner.autocompletedata.filename.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [AutocompleteData](./bitburner.autocompletedata.md) > [filename](./bitburner.autocompletedata.filename.md) + +## AutocompleteData.filename property + +The filename of the script about to be run + +**Signature:** + +```typescript +filename: string; +``` diff --git a/markdown/bitburner.autocompletedata.flags.md b/markdown/bitburner.autocompletedata.flags.md index 575e5f270..086fe3b1e 100644 --- a/markdown/bitburner.autocompletedata.flags.md +++ b/markdown/bitburner.autocompletedata.flags.md @@ -4,6 +4,8 @@ ## AutocompleteData.flags() method +Parses the flags schema on the already inputted flags + **Signature:** ```typescript diff --git a/markdown/bitburner.autocompletedata.hostname.md b/markdown/bitburner.autocompletedata.hostname.md new file mode 100644 index 000000000..f1b5ac8fd --- /dev/null +++ b/markdown/bitburner.autocompletedata.hostname.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [AutocompleteData](./bitburner.autocompletedata.md) > [hostname](./bitburner.autocompletedata.hostname.md) + +## AutocompleteData.hostname property + +The hostname of the server the script would be running on + +**Signature:** + +```typescript +hostname: string; +``` diff --git a/markdown/bitburner.autocompletedata.md b/markdown/bitburner.autocompletedata.md index 4c55ea495..d2c4d416e 100644 --- a/markdown/bitburner.autocompletedata.md +++ b/markdown/bitburner.autocompletedata.md @@ -16,14 +16,17 @@ interface AutocompleteData | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [enums](./bitburner.autocompletedata.enums.md) | | [NSEnums](./bitburner.nsenums.md) | | -| [scripts](./bitburner.autocompletedata.scripts.md) | | string\[\] | | -| [servers](./bitburner.autocompletedata.servers.md) | | string\[\] | | -| [txts](./bitburner.autocompletedata.txts.md) | | string\[\] | | +| [enums](./bitburner.autocompletedata.enums.md) | | [NSEnums](./bitburner.nsenums.md) | Netscript Enums | +| [filename](./bitburner.autocompletedata.filename.md) | | string | The filename of the script about to be run | +| [hostname](./bitburner.autocompletedata.hostname.md) | | string | The hostname of the server the script would be running on | +| [processes](./bitburner.autocompletedata.processes.md) | | [ProcessInfo](./bitburner.processinfo.md)\[\] | The processes running on the host | +| [scripts](./bitburner.autocompletedata.scripts.md) | | string\[\] | All scripts on the current server | +| [servers](./bitburner.autocompletedata.servers.md) | | string\[\] | All server hostnames | +| [txts](./bitburner.autocompletedata.txts.md) | | string\[\] | All text files on the current server | ## Methods | Method | Description | | --- | --- | -| [flags(schema)](./bitburner.autocompletedata.flags.md) | | +| [flags(schema)](./bitburner.autocompletedata.flags.md) | Parses the flags schema on the already inputted flags | diff --git a/markdown/bitburner.autocompletedata.processes.md b/markdown/bitburner.autocompletedata.processes.md new file mode 100644 index 000000000..c7b0a7911 --- /dev/null +++ b/markdown/bitburner.autocompletedata.processes.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [AutocompleteData](./bitburner.autocompletedata.md) > [processes](./bitburner.autocompletedata.processes.md) + +## AutocompleteData.processes property + +The processes running on the host + +**Signature:** + +```typescript +processes: ProcessInfo[]; +``` diff --git a/markdown/bitburner.autocompletedata.scripts.md b/markdown/bitburner.autocompletedata.scripts.md index 61bb0f095..a1c402ea1 100644 --- a/markdown/bitburner.autocompletedata.scripts.md +++ b/markdown/bitburner.autocompletedata.scripts.md @@ -4,6 +4,8 @@ ## AutocompleteData.scripts property +All scripts on the current server + **Signature:** ```typescript diff --git a/markdown/bitburner.autocompletedata.servers.md b/markdown/bitburner.autocompletedata.servers.md index c54c0f26a..12ba761d6 100644 --- a/markdown/bitburner.autocompletedata.servers.md +++ b/markdown/bitburner.autocompletedata.servers.md @@ -4,6 +4,8 @@ ## AutocompleteData.servers property +All server hostnames + **Signature:** ```typescript diff --git a/markdown/bitburner.autocompletedata.txts.md b/markdown/bitburner.autocompletedata.txts.md index 37e552011..49eceb326 100644 --- a/markdown/bitburner.autocompletedata.txts.md +++ b/markdown/bitburner.autocompletedata.txts.md @@ -4,6 +4,8 @@ ## AutocompleteData.txts property +All text files on the current server + **Signature:** ```typescript diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md index c08ac5b99..c753bea4a 100644 --- a/markdown/bitburner.ns.md +++ b/markdown/bitburner.ns.md @@ -155,6 +155,7 @@ export async function main(ns) { | [scp(files, destination, source)](./bitburner.ns.scp.md) | Copy file between servers. | | [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. | +| [self()](./bitburner.ns.self.md) | Returns the currently running script. | | [serverExists(host)](./bitburner.ns.serverexists.md) | Returns a boolean denoting whether or not the specified server exists. | | [setTitle(title, pid)](./bitburner.ns.settitle.md) | Set the title of the tail window of a script. | | [share()](./bitburner.ns.share.md) | Share the server's ram with your factions. | diff --git a/markdown/bitburner.ns.self.md b/markdown/bitburner.ns.self.md new file mode 100644 index 000000000..4748f63f8 --- /dev/null +++ b/markdown/bitburner.ns.self.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [self](./bitburner.ns.self.md) + +## NS.self() method + +Returns the currently running script. + +**Signature:** + +```typescript +self(): RunningScript; +``` +**Returns:** + +[RunningScript](./bitburner.runningscript.md) + +## Remarks + +RAM cost: 0 GB + diff --git a/markdown/bitburner.runningscript.md b/markdown/bitburner.runningscript.md index b69ab1cc9..248b36545 100644 --- a/markdown/bitburner.runningscript.md +++ b/markdown/bitburner.runningscript.md @@ -25,6 +25,7 @@ interface RunningScript | [onlineExpGained](./bitburner.runningscript.onlineexpgained.md) | | number | Total amount of hacking experience earned from this script when online | | [onlineMoneyMade](./bitburner.runningscript.onlinemoneymade.md) | | number | Total amount of money made by this script when online | | [onlineRunningTime](./bitburner.runningscript.onlinerunningtime.md) | | number | Number of seconds that this script has been running online | +| [parent](./bitburner.runningscript.parent.md) | | number |
Process ID of the parent process.
If this script was started by another script, this will be the PID of that script. If this script was started directly through the terminal, the value will be 0.
| | [pid](./bitburner.runningscript.pid.md) | | number | Process ID. Must be an integer | | [ramUsage](./bitburner.runningscript.ramusage.md) | | number | How much RAM this script uses for ONE thread. Also known as "static RAM usage," this value does not change once the script is started, unless you call ns.ramOverride(). | | [server](./bitburner.runningscript.server.md) | | string | Hostname of the server on which this script runs | diff --git a/markdown/bitburner.runningscript.parent.md b/markdown/bitburner.runningscript.parent.md new file mode 100644 index 000000000..353b71fbc --- /dev/null +++ b/markdown/bitburner.runningscript.parent.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [RunningScript](./bitburner.runningscript.md) > [parent](./bitburner.runningscript.parent.md) + +## RunningScript.parent property + +Process ID of the parent process. + +If this script was started by another script, this will be the PID of that script. If this script was started directly through the terminal, the value will be 0. + +**Signature:** + +```typescript +parent: number; +``` diff --git a/src/Netscript/NetscriptHelpers.tsx b/src/Netscript/NetscriptHelpers.tsx index 15d0c648d..6c92611af 100644 --- a/src/Netscript/NetscriptHelpers.tsx +++ b/src/Netscript/NetscriptHelpers.tsx @@ -656,7 +656,7 @@ function getRunningScript(ctx: NetscriptContext, ident: ScriptIdentifier): Runni } else { const scripts = getRunningScriptsByArgs(ctx, ident.scriptname, ident.hostname, ident.args); if (scripts === null) return null; - return scripts.values().next().value; + return scripts.values().next().value ?? null; } } @@ -696,6 +696,7 @@ function createPublicRunningScript(runningScript: RunningScript, workerScript?: onlineMoneyMade: runningScript.onlineMoneyMade, onlineRunningTime: runningScript.onlineRunningTime, pid: runningScript.pid, + parent: runningScript.parent, ramUsage: runningScript.ramUsage, server: runningScript.server, tailProperties: diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 6213896d0..d49e2f7c2 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -519,6 +519,7 @@ export const RamCosts: RamCostTree