This script will reveal every server in Bitburner, even include those hided ones.
How to Scan Every Server
Here is the code:
var playerServers = ['home', 'Server1']; var serverChecked = []; var checkList = []; /** @param {NS} ns **/ export async function main(ns) { await ServersScan(ns, 'home'); await printArray(ns, serverChecked); } /** @param {NS} ns **/ async function ServersScan(ns, target) { var servers1 = await ns.scan(target); for (var server in servers1) { if (!checkList.includes(servers1[server])) { checkList.push(servers1[server]); } } serverChecked.push(target); var flag = true; while (flag) { flag = false; for (var i = 0; i < checkList.length; i++) { var servers = await ns.scan(checkList); if (!serverChecked.includes(checkList)) { serverChecked.push(checkList); } for (var server in servers) { if (!checkList.includes(servers[server])) { checkList.push(servers[server]); } } } } // remove player servers from serverChecked for (var server in playerServers) { for (var i = 0; i < serverChecked.length; i++) { if (serverChecked == playerServers[server]) { serverChecked.splice(i, 1); i--; } } } } async function printArray(ns, serverList) { for (var server in serverList) { ns.print(serverList[server] + "\n"); ns.tprint(serverList[server] + "\n"); } }[/code] User menu: 1. Create a new .js script nano whateverthenameis.js 2. Copy past the code. I guess everyone knows how to do that! 1) The button on the left button corner of your keyboard which has "ctrl" printed on it, press it down first, hold it, and press "c" meanwhile. Then, release both. 2) Go to the script you just created. 2) Press done "ctrl" again and hold it, and press "v" in the meanwhile. 3. Save it and run it! run whateverthenameis.js it should print something like this: auto.js: n00dles auto.js: foodnstuff auto.js: sigma-cosmetics auto.js: joesguns auto.js: hong-fang-tea auto.js: harakiri-sushi auto.js: iron-gym auto.js: darkweb auto.js: max-hardware auto.js: zer0 auto.js: nectar-net auto.js: CSEC auto.js: neo-net auto.js: phantasy auto.js: omega-net auto.js: silver-helix auto.js: the-hub auto.js: netlink auto.js: johnson-ortho auto.js: avmnite-02h auto.js: comptek auto.js: crush-fitness auto.js: catalyst auto.js: syscore auto.js: I.I.I.I auto.js: rothman-uni auto.js: summit-uni auto.js: zb-institute auto.js: lexo-corp auto.js: alpha-ent auto.js: millenium-fitness auto.js: rho-construction auto.js: aevum-police auto.js: galactic-cyber auto.js: aerocorp auto.js: global-pharm auto.js: snap-fitness auto.js: omnia auto.js: unitalife auto.js: deltaone auto.js: defcomm auto.js: solaris auto.js: icarus auto.js: univ-energy auto.js: zeus-med auto.js: infocomm auto.js: taiyang-digital auto.js: zb-def auto.js: nova-med auto.js: titan-labs auto.js: applied-energetics auto.js: microdyne auto.js: run4theh111z auto.js: fulcrumtech auto.js: stormtech auto.js: helios auto.js: vitalife auto.js: kuai-gong auto.js: . auto.js: omnitek auto.js: 4sigma auto.js: clarkinc auto.js: powerhouse-fitness auto.js: b-and-a auto.js: blade auto.js: nwo auto.js: ecorp auto.js: megacorp auto.js: fulcrumassets auto.js: The-Cave
Thanks to Bloodly Hell Cat~ for his great guide, all credit to his effort. you can also read the original guide from Steam Community. enjoy the game.
Related Posts:
- Bitburner: Scan/Nuke/Money Script (Working 2022)
- Bitburner: Simple Hacknet Manager
- Bitburner: How to Autocomplete Your Scripts in VSCode
- Bitburner: Post-BN9 Hacknet Script (V2.2.1)
- Bitburner: Unorthodox Automation & In-game Modding
I cannot get this code to work. That is all.
It throws an error message “48:3 sorry we cannot be more helpful”
Looks like the t missing from ns.tprint( on line 48
Since this was lazily just copied from the steam post, “Robins Chew” didn’t test it. The problem is that the references to `checkList` on lines 22-24 (where 22 is `var servers = await ns.scan(checkList);`) all need “[i]” after the references to `checkList`.
So those three lines should look like this:
var servers = await ns.scan(checkList[i]);
if (!serverChecked.includes(checkList[i])) {
serverChecked.push(checkList[i]);