From 40843e35434d56e883655e4377994ac76746b184 Mon Sep 17 00:00:00 2001 From: AlmightyMiau Date: Wed, 13 Nov 2024 10:56:53 -0800 Subject: Organized scripts into folders --- misc/run.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 misc/run.js (limited to 'misc/run.js') diff --git a/misc/run.js b/misc/run.js new file mode 100644 index 0000000..31c70cd --- /dev/null +++ b/misc/run.js @@ -0,0 +1,12 @@ +/** @param {NS} ns */ +export async function main(ns) { + const target = ns.args[0]; + const script = ns.args[1]; + const scriptRam = ns.getScriptRam(script); + ns.exec(script, "home", threads(ns, scriptRam), target); + await ns.sleep(4000); +} + +function threads(ns, scriptRam) { + return Math.floor(((ns.getServerMaxRam("home") - ns.getServerUsedRam("home")) * 0.95) / scriptRam); +} \ No newline at end of file -- cgit v1.2.3