-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrefresh.js
More file actions
30 lines (24 loc) · 953 Bytes
/
refresh.js
File metadata and controls
30 lines (24 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import {createServerList, createServerTree} from 'serverdata.js'
import {getAttackTargetCount} from 'autoattack.js'
import {autoKill} from 'autokill.js'
/** @param {NS} ns */
export async function main(ns) {
const verbose = false;
const thisScriptName = ns.getScriptName();
ns.disableLog("ALL");
// kills old duplicate(s)!
autoKill(ns, [ns.getHostname()], thisScriptName, verbose);
while(true) {
ns.printf("%s -> recreating server list...", thisScriptName);
await createServerList(ns, true, "home", "", verbose);
await ns.sleep(10*1000);
ns.printf("%s -> recreating server tree...", thisScriptName);
await createServerTree(ns, true, "home", "", "", verbose);
await ns.sleep(10*1000);
const attackTargetCount = getAttackTargetCount(ns);
if(attackTargetCount > 0) {
ns.tprintf("%s -> found %i potential attack target(s)!", thisScriptName, attackTargetCount);
}
await ns.sleep(10*1000);
}
}