DOCS: Improved documentation for functions that take a FilenameOrPID (#759)

This commit is contained in:
VictorS 2023-08-30 16:36:34 -04:00 committed by GitHub
parent ad9bde40e0
commit b7fdcdf35d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 13 deletions

@ -31,8 +31,6 @@ RAM cost: 0.1 GB
Returns a boolean indicating whether the specified file exists on the target server. The filename for programs is case insensitive, other file types are case sensitive. For example, fileExists(“brutessh.exe”) will work fine, even though the actual program is named 'BruteSSH.exe'.
\*
## Example

@ -21,8 +21,8 @@ getRunningScript(
| Parameter | Type | Description |
| --- | --- | --- |
| filename | [FilenameOrPID](./bitburner.filenameorpid.md) | _(Optional)_ Optional. Filename or PID of the script. |
| hostname | string | _(Optional)_ Optional. Name of host server the script is running on. |
| args | (string \| number \| boolean)\[\] | Arguments to identify 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:**
@ -34,5 +34,5 @@ The info about the running script if found, and null otherwise.
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.
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.)

@ -17,8 +17,8 @@ isRunning(script: FilenameOrPID, host?: string, ...args: (string | number | bool
| Parameter | Type | Description |
| --- | --- | --- |
| script | [FilenameOrPID](./bitburner.filenameorpid.md) | Filename or PID of script to check. This is case-sensitive. |
| host | string | _(Optional)_ Hostname of target server. |
| args | (string \| number \| boolean)\[\] | Arguments to specify/identify which scripts to search for. |
| 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. |
**Returns:**
@ -30,7 +30,7 @@ True if the specified script is running on the target server, and false otherwis
RAM cost: 0.1 GB
Returns a boolean indicating whether the specified script is running on the target server. If you use a PID instead of a filename, the hostname and args parameters are unnecessary. 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.)
Returns a boolean indicating whether the specified script is running on the target server. If you use a PID instead of a filename, 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.)
## Example

@ -5830,7 +5830,7 @@ export interface NS {
* For example, fileExists(brutessh.exe) will work fine, even though the actual program
* is named 'BruteSSH.exe'.
*
* * @example
* @example
* ```js
* // The function call will return true if the script named foo.js exists on the foodnstuff server, and false otherwise.
* ns.fileExists("foo.js", "foodnstuff");
@ -5851,6 +5851,7 @@ export interface NS {
*
* Returns a boolean indicating whether the specified script is running on the target server.
* If you use a PID instead of a filename, 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.)
@ -5867,8 +5868,8 @@ export interface NS {
* ns.isRunning("foo.js", "joesguns", 1, 5, "test");
* ```
* @param script - Filename or PID of script to check. This is case-sensitive.
* @param host - Hostname of target server.
* @param args - Arguments to specify/identify which scripts to search for.
* @param host - Hostname of target server. Optional, defaults to the server the calling script is running on.
* @param args - Arguments to specify/identify the script. Optional, when looking for scripts run without arguments.
* @returns True if the specified script is running on the target server, and false otherwise.
*/
isRunning(script: FilenameOrPID, host?: string, ...args: (string | number | boolean)[]): boolean;
@ -5880,10 +5881,14 @@ export interface NS {
*
* 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.)
*
* @param filename - Optional. Filename or PID of the script.
* @param hostname - Optional. Name of host server the script is running on.
* @param args - Arguments to identify the script
* @param hostname - Hostname of target server. Optional, defaults to the server the calling script is running on.
* @param args - Arguments to specify/identify the script. Optional, when looking for scripts run without arguments.
* @returns The info about the running script if found, and null otherwise.
*/
getRunningScript(