From 4fb1dbf2e3ea8a83a569eee5cf8d5e3522dbd7c8 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sun, 2 Jan 2022 12:13:01 -0500 Subject: [PATCH 1/4] fix some weird eval --- src/NetscriptEvaluator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NetscriptEvaluator.ts b/src/NetscriptEvaluator.ts index d5a35b214..dfba570f7 100644 --- a/src/NetscriptEvaluator.ts +++ b/src/NetscriptEvaluator.ts @@ -44,7 +44,7 @@ export function resolveNetscriptRequestedThreads( `Invalid thread count passed to ${functionName}: ${requestedThreads}. Threads must be a positive number.`, ); } - if (requestedThreads > threads) { + if (requestedThreadsAsInt > threads) { throw makeRuntimeRejectMsg( workerScript, `Too many threads requested by ${functionName}. Requested: ${requestedThreads}. Has: ${threads}.`, From f8607ce73e7dc8109bb7dceca5fce795548c7fec Mon Sep 17 00:00:00 2001 From: daan flore Date: Sun, 2 Jan 2022 18:54:11 +0100 Subject: [PATCH 2/4] Adding dorgotten typescript defenitions to file --- src/ScriptEditor/NetscriptDefinitions.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index cfc02ffe9..bcc99cb89 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -5155,6 +5155,7 @@ export interface NS extends Singularity { * * @returns info about a running script */ + getRunningScript(): RunningScript; getRunningScript(filename: string | number, hostname: string, ...args: (string | number)[]): RunningScript; /** From 74ee7f371dca42ba8e601e5f04cf31d1b570bd00 Mon Sep 17 00:00:00 2001 From: daan flore Date: Sun, 2 Jan 2022 19:24:16 +0100 Subject: [PATCH 3/4] String value should also be possible to write --- 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 bcc99cb89..c786bd72e 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -5290,7 +5290,7 @@ export interface NS extends Singularity { * @param data - Data to write. * @param mode - Defines the write mode. Only valid when writing to text files. */ - write(handle: string, data?: string[] | number, mode?: "w" | "a"): Promise; + write(handle: string, data?: string[] | number | string, mode?: "w" | "a"): Promise; /** * Attempt to write to a port. From 8c851b577aa3b73910f47cedc4b9263cf7e9ad73 Mon Sep 17 00:00:00 2001 From: daan flore Date: Sun, 2 Jan 2022 20:40:57 +0100 Subject: [PATCH 4/4] Adding correct types at run args command --- 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 c786bd72e..52ad9d861 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -4560,7 +4560,7 @@ export interface NS extends Singularity { * @param args - Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the second argument numThreads must be filled in with a value. * @returns Returns the PID of a successfully started script, and 0 otherwise. */ - run(script: string, numThreads?: number, ...args: string[]): number; + run(script: string, numThreads?: number, ...args: Array): number; /** * Start another script on any server.