![]() ![]() If the number of servers you request is more than the number of server slots available, it will ask to delete old servers with the smallest RAM until enough slots are open to create the requested number of servers. Therefore requesting a lower amount of servers will yield more RAM per server, whereas requesting a higher amount of servers will yield less RAM per server. The RAM purchased for each server is calculated based on the number of servers requested and will be the highest amount you can currently afford. Purchases the number of servers passed in. maxNodes: The maximum number of nodes you want to purchase and upgrade.There are currently no checks in place to see if you are outside the bounds of what is feasible so passing in zero, a negative number, or a number greater than 100, will result in the script not working as intended. The percentage is converted to a decimal for the calculations. pct: The percentage of your money you want to use as a threshold for buying nodes and upgrades.If purchasing an upgrade is better, it will then determine which type of upgrade is best for each server and purchase upgrades accordingly. The script will calculate whether or not buying a server or purchasing an upgrade has a better return on investment. Purchases the number of requested hacknet nodes and upgrades based on a percentage of your current money. Note that all of the scripts listed require that you are using ns2 instead of ns1 hacknet-upgrades.jsĬredit to u/boz987 on Reddit for return on investment math Listed below is the name of each available script and a short description of what it does. While (i ns.A collection of scripts written for the game Bitburner. Let minRam = 8 // Smallest server I'm willing to purchase to get started. Let cash = ns.getServerMoneyAvailable("home") ** ns **/Ĭonst startingCash = ns.getServerMoneyAvailable("home") I don't claim it's perfect, but it is MUCH faster. I also added a call at the end if my money decreased over the run, but I've decided that's bad logic because it doesn't account for money I'm making in the background. You can tell my coding has evolved a little bit, I'm now taking arguments instead of editing the program for the values I want. I just wanted a way to easily upgrade each or start fresh after installing augmentations. Var instances = parseInt(minRam / payloadSize) Var instances = parseInt(ram / payloadSize) ![]() 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. 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." I kicked and screamed and thought "Well, NS1 is just fine. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |