grow helpers

This commit is contained in:
2022-09-10 20:42:31 +02:00
parent b0abc2a614
commit 7b393a7ffc
12 changed files with 281 additions and 111 deletions
+20
View File
@@ -0,0 +1,20 @@
/** @param {import(".").NS } ns */
export async function main(ns) {
// ns.disableLog('ALL');
let serverCost = ns.getPurchasedServerCost(16);
let currentMoney = ns.getServerMoneyAvailable('home');
if (serverCost < 0.1 * currentMoney) {
let newServer = ns.purchaseServer('home', 16);
if (newServer != '') {
ns.tprint(`Bought a server`);
ns.scp('grow-helper.js', newServer);
let execExitCode = ns.exec('grow-helper.js', newServer, 5, 20);
ns.tprint(`Exec 'grow-helper.js' exit code: ${execExitCode}`);
}
}
await ns.sleep(10);
}