Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated formatting and suppressing sleep messages #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions custom-stats.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @param {NS} ns **/
export async function main(ns) {
ns.disableLog("sleep");
const args = ns.flags([["help", false]]);
if (args.help) {
ns.tprint("This script will enhance your HUD (Heads up Display) with custom statistics.");
Expand All @@ -17,19 +18,19 @@ export async function main(ns) {
const headers = []
const values = [];
// Add script income per second
headers.push("ScrInc");
values.push(ns.getScriptIncome()[0].toPrecision(5) + '/sec');
headers.push("Script inc");
values.push(ns.nFormat(ns.getScriptIncome()[0], "0.000a") + "/s");
// Add script exp gain rate per second
headers.push("ScrExp");
values.push(ns.getScriptExpGain().toPrecision(5) + '/sec');
headers.push("Script exp");
values.push(ns.nFormat(ns.getScriptExpGain(), "0.000a") + "/s");
// TODO: Add more neat stuff

// Now drop it into the placeholder elements
hook0.innerText = headers.join(" \n");
hook0.innerText = headers.join(" \n");
hook1.innerText = values.join("\n");
} catch (err) { // This might come in handy later
ns.print("ERROR: Update Skipped: " + String(err));
}
await ns.sleep(1000);
}
}
}