diff --git a/doc/source/netscript/netscriptjs.rst b/doc/source/netscript/netscriptjs.rst index 84365306b..70d5fc12c 100644 --- a/doc/source/netscript/netscriptjs.rst +++ b/doc/source/netscript/netscriptjs.rst @@ -51,11 +51,9 @@ Here is a summary of all rules you need to follow when writing Netscript JS code * grow * weaken * sleep + * asleep * prompt * wget - * scp - * write - * writePort * Any function that contains :code:`await` must be declared as :code:`async` @@ -147,9 +145,7 @@ You may have noticed that every new ns2 file will contains the following comment .. code-block:: javascript - /** - * @param {NS} ns - **/ + /** @param {NS} ns */ This comment is used to help the text editor autocomplete functions in the Netscript API. You can enable it by pressing ctrl+space after `ns.` diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 201c4a154..816abad79 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1518,7 +1518,7 @@ const base: InternalAPI = { }, tryWritePort: (ctx: NetscriptContext) => - (_port: unknown, data: unknown = ""): Promise => { + (_port: unknown, data: unknown = ""): boolean => { const port = helpers.number(ctx, "port", _port); if (typeof data !== "string" && typeof data !== "number") { throw helpers.makeRuntimeErrorMsg( @@ -1527,7 +1527,7 @@ const base: InternalAPI = { ); } const iport = helpers.getValidPort(ctx, port); - return Promise.resolve(iport.tryWrite(data)); + return iport.tryWrite(data); }, readPort: (ctx: NetscriptContext) => diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index e09ba697b..da7bf0f45 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -5969,7 +5969,7 @@ export interface NS { * @param data - Data to write. * @returns True if the data is successfully written to the port, and false otherwise. */ - tryWritePort(port: number, data: string | number): Promise; + tryWritePort(port: number, data: string | number): boolean; /** * Read content of a file.