-
Notifications
You must be signed in to change notification settings - Fork 3
/
system.js
58 lines (46 loc) · 1.17 KB
/
system.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { scriptPath } from "lib/settings"
import { canRunOnHome } from "lib/network"
/** @param {NS} ns */
export async function main(ns) {
//\\ SCRIPT SETTINGS
ns.disableLog("ALL")
ns.clearLog()
//\\ GENERAL DATA
const SCRIPT = scriptPath(ns)
//\\ FUNCTIONS
async function intro() {
ns.tprint("\n\nWake up, Neo...\nThe matrix has you...\n\n")
await ns.sleep(5000)
}
async function waitForRam(ram) {
while (ns.getServerMaxRam("home") < ram) {
ns.clearLog()
ns.print("Awaiting more ram on home " + ram)
await ns.sleep(1000)
}
}
async function run(script) {
while (!canRunOnHome(ns, script)) {
ns.clearLog()
ns.print("Next is " + script)
await ns.sleep(1000)
}
ns.run(script, 1)
await ns.sleep(1000)
}
//\\ MAIN MAGIC
await intro()
await run(SCRIPT.collect)
await run(SCRIPT.programs)
await run(SCRIPT.ram)
await run(SCRIPT.servers)
await run(SCRIPT.crime)
await run(SCRIPT.gangs)
await waitForRam(256)
await run(SCRIPT.faction)
await run(SCRIPT.interface)
await waitForRam(2048)
await run(SCRIPT.core)
await run(SCRIPT.stockmarket)
// await run(SCRIPT.corporation)
}