Files
BitburnerOLD/buy-grow-server.js
T

18 lines
599 B
JavaScript

/** @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}`);
}
}
}