mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-14 03:33:52 +01:00
1.6 KiB
1.6 KiB
Home > bitburner > NS > getRunningScript
NS.getRunningScript() method
Get general info about a running script.
Signature:
getRunningScript(
filename?: FilenameOrPID,
hostname?: string,
...args: (string | number | boolean)[]
): RunningScript | null;
Parameters
Parameter | Type | Description |
---|---|---|
filename | FilenameOrPID | (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. |
Returns:
RunningScript | null
The info about the running script if found, and null otherwise.
Remarks
RAM cost: 0.3 GB
Running with no args returns current script. If you use a PID as the first parameter, the hostname and args parameters are unnecessary. If hostname is omitted while filename is used as the first parameter, hostname defaults to the server the calling script is running on. Remember that a script is semi-uniquely identified by both its name and its arguments. (You can run multiple copies of scripts with the same arguments, but for the purposes of functions like this that check based on filename, the filename plus arguments forms the key.)