bitburner-src/doc/source/netscript/basicfunctions/scriptRunning.rst

31 lines
1003 B
ReStructuredText
Raw Normal View History

scriptRunning() Netscript Function
==================================
2021-03-12 08:51:56 +01:00
.. js:function:: scriptRunning(scriptname, hostname)
:RAM cost: 1 GB
2021-03-12 08:51:56 +01:00
:param string scriptname: Filename of script to check. case-sensitive.
:param string hostname: Hostname of target server.
:returns: ``true`` if any script with that file name is running on that
server.
2021-03-12 08:51:56 +01:00
This is different than the :doc:`isRunning<isRunning>` function because it
does not try to identify a specific instance of a running script by its
arguments.
2021-03-12 08:51:56 +01:00
Examples:
2021-03-12 08:51:56 +01:00
The example below will return true if there is any script named
2023-01-06 13:43:09 +01:00
``foo.js`` running on the ``foodnstuff`` server, and false otherwise:
2021-03-12 08:51:56 +01:00
.. code-block:: javascript
2023-01-06 13:43:09 +01:00
ns.scriptRunning("foo.js", "foodnstuff");
2021-03-12 08:51:56 +01:00
The example below will return true if there is any script named
2023-01-06 13:43:09 +01:00
``foo.js`` running on the current server, and false otherwise:
2021-03-12 08:51:56 +01:00
.. code-block:: javascript
2023-01-06 13:43:09 +01:00
ns.scriptRunning("foo.js", ns.getHostname());