From 304b7645b0bb8506dc5ea9df824de16c97eb7860 Mon Sep 17 00:00:00 2001 From: Duck McSouls Date: Mon, 10 Oct 2022 12:47:20 +1100 Subject: [PATCH 1/3] DOC: `ns.sleeve.setToCommitCrime()`: starting index of sleeves Document the index of the first sleeve. Sleeves are indexed starting from zero, i.e. 0. Increment by 1 to get the index of the next sleeve. And so on. --- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 5a2a9a8e6..10dfd5fbe 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -3618,7 +3618,7 @@ export interface Sleeve { * * Returns false if an invalid action is specified. * - * @param sleeveNumber - Index of the sleeve to start committing crime. + * @param sleeveNumber - Index of the sleeve to start committing crime. Sleeves are numbered starting from 0. * @param name - Name of the crime. Must be an exact match. * @returns True if this action was set successfully, false otherwise. */ From c728c550f5b983eff23b2d3bb8d6a68ad39f3fdb Mon Sep 17 00:00:00 2001 From: Duck McSouls Date: Mon, 10 Oct 2022 13:17:14 +1100 Subject: [PATCH 2/3] DOC: `ns.sleeve.setToCommitCrime()`: add all crimes a sleeve can commit Add a list of crimes that a sleeve can commit. Update the parameter documentation to refer to this list. --- src/ScriptEditor/NetscriptDefinitions.d.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 10dfd5fbe..9a5d72c33 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -3618,8 +3618,25 @@ export interface Sleeve { * * Returns false if an invalid action is specified. * + * You can set a sleeve to commit one of the following crimes. The crime names are not + * case sensitive. For example, you can pass in the crime name as `"Shoplift"`, + * `"shoplift"`, `"shopLift"`, or even `"SHOPLIFT"`. + * + * - Assassination + * - Bond forgery + * - Deal drugs + * - Grand theft auto + * - Heist + * - Homicide + * - Kidnap + * - Larceny + * - Mug + * - Rob store + * - Shoplift + * - Traffick arms + * * @param sleeveNumber - Index of the sleeve to start committing crime. Sleeves are numbered starting from 0. - * @param name - Name of the crime. Must be an exact match. + * @param name - Name of the crime. Must be an exact match. Refer to the list of crimes. * @returns True if this action was set successfully, false otherwise. */ setToCommitCrime(sleeveNumber: number, name: string): boolean; From afe6a837c36be43c2efa9d21f398759e8c13f2d3 Mon Sep 17 00:00:00 2001 From: Duck McSouls Date: Mon, 10 Oct 2022 20:49:33 +1100 Subject: [PATCH 3/3] DOC: `ns.sleeve.setToCommitCrime()`: add 1 example An example on how to set a sleeve to commit a crime. The example shows that sleeves are indexed from 0. --- src/ScriptEditor/NetscriptDefinitions.d.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 9a5d72c33..15a6aaeb5 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -3635,6 +3635,27 @@ export interface Sleeve { * - Shoplift * - Traffick arms * + * @example + * ```ts + * // NS1 + * // Assign the first 3 sleeves to commit various crimes. + * var crime = ["mug", "rob store", "shoplift"]; + * for (var i = 0; i < crime.length; i++) { + * tprintf("Sleeve %d commits crime: %s", i, crime[i]); + * sleeve.setToCommitCrime(i, crime[i]); + * } + * ``` + * @example + * ```ts + * // NS2 + * // Assign the first 3 sleeves to commit various crimes. + * const crime = ["mug", "rob store", "shoplift"]; + * for (let i = 0; i < crime.length; i++) { + * ns.tprintf("Sleeve %d commits crime: %s", i, crime[i]); + * ns.sleeve.setToCommitCrime(i, crime[i]); + * } + * ``` + * * @param sleeveNumber - Index of the sleeve to start committing crime. Sleeves are numbered starting from 0. * @param name - Name of the crime. Must be an exact match. Refer to the list of crimes. * @returns True if this action was set successfully, false otherwise.