addictqert.blogg.se

Bitburner ns2
Bitburner ns2









bitburner ns2
  1. Bitburner ns2 update#
  2. Bitburner ns2 code#

Var instances = parseInt(ram / payloadSize)

bitburner ns2

Var minRam = 8 // Smallest server I'm willing to purchase to get started. If yes, kill scripts on them and buy up new ones with more ram. It looks at the size of the hack script I want to instance on each machine, then looks to see if I've purchased servers. This is an old version of my purchaseServer.script. Here's an example that was dramatically sped up for me (though I take no blame for it being a terrible program). weaken(target) is about as small of a program as you can write. While I don't expect you to be at the point where you could test this, the NS1 version of this takes me ~2300 ms, and the NS2 version takes ~1 ms, which is a very noticeable difference for a small script.Īlso, the GB values should be the same between NS1 and 2. Tprint("Script completed in " + d2 + " ms.") Now, you might rightly say that ~1/3 of a second isn't that bad, and the script I wrote does nothing. The NS1 takes ~1400 ms, and the NS2 takes ~1005 MS. If I were to tweak it to use getTime(), rather than now() var q = new Date() When I run it, it typically takes ~1300 ms to run. Here's a quick script that grabs the time, sleeps for a bit, grabs the new time, and tells you how many milliseconds it took. And passed args around like they were candy. but I do understand that they aren't lying when they talk about a speed difference.ĮDIT: And then I converted all my scripts to NS2.

bitburner ns2

I'm not yet interested in going down the javascript rabbit hole, and I don't actually understand the differences. Holy crap, but NS2 makes a tremendous speed difference. Then I went to look at active scripts and they were all running the way I expected. It must have terminated without telling me why." "This can't be right! This script takes thirty seconds to run. and put await in front of the occasional hack/grow/weaken/scp that existed. I literally only prefixed the functions with ns. So I did the bare minimum of work, converting my universal manipulator and universal hacker from NS1 to NS2. I don't know what an async is or why I'd await for it, but what else are you going to do? Work?" "Well, why not convert one or two of your low end scripts to NS2? It's not like you have to learn javascript. Then I found myself with time to kill while rep grinding. Feels a little like telehack but without getting bossed around by truly entrenched players." This will make it so that your startup script automatically runs your purchase server script once the startup is done, and all of your purchased servers will run your hackscript against the same target that you designated in your startup script, passing it using ns.args.I kicked and screamed and thought "Well, NS1 is just fine.

Bitburner ns2 code#

You can also add a line to the very end of the code (but before the last curly brace) that is just ns.run("purchaseserverscript.ns", 1, target) and has ns.args set as the target for the hackscript in the purchase server script. To get around this, you should have your purchase server script upload and run your hackscript to the purchased servers. If you do not have all 5 port openers, this startup script will not run your hackscript on your personal servers. Personal servers technically have a "portsNeeded" value of 5, so you need to open all ports to hack them. There's a bunch of things that could be the issue, and I would need to know more to know the exact issue, but I have a suspicion. This prevents the script from crashing when encountering one of the many 0 ram servers, and threadCount being 0 causes a crash if the execute function is ran. It then executes your script, or scripts though that requires modification, as long as your threadcount is greater than 0.

Bitburner ns2 update#

This allows you to update the target of your scripts if necessary, by ensuring that the old process stops running so you can run the updated ones. Last, the script then nukes the server, establishing root access. This prevents the script from wasting time opening more ports than is needed to establish root access. It then opens the ports on the server, iterating the value of the variable "open" until "open < portsNeeded" is false. If you wish to run multiple scripts, the formula for var threadCount would need modification to assign a portion of total threads to each script. It then calculates the max thread count for the script being downloaded. This for loop iterates starting at i = 1, skipping i = 0 which is the home server. Var tools = įor (var i = 0 i 0) ns.exec("placeholder.script", serv, threadCount) Here it is with explanation below: /** ns **/

bitburner ns2

Hi all, with a lot of help from people on the discord I just completed a ns2 script which auto generates an array of all servers, opens all of their ports and nukes, then downloads and executes a script(s) of your choice.











Bitburner ns2