
- #Bitburner execute function with arbitrary arguments how to#
- #Bitburner execute function with arbitrary arguments upgrade#
- #Bitburner execute function with arbitrary arguments full#
And then you can execute all those scripts with varying parameters from one singular big script that scans for targets, checks current server for money, security etc. The overhead of calling function is on the order of a virtual function call. Since any function instance could hold any callable, the call through a function must be indirect. This will in turn, keep your script size down so you can run more threads for more money etc over time. Calling a function is also slower than calling the contents directly. The way I visit an arbitrary server is by running the mapHosts function from. When coding, if you have a lot of repeating things in your code, make a function or make variables for it! You can make a variable into an argument so it's more flexible if you run it manually or just want to change some values with a script that updates all other scripts. So this will run foo.js on foodnstuff with 5 threads and the arguments 1. Useful if you don't want them getting removed when augmenting!Ħ. pd in pd/bitburner create branch employee-prod-optimization. You can use "download *.ns" on your home pc to download all. (currently running saves that have already prestiged will have to prestige their bitnode. (because starting over is slow in the beginning, so you don't want to restart everything over and over)ĥ.

#Bitburner execute function with arbitrary arguments upgrade#
Upgrade the ram in your PC, and don't augment until you're in the hundreds of billions in cash. What am I doing wrong here ns.tprint(ns.kill/js/selfFarm.js. Make one script that runs in one thread that checks the server every now and then for whatever your parameters are (how much money, security etc), and then make it run the hack, grow, weaken scripts as needed.Ĥ. This is returning false, even though I know this script is running on that server, with no arguments. Make different scripts for different functions, one for hack, one for grow and one for weaken. Make a script for infecting the server you choose with all the files that you require.ģ. script for menial tasks like moving and copying a list of files, but other than that NS2 should be your main way of scripting.Ģ. The differences isn't huge in the way you use them but NS2 is a thousand times better. Tips i want to make for anyone reading this:ġ.

Yes i agree with others that the tutorial was a bit confusing at some points. I can confidently say i have infected every server in the game with a script that will pull updated scripts from home and run them on every server that is hackable. Notice that we were able to use the forEach method because args is a real array: arguments.forEach on the other hand does not exist.

#Bitburner execute function with arbitrary arguments full#
After a brief tutorial, some searching around in the full documentation and some trial and error. We initialize the sum of all the elements as zero and then iterate over the elements of the newly created args array and increment the total variable by the value of the selected element.
#Bitburner execute function with arbitrary arguments how to#
Before starting this game i had no clue how to code.
