fixes for WorkerList.js

This commit is contained in:
2024-10-13 10:13:51 +02:00
parent 39b17cb62a
commit c975dfbe51
4 changed files with 9 additions and 8 deletions

View File

@@ -257,10 +257,10 @@ export async function RunAndWait(ns, sScript, ...args) {
/** @param {NS} ns */
export function listWorkServers(ns) {
ns.disableLog("ALL");
const sFileName = "serverList.txt";
if (!ns.fileExists(sFileName, "home")) { ns.print(`ERROR ${sFileName} does not exist.`); return false; };
let serverList = JSON.parse(ns.read(sFileName));
//if (!ns.fileExists("serverList.txt", "home")) { scanServerList() };
let serverList = JSON.parse(ns.read("serverList.txt"));
let nTotalWorkerRAM = 0;
let nTotalFreeRAM = 0;

View File

@@ -7,10 +7,12 @@ export async function main(ns) {
ns.resizeTail(522,625);
let nStatus = 0;
let aStatus = ["─", "╲", "│", ""];
while (true) {
let bWhile = true;
while (bWhile !== false) {
ns.clearLog();
listWorkServers(ns);
ns.printRaw(aStatus[nStatus])
bWhile = listWorkServers(ns);
//ns.printRaw(aStatus[nStatus])
ns.setTitle(`WorkerList ${aStatus[nStatus]}`);
nStatus++;
if (nStatus > 3) nStatus = 0;
await ns.sleep(1050);

View File

@@ -1 +1 @@
{"serverName":"sigma-cosmetics","maxRam":16,"maxMoney":57500000,"minSec":7,"minPorts":0,"minHackLvl":5,"rootAccess":true,"openPorts":0,"serverOrgs":"Sigma Cosmetics","serverCores":1,"serverFiles":["factionboost.js"]}
{"serverName":"the-hub","maxRam":32,"maxMoney":4832749575,"minSec":24,"minPorts":2,"minHackLvl":291,"rootAccess":true,"openPorts":0,"serverOrgs":"The Hub","serverCores":4,"serverFiles":[]}

File diff suppressed because one or more lines are too long