bitburner-src/doc/source/netscript/basicfunctions/getPurchasedServerUpgradeCost.rst

19 lines
775 B
ReStructuredText
Raw Normal View History

2023-01-06 13:43:09 +01:00
getPurchasedServerUpgradeCost() Netscript Function
===========================================
.. js:function:: getPurchasedServerUpgradeCost(hostname, ram)
2023-01-07 10:03:43 +01:00
:RAM cost: 0.1 GB
2023-01-06 13:43:09 +01:00
:param string hostname: Hostname of target purchased server.
:param number ram: Target amount of RAM for purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of :doc:`getPurchasedServerMaxRam<getPurchasedServerMaxRam>`
:returns: Cost to purchase a server with the specified amount of ``ram``.
Giving any non-power-of-2 as an argument results in the function returning `-1`
Example:
.. code-block:: javascript
ns.purchaseServer("smallServer",2) //costs 110000
ns.getPurchasedServerUpgradeCost("smallServer",8); // returns: 330000