Bitburner – Server Script Guide

Bitburner – Server Script Guide 1 - steamlists.com
Bitburner – Server Script Guide 1 - steamlists.com

Need a quick route to a particular destination? I’ve created a script that’ll give you the directions.
 
 
No more feeling like a lost tourist looking for a node again.
 
 

First you make a left at…

This is something of a shortcut to finding some of those more hard to reach nodes.
 
 
You might think your version 2 of the scan-analyzer might give you a way to directly connect to every node… think again.
 
 
The scanner only goes to a range of 10 nodes and no further, which means finding the more distant nodes (up to *13* hops from home!) requires actually going a bit into the wilds and connecting further in before attempting that scan again.
 
 
I created this utility to find a path to those distant places, and to make it easier, even create a string you can cut and paste right into your terminal to take you right there.
 
 
Note, I’m not going to give away server names here.. that’s more an exercise for the reader.
 
 
 

The script

/** @param {NS} ns **/export async function main(ns) {
 ns.disableLog("ALL");
 ns.tail();
 var src = ns.getHostname();
 var tgt = ns.args[0];
 var servers = {};
 var queue = [src];
 var route = [tgt];
 var ptr = tgt;

 servers[src] = "START";

 while (queue.length) {
 var s = queue.pop();
 var links = ns.scan(s);
 for (var i = 0; i < links.length; i++) {
 if (!servers[links[i]]) {
 queue.push(links);
servers[links[i]] = s;
}
};
}

while (ptr != src) {
ptr = servers[ptr];
route.push(ptr);
}
route.pop();

ns.print("connect " + route.reverse().join("; connect "));
}[/code]

 
 
 

Example usage

From home to omega-net,
 
 

[home ~/]> run find.ns omega-net

 
 
Will give you this in a window:
 
 

connect harakiri-sushi; connect max-hardware; connect omega-net

 
 
 

Any questions?

This is my first guide here so comments and questions are appreciated, and I would love to know how this script helped you out in your own adventures.
 
 

Written by WhiskeyFur

 
 
I hope you enjoy the Guide we share about Bitburner – Server Script Guide; if you think we forget to add or we should add more information, please let us know via commenting below! See you soon!
 
 


2 Comments

  1. This is great stuff.
    I’m not sure what you mean by depth 10. My “myscan.ns” goes past 10 and gets additional servers.
    Thanks!

Leave a Reply

Your email address will not be published.


*