diff --git a/doc/source/netscript/advancedfunctions/getBitNodeMultipliers.rst b/doc/source/netscript/advancedfunctions/getBitNodeMultipliers.rst index ab8deac84..0da436be1 100644 --- a/doc/source/netscript/advancedfunctions/getBitNodeMultipliers.rst +++ b/doc/source/netscript/advancedfunctions/getBitNodeMultipliers.rst @@ -5,13 +5,16 @@ getBitNodeMultipliers() Netscript Function :RAM cost: 4 GB - Returns an object containing the current BitNode multipliers. This function - requires Source-File 5 in order to run. The multipliers are returned in - decimal forms (e.g. 1.5 instead of 150%). The multipliers represent the - difference between the current BitNode and the original BitNode (BitNode-1). - For example, if the *CrimeMoney* multiplier has a value of 0.1, then that - means that committing crimes in the current BitNode will only give 10% of - the money you would have received in BitNode-1. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + run this function. + + Returns an object containing the current BitNode multipliers. The + multipliers are returned in decimal forms (e.g. 1.5 instead of 150%). The + multipliers represent the difference between the current BitNode and the + original BitNode (BitNode-1). For example, if the *CrimeMoney* multiplier + has a value of 0.1, then that means that committing crimes in the current + BitNode will only give 10% of the money you would have received in + BitNode-1. The structure of the returned object is subject to change as BitNode multipliers get added to the game. Refer to the `source code here diff --git a/doc/source/netscript/advancedfunctions/getServer.rst b/doc/source/netscript/advancedfunctions/getServer.rst index 5a592e907..f444a5aca 100644 --- a/doc/source/netscript/advancedfunctions/getServer.rst +++ b/doc/source/netscript/advancedfunctions/getServer.rst @@ -3,7 +3,7 @@ getServer() Netscript Function .. js:function:: getServer([hostname]) - :RAM cost: 4 GB + :RAM cost: 2 GB :param string hostname: Hostname of the server, defaults to host server. If you are not in BitNode-5, then you must have Source-File 5-1 in order to run this function. diff --git a/doc/source/netscript/basicfunctions/brutessh.rst b/doc/source/netscript/basicfunctions/brutessh.rst index 4bd535fe4..79815d25b 100644 --- a/doc/source/netscript/basicfunctions/brutessh.rst +++ b/doc/source/netscript/basicfunctions/brutessh.rst @@ -7,8 +7,8 @@ brutessh() Netscript Function :param string hostname: Hostname of the target server. - Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist - on your home computer. + Runs the ``BruteSSH.exe`` program on the target server. ``BruteSSH.exe`` + must exist on your home computer. Examples: diff --git a/doc/source/netscript/basicfunctions/disableLog.rst b/doc/source/netscript/basicfunctions/disableLog.rst index e3b0a393a..f0aa7d061 100644 --- a/doc/source/netscript/basicfunctions/disableLog.rst +++ b/doc/source/netscript/basicfunctions/disableLog.rst @@ -9,9 +9,3 @@ disableLog() Netscript Function 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 diff --git a/doc/source/netscript/basicfunctions/exec.rst b/doc/source/netscript/basicfunctions/exec.rst index d3ee7f011..23ea9096e 100644 --- a/doc/source/netscript/basicfunctions/exec.rst +++ b/doc/source/netscript/basicfunctions/exec.rst @@ -19,9 +19,8 @@ exec() Netscript Function the :doc:`run` function except that it can be used to run a script on any server, instead of just the current server. - .. warning:: Running this function with a ``numThreads`` argument of 0 will return 0 without - running the script. However, running this function with a negative *numThreads* - argument will cause a runtime error. + .. warning:: Running this function with a ``numThreads`` argument of 0 or + less will cause a runtime error. The simplest way to use the :doc:`exec` command is to call it with just the script name and the target server. The following example will try diff --git a/doc/source/netscript/basicfunctions/exit.rst b/doc/source/netscript/basicfunctions/exit.rst index d0b6094a4..9bf93d072 100644 --- a/doc/source/netscript/basicfunctions/exit.rst +++ b/doc/source/netscript/basicfunctions/exit.rst @@ -6,3 +6,12 @@ exit() Netscript Function :RAM cost: 0 GB Terminates the current script immediately. + + .. warning:: In :ref:`netscriptjs`, execution may continue past a call to + this function; while some game-related functions (e.g. those with an + ``ns.`` prefix) will not function after this function has been called, + there might still be unintended behavior if you assume ``exit`` will + immediately halt execution, like it does in :ref:`netscript1`. To be + safe, you should probably ``return`` from the main function instead + of/in addition to calling ``ns.exit()`` when halting a NetscriptJS + script. diff --git a/doc/source/netscript/basicfunctions/flags.rst b/doc/source/netscript/basicfunctions/flags.rst index e6d17b1f7..d37675c37 100644 --- a/doc/source/netscript/basicfunctions/flags.rst +++ b/doc/source/netscript/basicfunctions/flags.rst @@ -7,11 +7,16 @@ flags() Netscript Function :param data array of pairs of strings: Flags definition. :returns: Object containing all the flags that were parsed or default. - The flag definition is an array of pairs of values, the first value is the - name of the flag, the 2nd value is the default value for that flag. + This function allows for a more flexible way of parsing script arguments + than to just pass a fixed list in a fixed order. Options can be given + names, and passed in any order, while having defined default values. + + The flag definition is an array of pairs of values: the first value is the + name of the flag, and the 2nd value is the default value for that flag. The return object is a map containing flag names to the value. It also - contains the special field '_' which contains all arguments that were not flags. + contains the special field '_', which contains all arguments that were not + flags. Example: @@ -27,14 +32,14 @@ flags() Netscript Function tprint(data); */ [home ~/]> run example.script - {"_":[],"delay":0,"server":"foodnstuff"} + {"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":false} [home ~/]> run example.script --delay 3000 - {"_":[],"server":"foodnstuff","delay":3000} + {"_":[],"server":"foodnstuff","exclude":[],"help":false,"delay":3000} [home ~/]> run example.script --delay 3000 --server harakiri-sushi - {"_":[],"delay":3000,"server":"harakiri-sushi"} + {"_":[],"exclude":[],"help":false,"delay":3000,"server":"harakiri-sushi"} [home ~/]> run example.script --delay 3000 --server harakiri-sushi hello world - {"_":["hello","world"],"delay":3000,"server":"harakiri-sushi"} + {"_":["hello","world"],"exclude":[],"help":false,"delay":3000,"server":"harakiri-sushi"} [home ~/]> run example.script --delay 3000 --server harakiri-sushi hello world --exclude a --exclude b - {"_":["hello","world"],"delay":3000,"server":"harakiri-sushi","exclude":["a","b"]} + {"_":["hello","world"],"help":false,"delay":3000,"server":"harakiri-sushi","exclude":["a","b"]} [home ~/]> run example.script --help {"_":[],"delay":0,"server":"foodnstuff","exclude":[],"help":true} diff --git a/doc/source/netscript/basicfunctions/ftpcrack.rst b/doc/source/netscript/basicfunctions/ftpcrack.rst index 1391934e9..32fd08f84 100644 --- a/doc/source/netscript/basicfunctions/ftpcrack.rst +++ b/doc/source/netscript/basicfunctions/ftpcrack.rst @@ -10,7 +10,6 @@ ftpcrack() Netscript Function Runs the ``FTPCrack.exe`` program on the target server. ``FTPCrack.exe`` must exist on your home computer. - Examples: .. code-block:: javascript diff --git a/doc/source/netscript/basicfunctions/getFavorToDonate.rst b/doc/source/netscript/basicfunctions/getFavorToDonate.rst index 133788fbd..8ebbc8489 100644 --- a/doc/source/netscript/basicfunctions/getFavorToDonate.rst +++ b/doc/source/netscript/basicfunctions/getFavorToDonate.rst @@ -10,4 +10,4 @@ getFavorToDonate() Netscript Function .. code-block:: javascript - getFavorToDonate() // returns: 150 \ No newline at end of file + getFavorToDonate() // returns: 150 diff --git a/doc/source/netscript/basicfunctions/getGrowTime.rst b/doc/source/netscript/basicfunctions/getGrowTime.rst index 443f76b01..7b65c567b 100644 --- a/doc/source/netscript/basicfunctions/getGrowTime.rst +++ b/doc/source/netscript/basicfunctions/getGrowTime.rst @@ -13,7 +13,6 @@ getGrowTime() Netscript Function The function takes in an optional ``hackLvl`` parameter that can be specified to see what the grow time would be at different hacking levels. - Example: .. code-block:: javascript diff --git a/doc/source/netscript/basicfunctions/getHackingLevel.rst b/doc/source/netscript/basicfunctions/getHackingLevel.rst index ed085220e..ad2b9f1d1 100644 --- a/doc/source/netscript/basicfunctions/getHackingLevel.rst +++ b/doc/source/netscript/basicfunctions/getHackingLevel.rst @@ -10,4 +10,4 @@ getHackingLevel() Netscript Function .. code-block:: javascript - getHackingLevel(); // returns: 124 \ No newline at end of file + getHackingLevel(); // returns: 124 diff --git a/doc/source/netscript/basicfunctions/getHostname.rst b/doc/source/netscript/basicfunctions/getHostname.rst index 76b78ac7c..b1287941b 100644 --- a/doc/source/netscript/basicfunctions/getHostname.rst +++ b/doc/source/netscript/basicfunctions/getHostname.rst @@ -11,4 +11,3 @@ getHostname() Netscript Function .. code-block:: javascript getHostname(); // returns: "foodnstuff" - diff --git a/doc/source/netscript/basicfunctions/getPlayer.rst b/doc/source/netscript/basicfunctions/getPlayer.rst index 3f674fab7..74f4b2810 100644 --- a/doc/source/netscript/basicfunctions/getPlayer.rst +++ b/doc/source/netscript/basicfunctions/getPlayer.rst @@ -10,89 +10,89 @@ getPlayer() Netscript Function Returns an object with the Player's stats. The object has the following properties:: { - hacking_skill - hp - max_hp - strength - defense - dexterity - agility - charisma - intelligence - hacking_chance_mult - hacking_speed_mult - hacking_money_mult - hacking_grow_mult - hacking_exp - strength_exp - defense_exp - dexterity_exp - agility_exp - charisma_exp - hacking_mult - strength_mult - defense_mult - dexterity_mult - agility_mult - charisma_mult - hacking_exp_mult - strength_exp_mult - defense_exp_mult - dexterity_exp_mult - agility_exp_mult - charisma_exp_mult - company_rep_mult - faction_rep_mult - money - city - location - crime_money_mult - crime_success_mult - isWorking - workType - currentWorkFactionName - currentWorkFactionDescription - workHackExpGainRate - workStrExpGainRate - workDefExpGainRate - workDexExpGainRate - workAgiExpGainRate - workChaExpGainRate - workRepGainRate - workMoneyGainRate - workMoneyLossRate - workHackExpGained - workStrExpGained - workDefExpGained - workDexExpGained - workAgiExpGained - workChaExpGained - workRepGained - workMoneyGained - createProgramName - createProgramReqLvl - className - crimeType - work_money_mult - hacknet_node_money_mult - hacknet_node_purchase_cost_mult - hacknet_node_ram_cost_mult - hacknet_node_core_cost_mult - hacknet_node_level_cost_mult - hasWseAccount - hasTixApiAccess - has4SData - has4SDataTixApi - bladeburner_max_stamina_mult - bladeburner_stamina_gain_mult - bladeburner_success_chance_mult - bitNodeN - totalPlaytime - playtimeSinceLastAug - playtimeSinceLastBitnode - jobs - factions - tor + hacking_skill: Current Hacking skill level + hp: Current health points + max_hp: Maximum health points + strength: Current Strength skill level + defense: Current Defense skill level + dexterity: Current Dexterity skill level + agility: Current Agility skill level + charisma: Current Charisma skill level + intelligence: Current Intelligence skill level (from BitNode-5) + hacking_chance_mult: Hacking Chance multiplier (from Source-Files and Augments) + hacking_speed_mult: Hacking Speed multiplier (from Source-Files and Augments) + hacking_money_mult: Hacking Money multiplier (from Source-Files and Augments) + hacking_grow_mult: Hacking Growth multiplier (from Source-Files and Augments) + hacking_exp: Current Hacking experience points + strength_exp: Current Strength experience points + defense_exp: Current Defense experience points + dexterity_exp: Current Dexterity experience points + agility_exp: Current Agility experience points + charisma_exp: Current Charisma experience points + hacking_mult: Hacking Level multiplier (from Source-Files and Augments) + strength_mult: Strength Level multiplier (from Source-Files and Augments) + defense_mult: Defense Level multiplier (from Source-Files and Augments) + dexterity_mult: Dexterity Level multiplier (from Source-Files and Augments) + agility_mult: Agility Level multiplier (from Source-Files and Augments) + charisma_mult: Charisma Level multiplier (from Source-Files and Augments) + hacking_exp_mult: Hacking Experience multiplier (from Source-Files and Augments) + strength_exp_mult: Strength Experience multiplier (from Source-Files and Augments) + defense_exp_mult: Defense Experience multiplier (from Source-Files and Augments) + dexterity_exp_mult: Dexterity Experience multiplier (from Source-Files and Augments) + agility_exp_mult: Agility Experience multiplier (from Source-Files and Augments) + charisma_exp_mult: Charisma Experience multiplier (from Source-Files and Augments) + company_rep_mult: Company reputation gain multiplier (from Source-Files and Augments) + faction_rep_mult: Faction reputation gain multiplier (from Source-Files and Augments) + money: Current money + city: Name of city you are currently in + location: Name of the last location visited + crime_money_mult: Crime money multiplier (from Source-Files and Augments) + crime_success_mult: Crime success multiplier (from Source-Files and Augments) + isWorking: Boolean indicating whether the player is currently performing work + workType: Name of the kind of work the player is performing + currentWorkFactionName: Name of the faction the player is currently working for + currentWorkFactionDescription: Description of the kind of work the player is currently doing + workHackExpGainRate: Amount of Hacking experience the player will gain every cycle (fifth of a second) + workStrExpGainRate: Amount of Strength experience the player will gain every cycle + workDefExpGainRate: Amount of Defense experience the player will gain every cycle + workDexExpGainRate: Amount of Dexterity experience the player will gain every cycle + workAgiExpGainRate: Amount of Agility experience the player will gain every cycle + workChaExpGainRate: Amount of Charisma experience the player will gain every cycle + workRepGainRate: Amount of Reputation the player will gain every cycle + workMoneyGainRate: Amount of Money the player will gain every cycle + workMoneyLossRate: Amount of Money the player will lose every cycle + workHackExpGained: Total Hacking experience gained while working thus far + workStrExpGained: Total Strength experience gained while working thus far + workDefExpGained: Total Defense experience gained while working thus far + workDexExpGained: Total Dexterity experience gained while working thus far + workAgiExpGained: Total Agility experience gained while working thus far + workChaExpGained: Total Charisma experience gained while working thus far + workRepGained: Total Reputation gained while working thus far + workMoneyGained: Total Money gained while working thus far + createProgramName: Name of the program the player is currently creating + createProgramReqLvl: Hacking skill required to make that program + className: Name of the class the player is currently studying + crimeType: Name of the crime the player last started + work_money_mult: Salary multiplier (from Source-Files and Augments) + hacknet_node_money_mult: Hacknet Node production multiplier (from Source-Files and Augments) + hacknet_node_purchase_cost_mult: Hacknet Node purchase cost multiplier (from Source-Files and Augments) + hacknet_node_ram_cost_mult: Hacknet Node RAM upgrade cost multiplier (from Source-Files and Augments) + hacknet_node_core_cost_mult: Hacknet Node Core purchase cost multiplier (from Source-Files and Augments) + hacknet_node_level_cost_mult: Hacknet Node level upgrade cost multiplier (from Source-Files and Augments) + hasWseAccount: Boolean indicating whether the player has a WSE Account + hasTixApiAccess: Boolean indicating whether the player has TIX API Access + has4SData: Boolean indicating whether the player has 4S Market Data Access + has4SDataTixApi: Boolean indicating whether the player has 4S Market Data TIX API Access + bladeburner_max_stamina_mult: Bladeburner Max Stamina multiplier (from Source-Files and Augments) + bladeburner_stamina_gain_mult: Bladeburner Stamina Gain multiplier (from Source-Files and Augments) + bladeburner_success_chance_mult: Bladeburner Success Chance multiplier (from Source-Files and Augments) + bitNodeN: Current BitNode number + totalPlaytime: Total amount of time the game has been running, in milliseconds + playtimeSinceLastAug: Milliseconds since the last time Augmentations were installed + playtimeSinceLastBitnode: Milliseconds since this BitNode was started + jobs: A mapping of companies the player works for to the title of the player's job at that company + factions: An array of factions the player is currently a member of + tor: Boolean indicating whether or not you have a tor router } Example:: diff --git a/doc/source/netscript/basicfunctions/getPurchasedServerLimit.rst b/doc/source/netscript/basicfunctions/getPurchasedServerLimit.rst index 293187b18..930fa27fd 100644 --- a/doc/source/netscript/basicfunctions/getPurchasedServerLimit.rst +++ b/doc/source/netscript/basicfunctions/getPurchasedServerLimit.rst @@ -10,4 +10,4 @@ getPurchasedServerLimit() Netscript Function .. code-block:: javascript - getPurchasedServerLimit() // returns: 25 \ No newline at end of file + getPurchasedServerLimit() // returns: 25 diff --git a/doc/source/netscript/basicfunctions/getPurchasedServerMaxRam.rst b/doc/source/netscript/basicfunctions/getPurchasedServerMaxRam.rst index 1692f37a4..a70141abc 100644 --- a/doc/source/netscript/basicfunctions/getPurchasedServerMaxRam.rst +++ b/doc/source/netscript/basicfunctions/getPurchasedServerMaxRam.rst @@ -10,4 +10,4 @@ getPurchasedServerMaxRam() Netscript Function .. code-block:: javascript - getPurchasedServerMaxRam(); // returns: 1048576 \ No newline at end of file + getPurchasedServerMaxRam(); // returns: 1048576 diff --git a/doc/source/netscript/basicfunctions/getRunningScript.rst b/doc/source/netscript/basicfunctions/getRunningScript.rst index c88ddca25..de35d5c88 100644 --- a/doc/source/netscript/basicfunctions/getRunningScript.rst +++ b/doc/source/netscript/basicfunctions/getRunningScript.rst @@ -4,7 +4,7 @@ getRunningScript() Netscript Function .. js:function:: getRunningScript() :RAM cost: 0.3 GB - :returns: Script object or null if not found + :returns: Script object or null if not found. The object has the following properties: @@ -64,8 +64,8 @@ getRunningScript() Netscript Function .. js:function:: getRunningScript(pid) :RAM cost: 0.3 GB - :param number pid: PID of the script - :returns: Script object or null if not found + :param number pid: PID of the script. + :returns: Script object or null if not found. Examples: @@ -73,13 +73,13 @@ getRunningScript() Netscript Function getRunningScript(42); // get the script with pid 42. -.. js:function:: getRunningScript(fn, hostname[, args]) +.. js:function:: getRunningScript(fn, hostname[, args...]) :RAM cost: 0.3 GB - :param number fn: filename of the target script - :param number hostname: hostname of the server running the script - :param number args: arguments to the script. - :returns: Script object or null if not found + :param number fn: Filename of the target script. + :param number hostname: Hostname of the server running the script. + :param number args...: Arguments that the script is running with. + :returns: Script object or null if not found. Examples: diff --git a/doc/source/netscript/basicfunctions/getScriptExpGain.rst b/doc/source/netscript/basicfunctions/getScriptExpGain.rst index 2bdc50a38..71fa4b1a6 100644 --- a/doc/source/netscript/basicfunctions/getScriptExpGain.rst +++ b/doc/source/netscript/basicfunctions/getScriptExpGain.rst @@ -15,4 +15,3 @@ getScriptExpGain() Netscript Function .. note:: A script is uniquely identified by both its name and its arguments. - diff --git a/doc/source/netscript/basicfunctions/getScriptIncome.rst b/doc/source/netscript/basicfunctions/getScriptIncome.rst index 8dd1a4f3f..f0a6ce193 100644 --- a/doc/source/netscript/basicfunctions/getScriptIncome.rst +++ b/doc/source/netscript/basicfunctions/getScriptIncome.rst @@ -16,4 +16,4 @@ getScriptIncome() Netscript Function scripts since you last installed Augmentations. .. note:: A script is uniquely identified by both its name and its - arguments. \ No newline at end of file + arguments. diff --git a/doc/source/netscript/basicfunctions/getScriptLogs.rst b/doc/source/netscript/basicfunctions/getScriptLogs.rst index c4b15800a..b8ffe9e09 100644 --- a/doc/source/netscript/basicfunctions/getScriptLogs.rst +++ b/doc/source/netscript/basicfunctions/getScriptLogs.rst @@ -9,8 +9,8 @@ getScriptLogs() Netscript Function :param args...: Arguments to identify which scripts to get logs for :returns: Array of string, each line being a logged line. Chronological. -.. note:: There is a maximum number of lines that a script stores in its logs. - This is configurable in the game's options. + .. note:: There is a maximum number of lines that a script stores in its logs. + This is configurable in the game's options. If the function is called with no arguments, it will return the current script's logs. diff --git a/doc/source/netscript/basicfunctions/getServerGrowth.rst b/doc/source/netscript/basicfunctions/getServerGrowth.rst index e7a721fd4..f1455e2cb 100644 --- a/doc/source/netscript/basicfunctions/getServerGrowth.rst +++ b/doc/source/netscript/basicfunctions/getServerGrowth.rst @@ -7,10 +7,10 @@ getServerGrowth() Netscript Function :param string hostname: Hostname of target server. :returns: Server growth parameter. - The growth parameter is a number between 1 and 100 affects the percentage by - which the server's money is increased when using the :doc:`grow` - function. A higher growth parameter will result in a higher percentage - increase. + The growth parameter is a number, typically between 1 and 100, that affects + the percentage by which the server's money is increased when using the + :doc:`grow` function. A higher growth parameter will result in a + higher percentage increase. Example: diff --git a/doc/source/netscript/basicfunctions/getServerMaxMoney.rst b/doc/source/netscript/basicfunctions/getServerMaxMoney.rst index d9cc9017b..22ed9239b 100644 --- a/doc/source/netscript/basicfunctions/getServerMaxMoney.rst +++ b/doc/source/netscript/basicfunctions/getServerMaxMoney.rst @@ -5,10 +5,10 @@ getServerMaxMoney() Netscript Function :RAM cost: 0.1 GB :param string hostname: Hostname of target server. - :returns: Maximum amount of money that can be available on a server. + :returns: Maximum amount of money that can be available on a server. Example: .. code-block:: javascript - getServerMaxMoney('foodnstuff'); // returns: 4000000 + getServerMaxMoney('foodnstuff'); // returns: 50000000 diff --git a/doc/source/netscript/basicfunctions/getServerMoneyAvailable.rst b/doc/source/netscript/basicfunctions/getServerMoneyAvailable.rst index cdb30b98e..4e1a55993 100644 --- a/doc/source/netscript/basicfunctions/getServerMoneyAvailable.rst +++ b/doc/source/netscript/basicfunctions/getServerMoneyAvailable.rst @@ -16,4 +16,4 @@ getServerMoneyAvailable() Netscript Function .. code-block:: javascript getServerMoneyAvailable("foodnstuff"); // returns: 120000 - getServerMoneyAvailable("home"); // returns: 1000 \ No newline at end of file + getServerMoneyAvailable("home"); // returns: 1000 diff --git a/doc/source/netscript/basicfunctions/getServerRam.rst b/doc/source/netscript/basicfunctions/getServerRam.rst index 70d3ce032..b83bb22b6 100644 --- a/doc/source/netscript/basicfunctions/getServerRam.rst +++ b/doc/source/netscript/basicfunctions/getServerRam.rst @@ -3,12 +3,14 @@ getServerRam() Netscript Function .. js:function:: getServerRam(hostname) - .. warning:: This function is deprecated. + .. warning:: This function is deprecated. It still functions, but new + scripts should prefer :doc:`getServerMaxRam` + and :doc:`getServerUsedRam` instead. :RAM cost: 0.1 GB :param string hostname: Hostname of target server. - :returns: An array of 2 number, first number is the total RAM, second the - used RAM. + :returns: An array of 2 numbers; the first number is the total RAM, and the + second is the used RAM. Returns an array with two elements that gives information about a server's memory (RAM). The first element in the array is the amount of RAM that the server has total (in GB). The second element in diff --git a/doc/source/netscript/basicfunctions/getServerRequiredHackingLevel.rst b/doc/source/netscript/basicfunctions/getServerRequiredHackingLevel.rst index f006a1205..0c1934b40 100644 --- a/doc/source/netscript/basicfunctions/getServerRequiredHackingLevel.rst +++ b/doc/source/netscript/basicfunctions/getServerRequiredHackingLevel.rst @@ -11,4 +11,4 @@ getServerRequiredHackingLevel() Netscript Function .. code-block:: javascript - getServerRequiredHackingLevel("foodnstuff"); // returns: 5 \ No newline at end of file + getServerRequiredHackingLevel("foodnstuff"); // returns: 5 diff --git a/doc/source/netscript/basicfunctions/getServerSecurityLevel.rst b/doc/source/netscript/basicfunctions/getServerSecurityLevel.rst index b6dd116a4..45df8275c 100644 --- a/doc/source/netscript/basicfunctions/getServerSecurityLevel.rst +++ b/doc/source/netscript/basicfunctions/getServerSecurityLevel.rst @@ -11,4 +11,4 @@ getServerSecurityLevel() Netscript Function .. code-block:: javascript - getServerSecurityLevel("foodnstuff"); // returns: 3.45 \ No newline at end of file + getServerSecurityLevel("foodnstuff"); // returns: 3.45 diff --git a/doc/source/netscript/basicfunctions/getTimeSinceLastAug.rst b/doc/source/netscript/basicfunctions/getTimeSinceLastAug.rst index 877eeb7b8..c7651bda1 100644 --- a/doc/source/netscript/basicfunctions/getTimeSinceLastAug.rst +++ b/doc/source/netscript/basicfunctions/getTimeSinceLastAug.rst @@ -10,4 +10,4 @@ getTimeSinceLastAug() Netscript Function .. code-block:: javascript - getTimeSinceLastAug(); // returns: 13912400 \ No newline at end of file + getTimeSinceLastAug(); // returns: 13912400 diff --git a/doc/source/netscript/basicfunctions/hackChance.rst b/doc/source/netscript/basicfunctions/hackChance.rst index a5792da97..5b4d4baf3 100644 --- a/doc/source/netscript/basicfunctions/hackChance.rst +++ b/doc/source/netscript/basicfunctions/hackChance.rst @@ -13,4 +13,4 @@ hackChance() Netscript Function .. code-block:: javascript hackChance("foodnstuff"); // returns: .5 - // So 50% chance to hack "foodnstuff" \ No newline at end of file + // So 50% chance to hack "foodnstuff" diff --git a/doc/source/netscript/basicfunctions/httpworm.rst b/doc/source/netscript/basicfunctions/httpworm.rst index 41a3c9348..a58b236d7 100644 --- a/doc/source/netscript/basicfunctions/httpworm.rst +++ b/doc/source/netscript/basicfunctions/httpworm.rst @@ -6,8 +6,8 @@ httpworm() Netscript Function :RAM cost: 0.05 GB :param string hostname: Hostname of the target server. - Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist - on your home computer. + Runs the ``HTTPWorm.exe`` program on the target server. ``HTTPWorm.exe`` + must exist on your home computer. Example: diff --git a/doc/source/netscript/basicfunctions/isLogEnabled.rst b/doc/source/netscript/basicfunctions/isLogEnabled.rst index bcef52e91..2fbba0fbe 100644 --- a/doc/source/netscript/basicfunctions/isLogEnabled.rst +++ b/doc/source/netscript/basicfunctions/isLogEnabled.rst @@ -11,4 +11,4 @@ isLogEnabled() Netscript Function .. code-block:: javascript - isLogEnabled('hack'); // returns: true \ No newline at end of file + isLogEnabled('hack'); // returns: true diff --git a/doc/source/netscript/basicfunctions/killall.rst b/doc/source/netscript/basicfunctions/killall.rst index 305921fa9..f71e61ceb 100644 --- a/doc/source/netscript/basicfunctions/killall.rst +++ b/doc/source/netscript/basicfunctions/killall.rst @@ -14,4 +14,4 @@ killall() Netscript Function .. code-block:: javascript - killall('foodnstuff'); // returns: true \ No newline at end of file + killall('foodnstuff'); // returns: true diff --git a/doc/source/netscript/basicfunctions/ls.rst b/doc/source/netscript/basicfunctions/ls.rst index 27fda79b6..0645639fd 100644 --- a/doc/source/netscript/basicfunctions/ls.rst +++ b/doc/source/netscript/basicfunctions/ls.rst @@ -12,4 +12,4 @@ ls() Netscript Function .. code-block:: javascript - ls("home"); // returns: ["demo.script", "msg1.txt"] \ No newline at end of file + ls("home"); // returns: ["demo.script", "msg1.txt"] diff --git a/doc/source/netscript/basicfunctions/nuke.rst b/doc/source/netscript/basicfunctions/nuke.rst index 4e53e3161..cc1b43fea 100644 --- a/doc/source/netscript/basicfunctions/nuke.rst +++ b/doc/source/netscript/basicfunctions/nuke.rst @@ -6,7 +6,8 @@ nuke() Netscript Function :RAM cost: 0.05 GB :param string hostname: Hostname of the target server. - Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer. + Runs the ``NUKE.exe`` program on the target server. ``NUKE.exe`` must exist + on your home computer. Example: diff --git a/doc/source/netscript/basicfunctions/print.rst b/doc/source/netscript/basicfunctions/print.rst index 4c4fa9015..83ceafaa9 100644 --- a/doc/source/netscript/basicfunctions/print.rst +++ b/doc/source/netscript/basicfunctions/print.rst @@ -13,4 +13,4 @@ print() Netscript Function .. code-block:: javascript print("Hello world!"); // Prints "Hello world!" in the logs. - print({a:5}); // Prints '{"a":5}' in the logs. \ No newline at end of file + print({a:5}); // Prints '{"a":5}' in the logs. diff --git a/doc/source/netscript/basicfunctions/prompt.rst b/doc/source/netscript/basicfunctions/prompt.rst index da651ac90..c2e7629f7 100644 --- a/doc/source/netscript/basicfunctions/prompt.rst +++ b/doc/source/netscript/basicfunctions/prompt.rst @@ -20,4 +20,4 @@ prompt() Netscript Function answer = prompt("Buy a server for $"+cost); if(answer) { purchaseServer("my server", 8192); - } \ No newline at end of file + } diff --git a/doc/source/netscript/basicfunctions/relaysmtp.rst b/doc/source/netscript/basicfunctions/relaysmtp.rst index 5081e54d8..a62ee8571 100644 --- a/doc/source/netscript/basicfunctions/relaysmtp.rst +++ b/doc/source/netscript/basicfunctions/relaysmtp.rst @@ -6,9 +6,8 @@ relaysmtp() Netscript Function :RAM cost: 0.05 GB :param string hostname: Hostname of the target server. - - Runs the relaySMTP.exe program on the target server. relaySMTP.exe must - exist on your home computer. + Runs the ``relaySMTP.exe`` program on the target server. ``relaySMTP.exe`` + must exist on your home computer. Example: diff --git a/doc/source/netscript/basicfunctions/run.rst b/doc/source/netscript/basicfunctions/run.rst index b7ef167e6..c467e9694 100644 --- a/doc/source/netscript/basicfunctions/run.rst +++ b/doc/source/netscript/basicfunctions/run.rst @@ -17,9 +17,8 @@ run() Netscript Function scripts located on the current server (the server running the script that calls this function). - .. warning:: Running this function with a ``numThreads`` argument of 0 will - return 0 without running the script. However, running this function with - a negative ``numThreads`` argument will cause a runtime error. + .. warning:: Running this function with a ``numThreads`` argument of 0 or + less will cause a runtime error. The simplest way to use the :doc:`run` command is to call it with just the script name. The following example will run ``foo.script`` diff --git a/doc/source/netscript/basicfunctions/scan.rst b/doc/source/netscript/basicfunctions/scan.rst index 1db16bc3f..738712dc8 100644 --- a/doc/source/netscript/basicfunctions/scan.rst +++ b/doc/source/netscript/basicfunctions/scan.rst @@ -12,4 +12,4 @@ scan() Netscript Function .. code-block:: javascript - scan("home"); // returns: ["foodnstuff", "sigma-cosmetics", "joesguns", "hong-fang-tea", "harakiri-sushi", "iron-gym"] \ No newline at end of file + scan("home"); // returns: ["foodnstuff", "sigma-cosmetics", "joesguns", "hong-fang-tea", "harakiri-sushi", "iron-gym"] diff --git a/doc/source/netscript/basicfunctions/scp.rst b/doc/source/netscript/basicfunctions/scp.rst index 93a8436a3..e813f38e0 100644 --- a/doc/source/netscript/basicfunctions/scp.rst +++ b/doc/source/netscript/basicfunctions/scp.rst @@ -9,7 +9,7 @@ scp() Netscript Function Hostname of the source server, which is the server from which the file will be copied. This argument is optional and if it's omitted the source will be the current server. :param string destination: Hostname of the destination server, which is the server to which the file will be copied. - :returns: ``true`` is the copy was a success. + :returns: ``true`` if the copy was a success. Copies a script or literature (.lit) file(s) to another server. The ``files`` argument can be either a string specifying a single file to copy, diff --git a/doc/source/netscript/basicfunctions/serverExists.rst b/doc/source/netscript/basicfunctions/serverExists.rst index 76a8f6228..040bbe09c 100644 --- a/doc/source/netscript/basicfunctions/serverExists.rst +++ b/doc/source/netscript/basicfunctions/serverExists.rst @@ -11,4 +11,4 @@ serverExists() Netscript Function .. code-block:: javascript - serverExists("foodnstuff"); // returns: true \ No newline at end of file + serverExists("foodnstuff"); // returns: true diff --git a/doc/source/netscript/basicfunctions/sleep.rst b/doc/source/netscript/basicfunctions/sleep.rst index d46c176dd..59f553a2d 100644 --- a/doc/source/netscript/basicfunctions/sleep.rst +++ b/doc/source/netscript/basicfunctions/sleep.rst @@ -8,9 +8,8 @@ sleep() Netscript Function Suspends the script for n milliseconds. - Example: .. code-block:: javascript - sleep(3000); // Will wait 3 seconds. \ No newline at end of file + sleep(3000); // Will wait 3 seconds. diff --git a/doc/source/netscript/basicfunctions/spawn.rst b/doc/source/netscript/basicfunctions/spawn.rst index 538bf39e2..504be08a0 100644 --- a/doc/source/netscript/basicfunctions/spawn.rst +++ b/doc/source/netscript/basicfunctions/spawn.rst @@ -16,6 +16,8 @@ spawn() Netscript Function current one. This function can only be used to run scripts on the local server. + .. warning:: Running this function with a ``numThreads`` argument of 0 or + less will cause a runtime error. Example: diff --git a/doc/source/netscript/basicfunctions/sqlinject.rst b/doc/source/netscript/basicfunctions/sqlinject.rst index 24ee86142..b4cf5d725 100644 --- a/doc/source/netscript/basicfunctions/sqlinject.rst +++ b/doc/source/netscript/basicfunctions/sqlinject.rst @@ -6,8 +6,8 @@ sqlinject() Netscript Function :RAM cost: 0.05 GB :param string hostname: Hostname of the target server. - Runs the SQLInject.exe program on the target server. SQLInject.exe must - exist on your home computer. + Runs the ``SQLInject.exe`` program on the target server. ``SQLInject.exe`` + must exist on your home computer. Example: diff --git a/doc/source/netscript/basicfunctions/tail.rst b/doc/source/netscript/basicfunctions/tail.rst index 6af274189..fd4adc474 100644 --- a/doc/source/netscript/basicfunctions/tail.rst +++ b/doc/source/netscript/basicfunctions/tail.rst @@ -44,9 +44,6 @@ tail() Netscript Function // Open logs from process with id 42 tail(42); - // Open logs from process with id 42 on the foodnstuff server - tail(42, "foodnstuff"); - .. js:function:: tail() :RAM cost: 0 GB diff --git a/doc/source/netscript/basicfunctions/tprint.rst b/doc/source/netscript/basicfunctions/tprint.rst index 1693b131d..1c80745e3 100644 --- a/doc/source/netscript/basicfunctions/tprint.rst +++ b/doc/source/netscript/basicfunctions/tprint.rst @@ -13,4 +13,4 @@ tprint() Netscript Function .. code-block:: javascript tprint("Hello world!"); // Prints "Hello world!" to the terminal. - tprint({a:5}); // Prints '{"a":5}' to the terminal. \ No newline at end of file + tprint({a:5}); // Prints '{"a":5}' to the terminal. diff --git a/doc/source/netscript/basicfunctions/tryWrite.rst b/doc/source/netscript/basicfunctions/tryWrite.rst index 2264c466c..ec37c351a 100644 --- a/doc/source/netscript/basicfunctions/tryWrite.rst +++ b/doc/source/netscript/basicfunctions/tryWrite.rst @@ -11,4 +11,4 @@ tryWrite() Netscript Function Attempts to write data to the specified Netscript Port. If the port is full, the data will not be written. Otherwise, the data will be written normally. - See :ref:`netscript_ports` for more details. \ No newline at end of file + See :ref:`netscript_ports` for more details. diff --git a/doc/source/netscript/basicfunctions/write.rst b/doc/source/netscript/basicfunctions/write.rst index 497e8b54c..656996632 100644 --- a/doc/source/netscript/basicfunctions/write.rst +++ b/doc/source/netscript/basicfunctions/write.rst @@ -8,7 +8,6 @@ write() Netscript Function :param string data: Data to write :param string mode: Defines the write mode. Only valid when writing to text files or scripts. - This function can be used to either write data to a port, a text file (.txt), or a script (.script, .js, .ns) diff --git a/doc/source/netscript/codingcontractapi/getData.rst b/doc/source/netscript/codingcontractapi/getData.rst index 6476734e1..f067674a5 100644 --- a/doc/source/netscript/codingcontractapi/getData.rst +++ b/doc/source/netscript/codingcontractapi/getData.rst @@ -11,8 +11,8 @@ getData() Netscript Function contract type. Get the data associated with the specific Coding Contract. Note that this is - not the same as the contract's description. This is just the data that - the contract wants you to act on in order to solve + not the same as the contract's description; this is just the data that + the contract wants you to act on in order to solve. Example: @@ -20,4 +20,4 @@ getData() Netscript Function data = codingcontract.getData("contract-123.cct", "home"); answer = solve(data); - codingcontract.attempt(answer, "contract-123.cct", "home"); \ No newline at end of file + codingcontract.attempt(answer, "contract-123.cct", "home"); diff --git a/doc/source/netscript/codingcontractapi/getDescription.rst b/doc/source/netscript/codingcontractapi/getDescription.rst index 62fa67d88..c6dc50713 100644 --- a/doc/source/netscript/codingcontractapi/getDescription.rst +++ b/doc/source/netscript/codingcontractapi/getDescription.rst @@ -15,4 +15,4 @@ getDescription() Netscript Function .. code-block:: javascript - codingcontract.getDescription("contract-123.cct", "home"); \ No newline at end of file + codingcontract.getDescription("contract-123.cct", "home"); diff --git a/doc/source/netscript/codingcontractapi/getNumTriesRemaining.rst b/doc/source/netscript/codingcontractapi/getNumTriesRemaining.rst index 7e8f90207..9f0b469e3 100644 --- a/doc/source/netscript/codingcontractapi/getNumTriesRemaining.rst +++ b/doc/source/netscript/codingcontractapi/getNumTriesRemaining.rst @@ -16,4 +16,4 @@ getNumTriesRemaining() Netscript Function .. code-block:: javascript - codingcontract.getNumTriesRemaining("contract-123.cct", "home"); // returns: 5 \ No newline at end of file + codingcontract.getNumTriesRemaining("contract-123.cct", "home"); // returns: 5 diff --git a/doc/source/netscript/formulasapi/basic/calculateExp.rst b/doc/source/netscript/formulasapi/basic/calculateExp.rst index 3120e697a..cc715f246 100644 --- a/doc/source/netscript/formulasapi/basic/calculateExp.rst +++ b/doc/source/netscript/formulasapi/basic/calculateExp.rst @@ -8,15 +8,18 @@ calculateExp() Netscript Function :param number mult: Assume a specific skill multipler (not exp multiplier). :returns: number of exp required to reach given ``skillLevel`` with that multiplier. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. - This function calculates the amount of experience needed to reach level the given ``skillLevel``. + This function calculates the amount of experience needed to reach the given + ``skillLevel``. Examples: .. code-block:: javascript - nextHacking = getStats().hacking+1; + player = getPlayer(); + nextHacking = player.hacking_skill+1; nextExp = formulas.basic.calculateExp(nextHacking); - missingExp = nextExp - getCharacterInformation().hackingExp; + missingExp = nextExp - player.hacking_exp; tprint("Missing " + missingExp + " to reach next hacking level"); diff --git a/doc/source/netscript/formulasapi/basic/calculateSkill.rst b/doc/source/netscript/formulasapi/basic/calculateSkill.rst index 6d70686b6..48e157102 100644 --- a/doc/source/netscript/formulasapi/basic/calculateSkill.rst +++ b/doc/source/netscript/formulasapi/basic/calculateSkill.rst @@ -8,7 +8,8 @@ calculateSkill() Netscript Function :param number mult: Assume a specific skill multipler (not exp multiplier). :returns: skillLevel that ``exp`` would reach with that multiplier. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. This function calculates the skillLevel that the given amount of ``exp`` would reach. diff --git a/doc/source/netscript/formulasapi/basic/growPercent.rst b/doc/source/netscript/formulasapi/basic/growPercent.rst index b29fd6b82..4dd3f7634 100644 --- a/doc/source/netscript/formulasapi/basic/growPercent.rst +++ b/doc/source/netscript/formulasapi/basic/growPercent.rst @@ -7,17 +7,21 @@ growPercent() Netscript Function :param server server: The server that receives the growth. :param number threads: The number of thread that would be used. :param player player: The player. - :returns: The percentage growth this server would receive with these parameters. + :returns: The amount the server's money would be multiplied by with these + parameters. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function. - Player can be acquired with the :doc:`getPlayer<../../singularityfunctions/getPlayer>` function. + Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function. - This function calculates percentage of growth a server would receive with these parameters. + This function calculates the amount of growth, as a multiplier, a server + would receive with these parameters. Despite its name, it does not return + a percentage. Examples: .. code-block:: javascript - tprint(formulas.basic.growPercent(getServer(), 50, getPlayer())) \ No newline at end of file + tprint(formulas.basic.growPercent(getServer(), 50, getPlayer())) diff --git a/doc/source/netscript/formulasapi/basic/growTime.rst b/doc/source/netscript/formulasapi/basic/growTime.rst index 84673887d..ec04ec3c6 100644 --- a/doc/source/netscript/formulasapi/basic/growTime.rst +++ b/doc/source/netscript/formulasapi/basic/growTime.rst @@ -8,10 +8,11 @@ growTime() Netscript Function :param player player: The player. :returns: The time it takes to grow this server. In seconds. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function. - Player can be acquired with the :doc:`getPlayer<../../singularityfunctions/getPlayer>` function. + Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function. This function calculates the amount of time it takes to grow a server. @@ -21,4 +22,4 @@ growTime() Netscript Function server = getServer(); server.hackDifficulty = server.minDifficulty; - tprint(formulas.basic.growTime(server, getPlayer())); \ No newline at end of file + tprint(formulas.basic.growTime(server, getPlayer())); diff --git a/doc/source/netscript/formulasapi/basic/hackChance.rst b/doc/source/netscript/formulasapi/basic/hackChance.rst index 81194deb3..c0515383b 100644 --- a/doc/source/netscript/formulasapi/basic/hackChance.rst +++ b/doc/source/netscript/formulasapi/basic/hackChance.rst @@ -6,14 +6,15 @@ hackChance() Netscript Function :RAM cost: 0 GB :param server server: The server to hack. :param player player: The player. - :returns: The change to hack that server. between 0 and 1. + :returns: The chance to hack that server, between 0 and 1. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function. - Player can be acquired with the :doc:`getPlayer<../../singularityfunctions/getPlayer>` function. + Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function. - This function calculates percentage chance to hack a server. + This function calculates the probability to successfully hack a server. Examples: @@ -21,4 +22,4 @@ hackChance() Netscript Function server = getServer(); server.hackDifficulty = server.minDifficulty; - tprint(formulas.basic.hackChance(server, getPlayer())); \ No newline at end of file + tprint(formulas.basic.hackChance(server, getPlayer())); diff --git a/doc/source/netscript/formulasapi/basic/hackExp.rst b/doc/source/netscript/formulasapi/basic/hackExp.rst index 1654327dc..38d49b7df 100644 --- a/doc/source/netscript/formulasapi/basic/hackExp.rst +++ b/doc/source/netscript/formulasapi/basic/hackExp.rst @@ -8,10 +8,11 @@ hackExp() Netscript Function :param player player: The player. :returns: The amount of exp that would be acquired if this server were to be hacked. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function. - Player can be acquired with the :doc:`getPlayer<../../singularityfunctions/getPlayer>` function. + Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function. This function calculates the amount of exp obtained by hacking a server. @@ -19,6 +20,4 @@ hackExp() Netscript Function .. code-block:: javascript - server = getServer(); - server.hackDifficulty = 99.9; - tprint(formulas.basic.hackExp(server, getPlayer())); \ No newline at end of file + tprint(formulas.basic.hackExp(getServer(), getPlayer())); diff --git a/doc/source/netscript/formulasapi/basic/hackPercent.rst b/doc/source/netscript/formulasapi/basic/hackPercent.rst index 7b85663cd..014f676dc 100644 --- a/doc/source/netscript/formulasapi/basic/hackPercent.rst +++ b/doc/source/netscript/formulasapi/basic/hackPercent.rst @@ -6,14 +6,15 @@ hackPercent() Netscript Function :RAM cost: 0 GB :param server server: The server to hack. :param player player: The player. - :returns: The percentage of money hacked from a servers maximum money. + :returns: The percentage of money hacked from the server's money. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function. - Player can be acquired with the :doc:`getPlayer<../../singularityfunctions/getPlayer>` function. + Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function. - This function calculates the percentage of maximum money hacked from a server. + This function calculates the percentage of money hacked from a server. Multiply this by thread count to know calculate the percentage for more than 1 thread. Examples: @@ -22,4 +23,4 @@ hackPercent() Netscript Function server = getServer(); server.hackDifficulty = server.minDifficulty; - tprint(formulas.basic.hackPercent(server, getPlayer())); \ No newline at end of file + tprint(formulas.basic.hackPercent(server, getPlayer())); diff --git a/doc/source/netscript/formulasapi/basic/hackTime.rst b/doc/source/netscript/formulasapi/basic/hackTime.rst index 81d3089e0..64e7fa8c1 100644 --- a/doc/source/netscript/formulasapi/basic/hackTime.rst +++ b/doc/source/netscript/formulasapi/basic/hackTime.rst @@ -8,10 +8,11 @@ hackTime() Netscript Function :param player player: The player. :returns: The time it takes to hack this server. In seconds. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function. - Player can be acquired with the :doc:`getPlayer<../../singularityfunctions/getPlayer>` function. + Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function. This function calculates the amount of time it takes to hack a server. @@ -21,4 +22,4 @@ hackTime() Netscript Function server = getServer(); server.hackDifficulty = server.minDifficulty; - tprint(formulas.basic.hackTime(server, getPlayer())); \ No newline at end of file + tprint(formulas.basic.hackTime(server, getPlayer())); diff --git a/doc/source/netscript/formulasapi/basic/weakenTime.rst b/doc/source/netscript/formulasapi/basic/weakenTime.rst index 3a050640c..4e9f0276f 100644 --- a/doc/source/netscript/formulasapi/basic/weakenTime.rst +++ b/doc/source/netscript/formulasapi/basic/weakenTime.rst @@ -8,10 +8,11 @@ weakenTime() Netscript Function :param player player: The player. :returns: The time it takes to weaken this server. In seconds. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. Server can be acquired with the :doc:`getServer<../../advancedfunctions/getServer>` function. - Player can be acquired with the :doc:`getPlayer<../../singularityfunctions/getPlayer>` function. + Player can be acquired with the :doc:`getPlayer<../../basicfunctions/getPlayer>` function. This function calculates the amount of time it takes to weaken a server. @@ -21,4 +22,4 @@ weakenTime() Netscript Function server = getServer(); server.hackDifficulty = server.minDifficulty; - tprint(formulas.basic.weakenTime(server, getPlayer())); \ No newline at end of file + tprint(formulas.basic.weakenTime(server, getPlayer())); diff --git a/doc/source/netscript/formulasapi/hacknetNodes/constants.rst b/doc/source/netscript/formulasapi/hacknetNodes/constants.rst index 1bed5e6f5..d13026f32 100644 --- a/doc/source/netscript/formulasapi/hacknetNodes/constants.rst +++ b/doc/source/netscript/formulasapi/hacknetNodes/constants.rst @@ -6,21 +6,28 @@ constants() Netscript Function :RAM cost: 0 GB :returns: A structure with various constants related to hacknet nodes. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. + + Returns an object with the following properties:: + + { + MoneyGainPerLevel: Multiplied by the node's level to get the node's base income + BaseCost: A multiplier used when buying new nodes or upgrading levels + LevelBaseCost: A multiplier used when upgrading levels + RamBaseCost: A multiplier used when upgrading RAM + CoreBaseCost: A multiplier used when buying additional cores + PurchaseNextMult: The root of an exponent used when buying new nodes + UpgradeLevelMult: The root of an exponent used when upgrading levels + UpgradeRamMult: The root of an exponent used when upgrading RAM + UpgradeCoreMult: The root of an exponent used when buying additional cores + MaxLevel: Maximum level a node can have + MaxRam: Maximum RAM a node can have + MaxCores: Maximum number of cores a node can have + } + Examples: .. code-block:: javascript - { - MoneyGainPerLevel - BaseCost - LevelBaseCost - RamBaseCost - CoreBaseCost - PurchaseNextMult - UpgradeLevelMult - UpgradeRamMult - UpgradeCoreMult - MaxLevel - MaxRam - MaxCores - } \ No newline at end of file + tprint("Maximum RAM a hacknet node can have: "+formulas.hacknetNodes.constants().MaxRam+" GB."); diff --git a/doc/source/netscript/formulasapi/hacknetNodes/coreUpgradeCost.rst b/doc/source/netscript/formulasapi/hacknetNodes/coreUpgradeCost.rst index 0dc223c4a..6f84eb794 100644 --- a/doc/source/netscript/formulasapi/hacknetNodes/coreUpgradeCost.rst +++ b/doc/source/netscript/formulasapi/hacknetNodes/coreUpgradeCost.rst @@ -9,7 +9,8 @@ coreUpgradeCost() Netscript Function :param number costMult: Aug multiplier that reduces cost. Defaults to ``1``. :returns: Money required to go from ``startingCores`` to ``startingCores+extraCores``. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. This function calculates the cost of upgrading cores from any level to any level. diff --git a/doc/source/netscript/formulasapi/hacknetNodes/hacknetNodeCost.rst b/doc/source/netscript/formulasapi/hacknetNodes/hacknetNodeCost.rst index edf272dff..71a9b9523 100644 --- a/doc/source/netscript/formulasapi/hacknetNodes/hacknetNodeCost.rst +++ b/doc/source/netscript/formulasapi/hacknetNodes/hacknetNodeCost.rst @@ -8,7 +8,8 @@ hacknetNodeCost() Netscript Function :param number costMult: Aug multiplier that reduces cost. Defaults to ``1``. :returns: Money required to buy your ``nodeN`` th node. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. This function calculates the cost purchasing a hacknet node. diff --git a/doc/source/netscript/formulasapi/hacknetNodes/levelUpgradeCost.rst b/doc/source/netscript/formulasapi/hacknetNodes/levelUpgradeCost.rst index 89ca7e9eb..a700a00c3 100644 --- a/doc/source/netscript/formulasapi/hacknetNodes/levelUpgradeCost.rst +++ b/doc/source/netscript/formulasapi/hacknetNodes/levelUpgradeCost.rst @@ -9,7 +9,8 @@ levelUpgradeCost() Netscript Function :param number costMult: Aug multiplier that reduces cost. Defaults to ``1``. :returns: Money required to go from ``startingLevel`` to ``startingLevel+extraLevels``. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. This function calculates the cost of upgrading levels from any level to any level. @@ -17,4 +18,4 @@ levelUpgradeCost() Netscript Function .. code-block:: javascript - formulas.hacknetNodes.levelUpgradeCost(1, 5); // returns: 2816 \ No newline at end of file + formulas.hacknetNodes.levelUpgradeCost(1, 5); // returns: 2816 diff --git a/doc/source/netscript/formulasapi/hacknetNodes/moneyGainRate.rst b/doc/source/netscript/formulasapi/hacknetNodes/moneyGainRate.rst index f9f4ed218..05e5b390c 100644 --- a/doc/source/netscript/formulasapi/hacknetNodes/moneyGainRate.rst +++ b/doc/source/netscript/formulasapi/hacknetNodes/moneyGainRate.rst @@ -9,7 +9,8 @@ moneyGainRate() Netscript Function :param number core: cores of the node. :returns: Money per second that a node with those stats would gain per second. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. This function calculates the money rate of a node with the given stats. @@ -21,4 +22,4 @@ moneyGainRate() Netscript Function currentRate = formulas.hacknetNodes.moneyGainRate(node.level, node.ram, node.cores); levelRate = formulas.hacknetNodes.moneyGainRate(node.level+1, node.ram, node.cores); ramRate = formulas.hacknetNodes.moneyGainRate(node.level, node.ram*2, node.cores); - coresRate = formulas.hacknetNodes.moneyGainRate(node.level, node.ram, node.cores+1); \ No newline at end of file + coresRate = formulas.hacknetNodes.moneyGainRate(node.level, node.ram, node.cores+1); diff --git a/doc/source/netscript/formulasapi/hacknetNodes/ramUpgradeCost.rst b/doc/source/netscript/formulasapi/hacknetNodes/ramUpgradeCost.rst index 46f76caad..a7e517acf 100644 --- a/doc/source/netscript/formulasapi/hacknetNodes/ramUpgradeCost.rst +++ b/doc/source/netscript/formulasapi/hacknetNodes/ramUpgradeCost.rst @@ -11,7 +11,8 @@ ramUpgradeCost() Netscript Function ..note:: ``startingRam`` is the actual amount of ram, not the amount of levels of ram. - You must have Source-File 5-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. This function calculates the cost of upgrading levels from any level to any level. @@ -19,4 +20,4 @@ ramUpgradeCost() Netscript Function .. code-block:: javascript - formulas.hacknetNodes.ramUpgradeCost(1, 5); // returns: 2095000 \ No newline at end of file + formulas.hacknetNodes.ramUpgradeCost(1, 5); // returns: 2095000 diff --git a/doc/source/netscript/formulasapi/hacknetServers/cacheUpgradeCost.rst b/doc/source/netscript/formulasapi/hacknetServers/cacheUpgradeCost.rst index 3ac65b95e..ebf124a3c 100644 --- a/doc/source/netscript/formulasapi/hacknetServers/cacheUpgradeCost.rst +++ b/doc/source/netscript/formulasapi/hacknetServers/cacheUpgradeCost.rst @@ -9,7 +9,9 @@ cacheUpgradeCost() Netscript Function :param number costMult: Aug multiplier that reduces cost. Defaults to ``1``. :returns: Money required to go from ``startingLevel`` to ``startingLevel+extraLevels``. - You must have Source-File 5-1 and Source-File 9-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. In addition, if you are not in BitNode-9, then you must + have Source-File 9-1 in order to use this function. This function calculates the cost of upgrading cache from any level to any level. diff --git a/doc/source/netscript/formulasapi/hacknetServers/constants.rst b/doc/source/netscript/formulasapi/hacknetServers/constants.rst index efd2369c5..490ce8041 100644 --- a/doc/source/netscript/formulasapi/hacknetServers/constants.rst +++ b/doc/source/netscript/formulasapi/hacknetServers/constants.rst @@ -6,24 +6,32 @@ constants() Netscript Function :RAM cost: 0 GB :returns: A structure with various constants related to hacknet servers. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. In addition, if you are not in BitNode-9, then you must + have Source-File 9-1 in order to use this function. + + Returns an object with the following properties:: + + { + HashesPerLevel: Multiplied by the server's level to get the server's base income + BaseCost: A multiplier used when buying new nodes or upgrading levels + RamBaseCost: A multiplier used when upgrading RAM + CoreBaseCost: A multiplier used when buying additional cores + CacheBaseCost: A multiplier used when upgrading cache + PurchaseMult: The root of an exponent used when buying new servers + UpgradeLevelMult: The root of an exponent used when upgrading levels + UpgradeRamMult: The root of an exponent used when upgrading RAM + UpgradeCoreMult: The root of an exponent used when buying additional cores + UpgradeCacheMult: The root of an exponent used when upgrading cache + MaxServers: Maximum number of hacknet servers you can own + MaxLevel: Maximum level a server can have + MaxRam: Maximum RAM a server can have + MaxCores: Maximum number of cores a server can have + MaxCache: Maximum cache a server can have + } + Examples: .. code-block:: javascript - { - HashesPerLevel - BaseCost - RamBaseCost - CoreBaseCost - CacheBaseCost - PurchaseMult - UpgradeLevelMult - UpgradeRamMult - UpgradeCoreMult - UpgradeCacheMult - MaxServers - MaxLevel - MaxRam - MaxCores - MaxCache - } \ No newline at end of file + tprint("Maximum RAM a hacknet server can have: "+formulas.hacknetServers.constants().MaxRam+" GB"); diff --git a/doc/source/netscript/formulasapi/hacknetServers/coreUpgradeCost.rst b/doc/source/netscript/formulasapi/hacknetServers/coreUpgradeCost.rst index e37060c74..26bc6ed2f 100644 --- a/doc/source/netscript/formulasapi/hacknetServers/coreUpgradeCost.rst +++ b/doc/source/netscript/formulasapi/hacknetServers/coreUpgradeCost.rst @@ -9,7 +9,9 @@ coreUpgradeCost() Netscript Function :param number costMult: Aug multiplier that reduces cost. Defaults to ``1``. :returns: Money required to go from ``startingCores`` to ``startingCores+extraCores``. - You must have Source-File 5-1 and Source-File 9-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. In addition, if you are not in BitNode-9, then you must + have Source-File 9-1 in order to use this function. This function calculates the cost of upgrading cores from any level to any level. diff --git a/doc/source/netscript/formulasapi/hacknetServers/hacknetServerCost.rst b/doc/source/netscript/formulasapi/hacknetServers/hacknetServerCost.rst index 2906194e9..223678b53 100644 --- a/doc/source/netscript/formulasapi/hacknetServers/hacknetServerCost.rst +++ b/doc/source/netscript/formulasapi/hacknetServers/hacknetServerCost.rst @@ -8,7 +8,9 @@ hacknetServerCost() Netscript Function :param number costMult: Aug multiplier that reduces cost. Defaults to ``1``. :returns: Money required to buy your ``serverN`` th node. - You must have Source-File 5-1 and Source-File 9-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. In addition, if you are not in BitNode-9, then you must + have Source-File 9-1 in order to use this function. This function calculates the cost purchasing a hacknet node. diff --git a/doc/source/netscript/formulasapi/hacknetServers/hashGainRate.rst b/doc/source/netscript/formulasapi/hacknetServers/hashGainRate.rst index b6a530e52..e049f6d38 100644 --- a/doc/source/netscript/formulasapi/hacknetServers/hashGainRate.rst +++ b/doc/source/netscript/formulasapi/hacknetServers/hashGainRate.rst @@ -10,7 +10,9 @@ hashGainRate() Netscript Function :param number core: cores of the server. :returns: Money per second that a server with those stats would gain per second. - You must have Source-File 5-1 and Source-File 9-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. In addition, if you are not in BitNode-9, then you must + have Source-File 9-1 in order to use this function. This function calculates the hash rate of a server with the given stats. @@ -19,7 +21,7 @@ hashGainRate() Netscript Function .. code-block:: javascript server = hacknet.getNodeStats(1); - currentRate = formulas.hacknetNodes.hashGainRate(server.level, 0, server.ram, server.cores); - levelRate = formulas.hacknetNodes.hashGainRate(server.level+1, 0, server.ram, server.cores); - ramRate = formulas.hacknetNodes.hashGainRate(server.level, 0, server.ram*2, server.cores); - coresRate = formulas.hacknetNodes.hashGainRate(server.level, 0, server.ram, server.cores+1); \ No newline at end of file + currentRate = formulas.hacknetServers.hashGainRate(server.level, 0, server.ram, server.cores); + levelRate = formulas.hacknetServers.hashGainRate(server.level+1, 0, server.ram, server.cores); + ramRate = formulas.hacknetServers.hashGainRate(server.level, 0, server.ram*2, server.cores); + coresRate = formulas.hacknetServers.hashGainRate(server.level, 0, server.ram, server.cores+1); diff --git a/doc/source/netscript/formulasapi/hacknetServers/hashUpgradeCost.rst b/doc/source/netscript/formulasapi/hacknetServers/hashUpgradeCost.rst index d54b0dcf6..e7e0bcbf3 100644 --- a/doc/source/netscript/formulasapi/hacknetServers/hashUpgradeCost.rst +++ b/doc/source/netscript/formulasapi/hacknetServers/hashUpgradeCost.rst @@ -8,7 +8,9 @@ hashUpgradeCost() Netscript Function :param number level: Level of the upgrade. :returns: Amount of Hash. - You must have Source-File 5-1 and Source-File 9-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. In addition, if you are not in BitNode-9, then you must + have Source-File 9-1 in order to use this function. This function calculates amount of Hash require to buy level ``level`` of upgrade ``upgName``. diff --git a/doc/source/netscript/formulasapi/hacknetServers/levelUpgradeCost.rst b/doc/source/netscript/formulasapi/hacknetServers/levelUpgradeCost.rst index d69c71142..99893c3c1 100644 --- a/doc/source/netscript/formulasapi/hacknetServers/levelUpgradeCost.rst +++ b/doc/source/netscript/formulasapi/hacknetServers/levelUpgradeCost.rst @@ -9,7 +9,9 @@ levelUpgradeCost() Netscript Function :param number costMult: Aug multiplier that reduces cost. Defaults to ``1``. :returns: Money required to go from ``startingLevel`` to ``startingLevel+extraLevels``. - You must have Source-File 5-1 and Source-File 9-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. In addition, if you are not in BitNode-9, then you must + have Source-File 9-1 in order to use this function. This function calculates the cost of upgrading levels from any level to any level. @@ -17,4 +19,4 @@ levelUpgradeCost() Netscript Function .. code-block:: javascript - formulas.hacknetServers.levelUpgradeCost(1, 5); // returns: 2792000 \ No newline at end of file + formulas.hacknetServers.levelUpgradeCost(1, 5); // returns: 2792000 diff --git a/doc/source/netscript/formulasapi/hacknetServers/ramUpgradeCost.rst b/doc/source/netscript/formulasapi/hacknetServers/ramUpgradeCost.rst index 8f2d96fcc..0da238289 100644 --- a/doc/source/netscript/formulasapi/hacknetServers/ramUpgradeCost.rst +++ b/doc/source/netscript/formulasapi/hacknetServers/ramUpgradeCost.rst @@ -11,7 +11,9 @@ ramUpgradeCost() Netscript Function ..note:: ``startingRam`` is the actual amount of ram, not the amount of levels of ram. - You must have Source-File 5-1 and Source-File 9-1 in order to use this function. + If you are not in BitNode-5, then you must have Source-File 5-1 in order to + use this function. In addition, if you are not in BitNode-9, then you must + have Source-File 9-1 in order to use this function. This function calculates the cost of upgrading levels from any level to any level. @@ -19,4 +21,4 @@ ramUpgradeCost() Netscript Function .. code-block:: javascript - formulas.hacknetServers.ramUpgradeCost(1, 5); // returns: 15810000 \ No newline at end of file + formulas.hacknetServers.ramUpgradeCost(1, 5); // returns: 15810000 diff --git a/doc/source/netscript/netscriptformulasapi.rst b/doc/source/netscript/netscriptformulasapi.rst index 6a48af820..1e6a3ef55 100644 --- a/doc/source/netscript/netscriptformulasapi.rst +++ b/doc/source/netscript/netscriptformulasapi.rst @@ -8,15 +8,19 @@ Netscript Formulas Functions The formulas API allow you to gain insight into the inner workings of the game. These functions will allow you to make more informed decision. -All of these function cost 0 GB of ram to use. All these function require -Source-File 5-1 but some additionally need another source file level 1 to use. +The formulas API is unlocked in BitNode-5. If you are in BitNode-5, you will +automatically gain access to this API. Otherwise, you must have Source-File 5-1 +in order to use this API in other BitNodes. Additionally, some functions need +another source file level 1 to use. + +All of these function cost 0 GB of ram to use. basic formulas -------------- These functions are under the ``formulas.basic.`` name space and available as -soon as you acquire Source-File 5-1 +soon as you enter BitNode-5 or acquire Source-File 5-1. .. toctree:: calculateSkill() @@ -34,7 +38,7 @@ hacknetNodes formulas --------------------- These functions are under the ``formulas.hacknetNodes.`` namespace and available as -soon as you acquire Source-File 5-1. +soon as you enter BitNode-5 or acquire Source-File 5-1. .. toctree:: hacknetNodeCost() @@ -48,7 +52,8 @@ hacknetServers formulas ----------------------- These functions are under the ``formulas.hacknetServers.`` namespace. -These functions require Source-File 5-1 and Source-File 9-1 to be invoked. +These functions require either being in BitNode-5 or having Source-File 5-1, and +also require either being in BitNode-9 or having Source-File 9-1 to be invoked. .. toctree:: hacknetServerCost() @@ -58,4 +63,4 @@ These functions require Source-File 5-1 and Source-File 9-1 to be invoked. coreUpgradeCost() cacheUpgradeCost() hashUpgradeCost() - constants() \ No newline at end of file + constants()