vim_Chad = () => "Enable EZ Mode";

Links

Javascript Help[www.w3schools.com]

BitBurner NS[github.com]

Hello = () => "Stack Paper";

First Steps The casual console enjoyer may opt to write their scripts using netscript. Not here, we use javascript like true soy-devs. See the links section for javascript & Bitburner docs. First things first, what is the goal here, how do we win? For now, answers easy, stack paper.

You may be wondering, "how does one stack said paper?". Easy, someone else stacks it for us. Using scripts we transfer the paper from their stack to our heap. Now that we have a goal, let's get into the meat of the game, scripting.

Let's start easy, a virus that we can send to other servers.

vim virus.js /** @param {NS} ns */ export async function main(ns) { const host = ns.getHostname(); while (true) { if (ns.getServerSecurityLevel(host) >= ns.getServerMinSecurityLevel(host) + 5) { ns.print('Weakening host'); await ns.weaken(host); } else if (ns.getServerMoneyAvailable(host) < ns.getServerMaxMoney(host)) { ns.print('Growing host'); await ns.grow(host); } else { ns.print('Hacking host'); await ns.hack(host); } } } That should do it. Now we can copy this over to any server using

scp virus.js target This script will take some time to really pay off, but while we have that cooking on a few servers, let's make a tool. We need something that will give us a quick look at a target server. Just a little something to help us look for more paper. Time to get to work,

vim serverspy.js First let's get a display window going,

function display() { ns.tail(); ns.clearLog(); ns.moveTail(1500, 100); ns.resizeTail(500, 500); } You'll probably want to adjust this a little, but this will work good for now. Next we need a function to check server security.

function is_secure(target) { let server_sec = ns.getServerSecurityLevel(target); let has_root = ns.hasRootAccess(target); let ports = ns.getServerNumPortsRequired(target); ns.printf('Server Security: ' + server_sec); ns.printf('Root Access: ' + has_root); ns.printf('Ports Required: ' + ports); } Now we're cooking, add javascript to the ol linkedin account. The beta-dev may leave logs enabled, but not us. Add this bad boy to the display function:

ns.disableLog('ALL') May have forgot to turn on the oven before, but now we are officially starting to cook. Next function, let's take a peek at those books.

function get_balance(target) { let server_balance = ns.formatNumber(ns.getServerMoneyAvailable(target)); ns.printf('Server Balance: ' + server_balance); } Notice how we format that ♥♥♥♥. Alrighty on to the next thing, RAM check bb.

function get_ram(target) { let server_ram = ns.formatRam(ns.getServerMaxRam(target)); ns.printf('Server Ram: ' + server_ram); } Yes it's simple, but it does ♥♥♥♥. Later we can fill this out a little more, but for now it's fine. Let's take a look at the whole thing,

/** @param {NS} ns */ export async function main(ns) { const target = ns.args[0]; function display() { ns.tail(); ns.clearLog(); ns.moveTail(1500, 100); ns.resizeTail(500, 500); ns.disableLog('ALL'); } function is_secure(target) { let server_sec = ns.getServerSecurityLevel(target); let has_root = ns.hasRootAccess(target); let ports = ns.getServerNumPortsRequired(target); ns.printf('Server Security: ' + server_sec); ns.printf('Root Access: ' + has_root); ns.printf('Ports Required: ' + ports); } function get_balance(target) { let server_balance = ns.formatNumber(ns.getServerMoneyAvailable(target)); ns.printf('Server Balance: ' + server_balance); } function get_ram(target) { let server_ram = ns.formatRam(ns.getServerMaxRam(target)); ns.printf('Server Ram: ' + server_ram); } display(); is_secure(target); get_balance(target); get_ram(target); } EZPZ alright now we can just :wq out and hit em with the classic

> run serverspy.js n00dles and watch the magic happen.

Breaching tool Are you a Thermite main? Do you wish to breach servers, hard? There's a tool for that. At least there will be in the next five minutes. Let's create a new script on our home server.

vim very_hard.js

=== IN PROGRESS ===

Upgrades

IN PROGRESS

Building a listening post

C&C Script

AYE, AYE, LMAO

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=3247424468					

More Bitburner guilds