mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-22 17:23:00 +02:00
v0.34.5. Also adding webpack config and package-lock.json
This commit is contained in:
+1
@@ -23,3 +23,4 @@ to reach out to the developer!
|
||||
Hacknet Node API <netscripthacknetnodeapi>
|
||||
Trade Information eXchange (TIX) API <netscriptixapi>
|
||||
Singularity Functions <netscriptsingularityfunctions>
|
||||
Miscellaneous <netscriptmisc>
|
||||
|
||||
+61
-14
@@ -12,7 +12,7 @@ hack
|
||||
.. js:function:: hack(hostname/ip)
|
||||
|
||||
:param string hostname/ip: IP or hostname of the target server to hack
|
||||
:returns: True if the hack is successful, false otherwise
|
||||
:returns: The amount of money stolen if the hack is successful, and zero otherwise
|
||||
|
||||
Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends
|
||||
on your hacking level and the target server's security level. In order to hack a server you must first gain root access
|
||||
@@ -72,10 +72,9 @@ weaken
|
||||
sleep
|
||||
^^^^^
|
||||
|
||||
.. js:function:: sleep(n[, log=true])
|
||||
.. js:function:: sleep(n)
|
||||
|
||||
:param number n: Number of milliseconds to sleep
|
||||
:param boolean log: Optional boolean specifying whether or not to log the action
|
||||
|
||||
Suspends the script for n milliseconds.
|
||||
|
||||
@@ -97,6 +96,39 @@ tprint
|
||||
|
||||
Prints a value or a variable to the Terminal
|
||||
|
||||
clearLog
|
||||
^^^^^^^^
|
||||
|
||||
.. js:function:: clearLog()
|
||||
|
||||
Clears the script's logs
|
||||
|
||||
disableLog
|
||||
^^^^^^^^^^
|
||||
|
||||
.. js:function:: disableLog(fn)
|
||||
|
||||
:param string fn: 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.
|
||||
|
||||
Note that this does not completely remove all logging functionality.
|
||||
This only stops a function from logging
|
||||
when the function is successful. If the function fails, it will still log the reason for failure.
|
||||
|
||||
Notable functions that cannot have their logs disabled: run, exec, exit
|
||||
|
||||
enableLog
|
||||
^^^^^^^^^
|
||||
|
||||
.. js:function:: enableLog(fn)
|
||||
|
||||
:param string fn: Name of function for which to enable logging
|
||||
|
||||
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')
|
||||
|
||||
scan
|
||||
^^^^
|
||||
|
||||
@@ -304,7 +336,8 @@ killall
|
||||
|
||||
:param string hostname/ip: IP or hostname of the server on which to kill all scripts
|
||||
|
||||
Kills all running scripts on the specified server. This function will always return true.
|
||||
Kills all running scripts on the specified server. This function returns true if any scripts were killed, and
|
||||
false otherwise. In other words, it will return true if there are any scripts running on the target server.
|
||||
|
||||
|
||||
exit
|
||||
@@ -346,9 +379,10 @@ scp
|
||||
ls
|
||||
^^
|
||||
|
||||
.. js:function:: ls(hostname/ip)
|
||||
.. js:function:: ls(hostname/ip, [grep])
|
||||
|
||||
:param string hostname/ip: Hostname or IP of the target server
|
||||
:param string grep: a substring to search for in the filename
|
||||
|
||||
Returns an array with the filenames of all files on the specified server (as strings). The returned array
|
||||
is sorted in alphabetic order
|
||||
@@ -639,15 +673,6 @@ getPurchasedServers
|
||||
|
||||
Returns an array with either the hostnames or IPs of all of the servers you have purchased.
|
||||
|
||||
round
|
||||
^^^^^
|
||||
|
||||
.. js:function:: round(n)
|
||||
|
||||
:param number n: Number to round
|
||||
|
||||
Returns the argument *n* rounded to the nearest integer. If the argument passed in is not a number, then the function will return 0.
|
||||
|
||||
write
|
||||
^^^^^
|
||||
|
||||
@@ -684,6 +709,18 @@ read
|
||||
If the argument *port/fn* is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If
|
||||
the text file does not exist, an empty string will be returned.
|
||||
|
||||
peek
|
||||
^^^^
|
||||
|
||||
.. js:function:: peek(port)
|
||||
|
||||
:param number port: Port to peek. Must be an integer between 1 and 10
|
||||
|
||||
This function is used to peek at the data from a port. It returns the first element in the specified port
|
||||
without removing that element. If the port is empty, the string "NULL PORT DATA" will be returned.
|
||||
|
||||
Read about how `Netscript Ports work here <http://bitburner.wikia.com/wiki/Netscript_Ports>`_.
|
||||
|
||||
clear
|
||||
^^^^^
|
||||
|
||||
@@ -697,6 +734,16 @@ clear
|
||||
|
||||
If the *port/fn* argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.
|
||||
|
||||
rm
|
||||
^^
|
||||
|
||||
.. js:function:: rm(fn)
|
||||
|
||||
:param string fn: Filename of file to remove. Must include the extension
|
||||
:returns: True if it successfully deletes the file, and false otherwise
|
||||
|
||||
Removes the specified file from the current server. This function works for every file type except message (.msg) files.
|
||||
|
||||
scriptRunning
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -2,9 +2,6 @@ Netscript Loops and Conditionals
|
||||
================================
|
||||
|
||||
|
||||
Loops and Conditionals
|
||||
----------------------
|
||||
|
||||
Netscript loops and conditionals are the same as Javascript. However, the one caveat is that when declaring variables such as the
|
||||
iterator for traversing a loop, you should not use the 'var' or 'let' keyword. For reference, you can see the Javascript
|
||||
documentation for loops/conditionals here:
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
Netscript Miscellaneous
|
||||
=======================
|
||||
|
||||
|
||||
Comments
|
||||
--------
|
||||
Netscript supports comments using the same syntax as `Javascript comments <https://www.w3schools.com/js/js_comments.asp>`_.
|
||||
Comments are not evaluated as code, and can be used to document and/or explain code::
|
||||
|
||||
//This is a comment and will not get executed even though its in the code
|
||||
/* Multi
|
||||
* line
|
||||
* comment */
|
||||
print("This code will actually get executed");
|
||||
|
||||
Javascript Math Module
|
||||
----------------------
|
||||
|
||||
The `Javascript Math Module <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math>`_ is
|
||||
supported in Netscript and is used in the same way::
|
||||
|
||||
numThreads = Math.floor(getServerRam("foodnstuff")[1] / 3.4);
|
||||
|
||||
Javascript Date Module
|
||||
----------------------
|
||||
|
||||
The `Javascript Date Module <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date>`_ is supported in Netscript.
|
||||
However, since the 'new' operator does not work in Netscript, only the Date module's static functions can be used:
|
||||
|
||||
* now()
|
||||
* UTC()
|
||||
* Parse()
|
||||
* Maybe some others I don't know about
|
||||
|
||||
Example::
|
||||
|
||||
time = Date.now();
|
||||
Reference in New Issue
Block a user