mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 22:38:34 +02:00
15
doc/source/netscript/basicfunctions/getServerMaxRam.rst
Normal file
15
doc/source/netscript/basicfunctions/getServerMaxRam.rst
Normal file
@@ -0,0 +1,15 @@
|
||||
getServerMaxRam() Netscript Function
|
||||
====================================
|
||||
|
||||
.. js:function:: getServerMaxRam(hostname)
|
||||
|
||||
:RAM cost: 0.05 GB
|
||||
:param string hostname: Hostname of target server.
|
||||
:returns: Total ram available on that server. In GB.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
maxRam = getServerMaxRam("helios"); // returns: 16
|
||||
print("helios has "+maxRam + "GB");
|
||||
@@ -3,6 +3,8 @@ getServerRam() Netscript Function
|
||||
|
||||
.. js:function:: getServerRam(hostname)
|
||||
|
||||
.. warning:: This function is deprecated.
|
||||
|
||||
: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
|
||||
|
||||
15
doc/source/netscript/basicfunctions/getServerUsedRam.rst
Normal file
15
doc/source/netscript/basicfunctions/getServerUsedRam.rst
Normal file
@@ -0,0 +1,15 @@
|
||||
getServerUsedRam() Netscript Function
|
||||
=====================================
|
||||
|
||||
.. js:function:: getServerUsedRam(hostname)
|
||||
|
||||
:RAM cost: 0.05 GB
|
||||
:param string hostname: Hostname of target server.
|
||||
:returns: Used ram on that server. In GB.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
usedRam = getServerUsedRam("harakiri-sushi"); // returns: 5.6
|
||||
print("harakiri-sushi uses "+usedRam + "GB");
|
||||
@@ -5,13 +5,13 @@ Netscript Bladeburner API
|
||||
Netscript provides the following API for interacting with the game's Bladeburner mechanic.
|
||||
|
||||
The Bladeburner API is **not** immediately available to the player and must be unlocked
|
||||
later in the game
|
||||
later in the game.
|
||||
|
||||
.. warning:: This page contains spoilers for the game
|
||||
|
||||
The Bladeburner API is unlocked in BitNode-7. If you are in BitNode-7, you will
|
||||
automatically gain access to this API. Otherwise, you must have Source-File 7 in
|
||||
order to use this API in other BitNodes
|
||||
order to use this API in other BitNodes.
|
||||
|
||||
**Bladeburner API functions must be accessed through the 'bladeburner' namespace**
|
||||
|
||||
@@ -157,7 +157,7 @@ identifier by attaching the Bladeburner API functions to an object::
|
||||
}
|
||||
|
||||
BladeburnerHandler.prototype.handle = function() {
|
||||
//If we're doing something else manually (without Simlacrum),
|
||||
//If we're doing something else manually (without Simulacrum),
|
||||
//it overrides Bladeburner stuff
|
||||
if (!this.hasSimulacrum() && this.ns.isBusy()) {
|
||||
this.ns.print("Idling bc player is busy with some other action");
|
||||
|
||||
@@ -54,7 +54,8 @@ This includes information such as function signatures, what they do, and their r
|
||||
getServerMinSecurityLevel() <basicfunctions/getServerMinSecurityLevel>
|
||||
getServerRequiredHackingLevel() <basicfunctions/getServerRequiredHackingLevel>
|
||||
getServerNumPortsRequired() <basicfunctions/getServerNumPortsRequired>
|
||||
getServerRam() <basicfunctions/getServerRam>
|
||||
getServerMaxRam() <basicfunctions/getServerMaxRam>
|
||||
getServerUsedRam() <basicfunctions/getServerUsedRam>
|
||||
serverExists() <basicfunctions/serverExists>
|
||||
fileExists() <basicfunctions/fileExists>
|
||||
isRunning() <basicfunctions/isRunning>
|
||||
@@ -90,3 +91,8 @@ This includes information such as function signatures, what they do, and their r
|
||||
wget() <basicfunctions/wget>
|
||||
getFavorToDonate() <basicfunctions/getFavorToDonate>
|
||||
flags() <basicfunctions/flags>
|
||||
|
||||
.. toctree::
|
||||
:caption: Deprecated:
|
||||
|
||||
getServerRam() <basicfunctions/getServerRam>
|
||||
@@ -86,7 +86,7 @@ The following is an example of one way a script can be used to automate the
|
||||
purchasing and upgrading of Hacknet Nodes.
|
||||
|
||||
This script attempts to purchase Hacknet Nodes until the player has a total of 8. Then
|
||||
it gradually upgrades those Node's to a minimum of level 140, 64 GB RAM, and 8 cores
|
||||
it gradually upgrades those Node's to a minimum of level 80, 16 GB RAM, and 8 cores
|
||||
|
||||
.. code:: javascript
|
||||
|
||||
@@ -129,3 +129,16 @@ it gradually upgrades those Node's to a minimum of level 140, 64 GB RAM, and 8 c
|
||||
};
|
||||
|
||||
print("All nodes upgraded to 16GB RAM");
|
||||
|
||||
for (var i = 0; i < cnt; i++) {
|
||||
while (hacknet.getNodeStats(i).cores < 8) {
|
||||
var cost = hacknet.getCoreUpgradeCost(i, 1);
|
||||
while (myMoney() < cost) {
|
||||
print("Need $" + cost + " . Have $" + myMoney());
|
||||
sleep(3000);
|
||||
}
|
||||
res = hacknet.upgradeCore(i, 1);
|
||||
};
|
||||
};
|
||||
|
||||
print("All nodes upgraded to 8 cores");
|
||||
|
||||
Reference in New Issue
Block a user