more work on the lowram scripts

This commit is contained in:
2024-10-10 17:19:40 +02:00
parent 81b1675356
commit a63a9ca66f
15 changed files with 115 additions and 51 deletions

View File

@@ -7,6 +7,7 @@ export async function main(ns) {
const sBatchScript = "lowram/Lowhgw.js";
const sPrepScript = "lowram/Lowprep.js";
const sRunScript = "lowram/Lowrun.js";
const sGrowScript = "lowram/Lowgrow.js";
const nTargetMoney = ns.getServerMoneyAvailable(sTarget);
const nTargetMaxMoney = ns.getServerMaxMoney(sTarget);
@@ -16,17 +17,14 @@ export async function main(ns) {
ns.print(sTarget + " Money = " + nTargetMoney.toLocaleString() + " / " + nTargetMaxMoney.toLocaleString());
ns.print(sTarget + " Security = " + nTargetSecurity.toLocaleString() + " / " + nTargetMinSecurity.toLocaleString());
if ( nTargetSecurity > nTargetMinSecurity) {
ns.killall();
if (nTargetSecurity > nTargetMinSecurity + 1) {
ns.spawn(sPrepScript, { threads: 1, spawnDelay: 0 }, sTarget);
}
else if (nTargetMoney < nTargetMaxMoney){
ns.print("need to prep MONEY, running "+sRunScript);
ns.killall();
ns.spawn(sBatchScript, { threads: 1, spawnDelay: 0 }, sTarget);
else if (nTargetMoney < nTargetMaxMoney) {
ns.print("need to prep MONEY, running " + sGrowScript);
ns.spawn(sGrowScript, { threads: 1, spawnDelay: 0 }, sTarget);
}
else {
ns.killall();
ns.spawn(sBatchScript, { threads: 1, spawnDelay: 0 }, sTarget);
}
}