Bitburner - Hacknet Manager Guide

By Kirtle

A easy hacknet supervisor to buy all of the hacknet upgrades for you in an environment friendly approach.

Setup

Merely create a .js file and paste the code beneath

nano nameOfYourFile.js

Observe: This script requires 6.1GB of reminiscence out there

Script code

export async operate principal(ns) {

let delayTime = ns.args[0] || 1000;

let thresholdMultiplier = ns.args[1] || 1; //Larger threshold, the much less it spends

whereas (true) {

let ownedNodes = ns.hacknet.numNodes();

let minValue = ns.hacknet.getPurchaseNodeCost();

let nodeIndex = ownedNodes;

let upgradeType = -1; //-1 -> buy, 0 -> stage, 1 -> ram, 2 -> core

for (let i = 0; i < ownedNodes; i++) {

let upgrades = [

ns.hacknet.getLevelUpgradeCost(i, 1), 

ns.hacknet.getRamUpgradeCost(i, 1), 

ns.hacknet.getCoreUpgradeCost(i, 1)

];

let worth = Math.min.apply(Math, upgrades);

if (worth < minValue)

}

await waitForMoney(ns, minValue, delayTime, thresholdMultiplier);

change (upgradeType) {

case -1:

ns.hacknet.purchaseNode();

break;

case 0:

ns.hacknet.upgradeLevel(nodeIndex, 1);

break;

case 1:

ns.hacknet.upgradeRam(nodeIndex, 1);

break;

case 2:

ns.hacknet.upgradeCore(nodeIndex, 1);

break;

}

await ns.sleep(1);

}

}

async operate waitForMoney(ns, targetMoney, delayTime, thresholdMultiplier) {

whereas (ns.getPlayer().cash / thresholdMultiplier < targetMoney) {

await ns.sleep(delayTime);

}

}

The way it works

The script finds the most cost effective improve out there in one of many hacknet nodes and buys it each time it has sufficient cash for it.

Utilization

You may run this script just by typing

run nameOfYourScript.js

Nevertheless, you may as well cross it two arguments (purchase time delay and cash threshold multiplier).

run nameOfYourScript.js 5000 2

The command above would attempt to buy an improve each 5s (5000ms) each time the participant has at the very least twice the cash it will price to buy mentioned improve.

Observe: Passing a cash threshold multiplier beneath 1 will break the script

Previous articleKingdoms of Amalur: Re-Reckoning – Item Duplication With Merchants
Next articleMirror – how to Unlock “beat in 25 turns” Achievements

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.