Fix watcher

This commit is contained in:
Isaac Shoebottom 2023-11-03 16:49:26 -03:00
parent 99c5d23c11
commit 7466c20e11

View File

@ -2,10 +2,6 @@ import {NS} from "NetscriptDefinitions";
export async function main(ns: NS) { export async function main(ns: NS) {
let hackingLevel = ns.getHackingLevel(); let hackingLevel = ns.getHackingLevel();
while (hackingLevel < 9999) { while (hackingLevel < 9999) {
ns.run("hackallservers.js");
let seconds = 60 * 1000; // 1 minute
await ns.sleep(seconds)
let oldHackingLevel = hackingLevel; let oldHackingLevel = hackingLevel;
hackingLevel = ns.getHackingLevel(); hackingLevel = ns.getHackingLevel();
if(oldHackingLevel !== hackingLevel) { if(oldHackingLevel !== hackingLevel) {
@ -14,5 +10,7 @@ export async function main(ns: NS) {
await ns.sleep(1000) // 1 second await ns.sleep(1000) // 1 second
ns.run("hackallservers.js"); ns.run("hackallservers.js");
} }
// Wait 1 second before checking again
await ns.sleep(1000)
} }
} }