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