


It’s noticeably more than our previous scripts. SECOND NOTE: Check out the RAM requirement for execute.script.
#Bitburner functions full#
You can find the full version, with comments, here. NOTE: this is a simplified version of execute.script without any validation or the use of a host argument which allows us to, say, use n00dles to run hack() against the foodnstuff server. Before we attempt to run a new script, we make sure all RAM is available by killing any scripts currently running on that server.
#Bitburner functions free#
If I want to switch over to grow, I have to first kill the weaken script so I can free up the RAM to run my grow script. But let’s say we run this on n00dles with the action of weaken, so n00dles is running a script with enough threads to full up all of its RAM. Afterward, I’ve added a tprint() to show that the execute.script has finished and what the result was. Killall() function: We’ve got our action script, target server, and how many threads we can use, let’s execute the script on that server! With the last exec(), we do just that. And yes, we can put functions into other functions as those functions arguments. And since we can only run whole number threads, not 2.5 threads for instance, we need to make the result a whole number. However, sometimes dividing one number by another doesn’t give us a whole number return. Using the two of these, we can determine how many threads of the script we can use on the server. That’s where getServerMaxRam() and getScriptRam() come into play. Threads: But we don’t want to just run a script with one thread on the server, we want to max it out and use all the RAM our target server uses! Servers like n00dles only have 2GB of RAM but other servers will have upwards to 128GB, and we don’t want to waste a single GB. Once we execute “execute.script”, this exec() will copy our weaken, grow, and hack scripts onto the target server and we will be able to run those scripts on the server. If we needed to, we could add more arguments after server, separated by commas, and they would all be added to the “args” list in the target script. In this instance, we are executing our copy_scripts.script from earlier on our “home” server, with 1 thread, with the target server being the argument for our copy_scripts.script. This function executes (exec is shorthand for execute) a script onto a target server. Let’s skip over “killall()” for a second and go to “exec()”. print will print to the log, which we saw when we executed `tail ` earlier.Įxec() Statement: Awesome, now our script knows what script we want to run (confused yet?). tprint is short for “terminal print”, or printing to the terminal. Inside the script, insert this text: while(true) which will tprint the message “Script unrecognized. This also creates a folder called “scripts” where “weaken.script” will be stored. In your terminal, start editing a script called “weaken.script” nano scripts/weaken.script Manually, this can be slow, so let’s start here. You know that you need to connect to a server, nuke it, and begin weakening its security while growing its money reserves so you can hack it. I’m assuming you’ve run through the tutorial. This article is meant to help get you started on your own journey of automating Bitburner with your own two hands. However, many aren’t that user-friendly, especially for someone new to programming or Javascript. wait what is my end goal? Hacking glory? Money mogul? Welcome to Bitburner.Įlsewhere online, there are Github repos full of scripts to completely automate playing this game, start to finish. I’m gonna need to automate this if I’ve got any hope of hacking my way to….
#Bitburner functions software#
But there’s a small problem, inflation has hit hard so although I just netted myself 70K, the cheapest software I can buy is 500K! And let’s not even start on my RAM upgrades. Black screen, bright green text, and using the words “nuke” and “hack” on servers to siphon money into my coffers.
