diff --git a/doc/source/basicgameplay/factions.rst b/doc/source/basicgameplay/factions.rst index 6c7f96c81..10ad755f0 100644 --- a/doc/source/basicgameplay/factions.rst +++ b/doc/source/basicgameplay/factions.rst @@ -218,7 +218,7 @@ List of Factions and their Requirements | | The Covenant | * 20 Augmentations | | | | | * $75b | | | | | * Hacking Level of 850 | | -| | | * or All Combat Stats of 850 | | +| | | * All Combat Stats of 850 | | + +----------------+-----------------------------------------+-------------------------------+ | | Daedalus | * 30 Augmentations | | | | | * $100b | | diff --git a/doc/source/netscript/basicfunctions/clearLog.rst b/doc/source/netscript/basicfunctions/clearLog.rst new file mode 100644 index 000000000..747295281 --- /dev/null +++ b/doc/source/netscript/basicfunctions/clearLog.rst @@ -0,0 +1,15 @@ +clearLog() Netscript Function +=============================== + +.. js:function:: clearLog() + + :RAM cost: 0 GB + + Clears the script’s logs. + + Examples: + + .. code-block:: javascript + + //Opens the logs, clears it of whatever may have been there before and prevents non-print() functions from printing to log + ns.tail();ns.clearLog();ns.disableLog("ALL"); \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/closeTail.rst b/doc/source/netscript/basicfunctions/closeTail.rst new file mode 100644 index 000000000..9013ce41a --- /dev/null +++ b/doc/source/netscript/basicfunctions/closeTail.rst @@ -0,0 +1,19 @@ +closeTail() Netscript Function +=============================== + +.. js:function:: closeTail([scriptPid]) + + :RAM cost: 0 GB + + :param number scriptPid: PID of the script of which to open the logs. + + Closes a script’s logs. + + If the function is called with no arguments, it will open the current script’s logs. + + Examples: + + .. code-block:: javascript + + ns.closeTail(12); + ns.closeTail(); \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/disableLog.rst b/doc/source/netscript/basicfunctions/disableLog.rst index f0aa7d061..22ff31883 100644 --- a/doc/source/netscript/basicfunctions/disableLog.rst +++ b/doc/source/netscript/basicfunctions/disableLog.rst @@ -8,4 +8,11 @@ disableLog() Netscript Function :param string functionName: Name of function for which to disable logging. Disables logging for the given function. Logging can be disabled for - all functions by passing 'ALL' as the argument. + all functions by passing 'ALL' as the argument. Print() can always print to log. + + Examples: + + .. code-block:: javascript + + //Opens the logs, clears it of whatever may have been there before and prevents non-print() functions from logging + ns.tail();ns.clearLog();ns.disableLog("ALL"); \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/enableLog.rst b/doc/source/netscript/basicfunctions/enableLog.rst index 60b3f5606..61f246436 100644 --- a/doc/source/netscript/basicfunctions/enableLog.rst +++ b/doc/source/netscript/basicfunctions/enableLog.rst @@ -10,3 +10,12 @@ enableLog() Netscript Function Re-enables logging for the given function. If 'ALL' is passed into this function as an argument, then it will revert the effects of ``disableLog('ALL')`` + + Examples: + + .. code-block:: javascript + + //Opens the logs, clears it of whatever may have been there before and prevents non-print() functions from printing to log + ns.tail();ns.clearLog();ns.disableLog("ALL"); + //let hack() log normally + ns.enableLog("hack"); \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/getHostname.rst b/doc/source/netscript/basicfunctions/getHostname.rst new file mode 100644 index 000000000..9d116121f --- /dev/null +++ b/doc/source/netscript/basicfunctions/getHostname.rst @@ -0,0 +1,14 @@ +getHostname() Netscript Function +============================== + +.. js:function:: getHostname() + + :RAM cost: 0.05 GB + + Returns a string with the hostname of the server that the script is running on. + + Examples: + + .. code-block:: javascript + + ns.tprint(ns.getHostname()) \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/getSharePower.rst b/doc/source/netscript/basicfunctions/getSharePower.rst new file mode 100644 index 000000000..20a43bab6 --- /dev/null +++ b/doc/source/netscript/basicfunctions/getSharePower.rst @@ -0,0 +1,15 @@ +getSharePower() Netscript Function +============================== + +.. js:function:: getSharePower() + + :RAM cost: 0.2 GB + + Calculate your share power. Based on all the active share calls. + Returns the reputation gain rate multiplier, i.e. 1.5 means +50% rep gain rate. + + Examples: + + .. code-block:: javascript + + ns.tprint(ns.getSharePower()) \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/isRunning.rst b/doc/source/netscript/basicfunctions/isRunning.rst index 833ea38de..dea0a5f63 100644 --- a/doc/source/netscript/basicfunctions/isRunning.rst +++ b/doc/source/netscript/basicfunctions/isRunning.rst @@ -2,6 +2,7 @@ isRunning() Netscript Function ============================== .. js:function:: isRunning(filename[, hostname=current hostname[, args...]]) +.. js:function:: isRunning(PID) :RAM cost: 0.1 GB :param string filename: Filename of script to check. case-sensitive. diff --git a/doc/source/netscript/basicfunctions/kill.rst b/doc/source/netscript/basicfunctions/kill.rst index 7375afb62..3ebe564d2 100644 --- a/doc/source/netscript/basicfunctions/kill.rst +++ b/doc/source/netscript/basicfunctions/kill.rst @@ -2,6 +2,7 @@ kill() Netscript Function ========================= .. js:function:: kill(script, [hostname=current hostname, [args...]]) +.. js:function:: kill(PID) :RAM cost: 0.5 GB :param string script: Filename of the script to kill. diff --git a/doc/source/netscript/basicfunctions/moveTail.rst b/doc/source/netscript/basicfunctions/moveTail.rst new file mode 100644 index 000000000..0a6ad21e5 --- /dev/null +++ b/doc/source/netscript/basicfunctions/moveTail.rst @@ -0,0 +1,28 @@ +moveTail() Netscript Function +=============================== + +.. js:function:: moveTail(x , y[, pid]) + + :RAM cost: 0 GB + + :param number x: X coordinate to move the tail window to. + :param number y: Y coordinate to move the tail window to. + :param number pid: PID of the script of which tail window to move. Defaults to current script. + + Moves the tail window to the specified coordinates. The top left corner is (0,0). + + .. note:: + + Due to inner workings, something has to be awaited between opening a tail window and moving or resizing it. + + Examples: + + .. code-block:: javascript + + //open tail + ns.tail(); + await ns.sleep(0); + + //move the tail close to top left corner and make it big + ns.moveTail(10, 10); + ns.resizeTail(780, 510) \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/mv.rst b/doc/source/netscript/basicfunctions/mv.rst new file mode 100644 index 000000000..b1aba3af2 --- /dev/null +++ b/doc/source/netscript/basicfunctions/mv.rst @@ -0,0 +1,18 @@ +mv() Netscript Function +============================== + +.. js:function:: mv(serverName, sourceFile, targetFile) + + :RAM cost: 0 GB + + Move the source file to target file on the given server. + + This command only works for scripts and text files (.txt). It cannot, however, be used to convert from script to text file, or vice versa. + + This function can also be used to rename files. + + Examples: + + .. code-block:: javascript + + ns.tprint("home", "foo.js", "old_foo.txt") \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/nFormat.rst b/doc/source/netscript/basicfunctions/nFormat.rst new file mode 100644 index 000000000..f66214389 --- /dev/null +++ b/doc/source/netscript/basicfunctions/nFormat.rst @@ -0,0 +1,20 @@ +nFormat() Netscript Function +============================== + +.. js:function:: nFormat(number, format) + + :RAM cost: 0 GB + + :param number number: Number to format. + :param string format: Formatting to use. Read http://numeraljs.com/#format for specifics. + + onverts a number into a string with the specified formatter. + This uses the numeral.js library, so the formatters must be compatible with that. + + Examples: + + .. code-block:: javascript + + ns.print(ns.nFormat(123456789.1,"0,0")) //logs "123,456,789" + ns.print(ns.nFormat(123456789.1,"0.00a")) //logs "123.46m" + ns.print(ns.nFormat(200000,"$0.00a")) //logs "$200.00k" \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/resizeTail.rst b/doc/source/netscript/basicfunctions/resizeTail.rst new file mode 100644 index 000000000..d1545c20b --- /dev/null +++ b/doc/source/netscript/basicfunctions/resizeTail.rst @@ -0,0 +1,28 @@ +moveTail() Netscript Function +=============================== + +.. js:function:: moveTail(width, heigth[, pid]) + + :RAM cost: 0 GB + + :param number width: Width of the window. + :param number heigth: Heigth of the window. + :param number pid: PID of the script of which tail window to resize. Defaults to current script. + + resizes the tail window to the specified size. + + .. note:: + + Due to inner workings, something has to be awaited between opening a tail window and moving or resizing it. + + Examples: + + .. code-block:: javascript + + //open tail + ns.tail(); + await ns.sleep(0); + + //move the tail close to top left corner and make it big + ns.moveTail(10, 10); + ns.resizeTail(780, 510) \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/share.rst b/doc/source/netscript/basicfunctions/share.rst new file mode 100644 index 000000000..cb63e452c --- /dev/null +++ b/doc/source/netscript/basicfunctions/share.rst @@ -0,0 +1,14 @@ +share() Netscript Function +============================== + +.. js:function:: share() + + :RAM cost: 2.4 GB + + Increases your rep gain of all faction work types while share is called. Scales with thread count. + + Examples: + + .. code-block:: javascript + + while(true) await ns.share(); \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/tail.rst b/doc/source/netscript/basicfunctions/tail.rst new file mode 100644 index 000000000..66c5c5392 --- /dev/null +++ b/doc/source/netscript/basicfunctions/tail.rst @@ -0,0 +1,34 @@ +tail() Netscript Function +=============================== + +.. js:function:: tail([script, hostname[, numThreads=1[, args...]]]) + + :RAM cost: 0 GB + + :param string script: Filename of the script of which to open the logs. + :param string hostname: Hostname of the server on which the script is running on. + :param args...: Arguments to identify which script's log to open. + + Opens a script’s logs. This is functionally the same as the tail Terminal command. + + If the function is called with no arguments, it will open the current script’s logs. + + Examples: + + .. code-block:: javascript + + ns.tail("foo.js", "foodnstuff"); + ns.tail(); + +.. js:function:: tail(scriptPid) + + :RAM cost: 0 GB + :param number scriptPid: PID of the script of which to open the logs. + + Same as the above version but with pid. + + Example: + + .. code-block:: javascript + + ns.tail(12); \ No newline at end of file diff --git a/doc/source/netscript/basicfunctions/tformat.rst b/doc/source/netscript/basicfunctions/tformat.rst new file mode 100644 index 000000000..0c7436496 --- /dev/null +++ b/doc/source/netscript/basicfunctions/tformat.rst @@ -0,0 +1,18 @@ +tFormat() Netscript Function +============================== + +.. js:function:: tFormat(milliseconds[, milliPrecision]) + + :RAM cost: 0 GB + + :param string milliseconds: Number of millisecond to format. + :param boolean milliPrecision: Format time with subsecond precision. Defaults to false. + + Format time to a readable string. + + Examples: + + .. code-block:: javascript + + ns.print(ns.tFormat(123456789)) //logs "1 day 10 hours 17 minutes 36 seconds" + ns.print(ns.tFormat(123456789,true)) //logs "1 day 10 hours 17 minutes 36.789 seconds" \ No newline at end of file diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index d245d4f84..844776af8 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6854,7 +6854,7 @@ export type NS = { * @remarks * RAM cost: 2.4 GB * - * Increases your rep gain of hacking contracts while share is called. + * Increases your rep gain of all faction work types while share is called. * Scales with thread count. */ share(): Promise;