low ram scripts in "lowram" folder, start with run lowram/lowrun.js

and the target server as first argument
This commit is contained in:
2024-10-10 12:10:08 +02:00
parent f22624fe10
commit 81b1675356
5 changed files with 124 additions and 17 deletions

View File

@@ -0,0 +1,32 @@
/** @param {NS} ns */
export async function main(ns) {
ns.tail();
const sTarget = ns.args[0]; // target server
// Lowram settings
const sBatchScript = "lowram/Lowhgw.js";
const sPrepScript = "lowram/Lowprep.js";
const sRunScript = "lowram/Lowrun.js";
const nTargetMoney = ns.getServerMoneyAvailable(sTarget);
const nTargetMaxMoney = ns.getServerMaxMoney(sTarget);
const nTargetSecurity = ns.getServerSecurityLevel(sTarget);
const nTargetMinSecurity = ns.getServerMinSecurityLevel(sTarget);
ns.print(sTarget + " Money = " + nTargetMoney.toLocaleString() + " / " + nTargetMaxMoney.toLocaleString());
ns.print(sTarget + " Security = " + nTargetSecurity.toLocaleString() + " / " + nTargetMinSecurity.toLocaleString());
if ( nTargetSecurity > nTargetMinSecurity) {
ns.killall();
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 {
ns.killall();
ns.spawn(sBatchScript, { threads: 1, spawnDelay: 0 }, sTarget);
}
}