2019-04-05 02:08:41 -07:00
|
|
|
hashCost() Netscript Function
|
|
|
|
=============================
|
|
|
|
|
|
|
|
.. warning:: This page contains spoilers for the game
|
|
|
|
|
2019-04-14 02:08:10 -07:00
|
|
|
.. js:function:: hashCost(upgName)
|
2019-04-05 02:08:41 -07:00
|
|
|
|
2021-03-07 04:37:56 -05:00
|
|
|
:RAM cost: 0 GB
|
2019-04-05 02:08:41 -07:00
|
|
|
:param string upgName: Name of upgrade to get the cost of. Must be an exact match
|
2021-03-12 02:51:56 -05:00
|
|
|
:returns: Number of hashes required for the specified upgrade. The name of
|
|
|
|
the upgrade must be an exact match.
|
2019-04-05 02:08:41 -07:00
|
|
|
|
|
|
|
.. note:: This function is only applicable for Hacknet Servers (the upgraded version
|
|
|
|
of a Hacknet Node).
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
.. code:: javascript
|
|
|
|
|
2021-03-12 02:51:56 -05:00
|
|
|
upgradeName = "Sell for Corporation Funds";
|
2019-04-05 02:08:41 -07:00
|
|
|
if (hacknet.numHashes() > hacknet.hashCost(upgradeName)) {
|
|
|
|
hacknet.spendHashes(upgName);
|
|
|
|
}
|