bitburner-src/markdown/bitburner.ns.kill.md
Olivier Gagnon 43fc5dfd48 work on doc
2021-10-30 12:34:14 -04:00

1.7 KiB
Raw Blame History

Home > bitburner > NS > kill

NS.kill() method

Kills the script on the target server specified by the scripts name and arguments. Remember that scripts are uniquely identified by both their name and arguments. For example, if `foo.script` is run with the argument 1, then this is not the same as `foo.script` run with the argument 2, even though they have the same code.

Signature:

kill(script: Script, host: Host, ...args: string[]): boolean;

Parameters

Parameter Type Description
script Script Filename of the script to kill
host Host Hostname or IP of the server on which to kill the script.
args string[] Arguments to identify which script to kill.

Returns:

boolean

True if the script is successfully killed, and false otherwise.

Remarks

0.5 GB

Example 1

//The following example will try to kill a script named foo.script on the foodnstuff server that was ran with no arguments:
kill("foo.script", "foodnstuff");

Example 2

//The following will try to kill a script named foo.script on the current server that was ran with no arguments:
kill("foo.script", getHostname());

Example 3

//The following will try to kill a script named foo.script on the current server that was ran with the arguments 1 and “foodnstuff”:
kill("foo.script", getHostname(), 1, "foodnstuff");