Added donateToFaction(), isLogEnabled(), and getScriptLogs() Netscript functions. Added optional hacking/int level parameters to getHackTime/getGrowTime/etc functions

This commit is contained in:
danielyxie
2018-09-11 13:56:23 -05:00
parent 93d2a09aab
commit 56b2f581d8
10 changed files with 193 additions and 88 deletions
+38 -4
View File
@@ -129,6 +129,28 @@ enableLog
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')
isLogEnabled
^^^^^^^^^^^^
.. js:function:: isLogEnabled(fn)
:param string fn: Name of function to check
Returns a boolean indicating whether or not logging is enabled for that
function (or 'ALL')
getScriptLogs
^^^^^^^^^^^^^
.. js:function:: getScriptLogs()
Returns the script's logs. The logs are returned as an array, where each
line is an element in the array. The most recently logged line is at the
end of the array.
Note that there is a maximum number of lines that a script stores in its logs.
This is configurable in the game's options.
scan
^^^^
@@ -768,7 +790,7 @@ write
when writing to a port.
If the first argument is a string, then it specifies the name of a text file (.txt) and this function will write *data* to that text file. If the
specified text file does not exist, then it will be created. The third argument *mode, defines how the data will be written to the text file. If *mode*
specified text file does not exist, then it will be created. The third argument *mode*, defines how the data will be written to the text file. If *mode*
is set to "w", then the data is written in "write" mode which means that it will overwrite all existing data on the text file. If *mode* is set to
any other value then the data will be written in "append" mode which means that the data will be added at the end of the text file.
@@ -902,30 +924,42 @@ getScriptRam
getHackTime
^^^^^^^^^^^
.. js:function:: getHackTime(hostname/ip)
.. js:function:: getHackTime(hostname/ip[, hackLvl=current level])
:param string hostname/ip: Hostname or IP of target server
:param number hackLvl: Optional hacking level for the calculation. Defaults to player's current hacking level
Returns the amount of time in seconds it takes to execute the *hack()* Netscript function on the target server.
The function takes in an optional *hackLvl* parameter that can be specified
to see what the hack time would be at different hacking levels.
getGrowTime
^^^^^^^^^^^
.. js:function:: getGrowTime(hostname/ip)
.. js:function:: getGrowTime(hostname/ip[, hackLvl=current level])
:param string hostname/ip: Hostname or IP of target server
:param number hackLvl: Optional hacking level for the calculation. Defaults to player's current hacking level
Returns the amount of time in seconds it takes to execute the *grow()* Netscript function on the target server.
The function takes in an optional *hackLvl* parameter that can be specified
to see what the grow time would be at different hacking levels.
getWeakenTime
^^^^^^^^^^^^^
.. js:function:: getWeakenTime(hostname/ip)
.. js:function:: getWeakenTime(hostname/ip[, hackLvl=current level])
:param string hostname/ip: Hostname or IP of target server
:param number hackLvl: Optional hacking level for the calculation. Defaults to player's current hacking level
Returns the amount of time in seconds it takes to execute the *weaken()* Netscript function on the target server.
The function takes in an optional *hackLvl* parameter that can be specified
to see what the weaken time would be at different hacking levels.
getScriptIncome
^^^^^^^^^^^^^^^