2021-10-30 18:34:14 +02:00
|
|
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
|
|
|
|
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [scriptRunning](./bitburner.ns.scriptrunning.md)
|
|
|
|
|
|
|
|
## NS.scriptRunning() method
|
|
|
|
|
2021-11-03 23:16:10 +01:00
|
|
|
Check if any script with a filename is running.
|
2021-10-30 18:34:14 +02:00
|
|
|
|
|
|
|
<b>Signature:</b>
|
|
|
|
|
|
|
|
```typescript
|
2021-10-30 21:46:34 +02:00
|
|
|
scriptRunning(script: string, host: string): boolean;
|
2021-10-30 18:34:14 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| --- | --- | --- |
|
2021-10-30 21:46:34 +02:00
|
|
|
| script | string | Filename of script to check. This is case-sensitive. |
|
2021-11-03 05:27:21 +01:00
|
|
|
| host | string | Host of target server. |
|
2021-10-30 18:34:14 +02:00
|
|
|
|
|
|
|
<b>Returns:</b>
|
|
|
|
|
|
|
|
boolean
|
|
|
|
|
|
|
|
True if the specified script is running, and false otherwise.
|
|
|
|
|
|
|
|
## Remarks
|
|
|
|
|
2021-10-30 21:46:34 +02:00
|
|
|
RAM cost: 1 GB
|
2021-10-30 18:34:14 +02:00
|
|
|
|
2021-11-03 23:16:10 +01:00
|
|
|
Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of its arguments.
|
|
|
|
|
|
|
|
This is different than the isRunning function because it does not try to identify a specific instance of a running script by its arguments.
|
|
|
|
|
2021-10-30 18:34:14 +02:00
|
|
|
## Example 1
|
|
|
|
|
|
|
|
|
2021-10-30 21:46:34 +02:00
|
|
|
```ts
|
2022-01-08 19:25:06 +01:00
|
|
|
// NS1:
|
2021-10-30 18:34:14 +02:00
|
|
|
//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");
|
2022-01-08 19:25:06 +01:00
|
|
|
|
|
|
|
//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());
|
2021-10-30 18:34:14 +02:00
|
|
|
```
|
2022-01-08 19:25:06 +01:00
|
|
|
\*
|
2021-10-30 18:34:14 +02:00
|
|
|
|
|
|
|
## Example 2
|
|
|
|
|
|
|
|
|
2021-10-30 21:46:34 +02:00
|
|
|
```ts
|
2022-01-08 19:25:06 +01:00
|
|
|
// 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");
|
|
|
|
|
2021-10-30 18:34:14 +02:00
|
|
|
//The function call will return true if there is any script named “foo.script” running on the current server, and false otherwise:
|
2022-01-08 19:25:06 +01:00
|
|
|
ns.scriptRunning("foo.script", ns.getHostname());
|
2021-10-30 18:34:14 +02:00
|
|
|
```
|
|
|
|
|