Skip to content

Instantly share code, notes, and snippets.

View Spartelfant's full-sized avatar

Bart Kuijper Spartelfant

  • The Netherlands
View GitHub Profile
@Spartelfant
Spartelfant / quickSpawn.js
Last active October 6, 2022 15:27
Bitburner ns2 script: a script to spawn any script without the 10-second delay imposed by ns.spawn()
/**
* Executes a script after a specified delay in milliseconds.
*
* This script takes a delay (in milliseconds) as its first argument, followed by the same arguments as ns.run().
*
* For example, to spawn a script with 4 threads after a 10 millisecond delay using the same arguments as the calling script:
* ns.run('quickSpawn.js', 1, 10, 'scriptToSpawn.js', 4, ...ns.args);
*
* @param {NS} ns
*/
@Spartelfant
Spartelfant / colors.js
Last active September 23, 2024 20:52
Bitburner ns2 script: a quick reference to all colors, printed to the terminal (at https://imgur.com/a/VtebvCM you can view a screenshot of the script in action)
/**
* Updated for game version 2.4.0
*/
/** @param {NS} ns */
export async function main(ns) {
ns.disableLog(`ALL`); // Failures are still logged, this just prevents unnecessary log spam.
ns.tprintf(`\x1b[1;35mUsing colors in script output with \x1b[1;36mtprint\x1b[1;35m & \x1b[36;1mtprintf\x1b[1;35m (terminal) and \x1b[36;1mprint\x1b[1;35m & \x1b[1;36mprintf\x1b[1;35m (log)`);