grow helpers
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user