vortiwing.blogg.se

Bitburner purchase server code
Bitburner purchase server code




bitburner purchase server code

And what the heck are you trying to do in the final loop? the condition (one value multiplied by 13) would always be true if it weren’t commented out. Why don’t you just use let scriptArray = to be used in ns.scp(scriptArray, hostname) ? Does need one scp instead of 3 while uploading every amount of scripts at once. At first I thought you tried to write while else (turned out to be another commented if).

bitburner purchase server code

the linebreaks are a mess, if there are any. almost all ifs are commented out, for example. I don’t know if the website messed it up or it was user error but like this nobody can execute it. I just spent multiple minutes to fix the syntax errors before I was able to understand at least parts of it. Note: If you do not name the file servers.js, then you amend line 70 to whatever you name the file, or the rebuy function will not work. Ns.exec("yourScriptNameHere.js", hostname, 1) If you need to execute them as well, then add extra lines of Note that these will not auto-execute, they assume that your main script calls them.

  • Lines 45-50: If you want to upload more scripts, then amend these lines as well, if you do not need them, then delete them between the lines.
  • Line 13: Change “breaker.js” to whatever your main script filename is that you would like to execute on the remote server.
  • Ns.print('Starting scripts on existing servers.')įor(let x = 0 x ns.getPurchasedServerCost(ram)) if server is not running scripts, overwrite existing breaker and run. Check and ensure servers are running scripts (recover after a forced reboot) Let ram = calculateRam() // Calculates how much RAM to buy for the serverĬonst serverMax = 25 // hardcoded max servers as of Bitburner v1.3 Let currentServers = ns.getPurchasedServers() '2' is 50% of home RAMĬonst MAIN_SCRIPT = "breaker.js" // Name of your main script that you want to upload ~~~~~~~~~Editable variables~~~~~~~~~~~Ĭonst SVRNAME = "plex" // What hostname your purchased servers will haveĬonst MIN_RAM = 32 // Minimum RAM you want to buy for a serverĬonst SVR_RAM_RATIO = 2 // Target RAM for server is "Home" RAM, divided by SVR_RAM_RATIO, must = power of 2 (0.5, 1, 2, 4.).

    #Bitburner purchase server code code

    Added additional comments and MAIN_SCRIPT variable so that the code will be usable for others purchaseServer(hostname, ram) ¶ Purchased a server with the specified hostname and amount of RAM. Runs until satisfied, will rebuy servers money is sufficient and server is worse than 25% of ram. “run servers.js f”) The Script // Server purchasing script for Bitburner -, written by steamid/Meng You can force a server rebuy by running it with the ‘f’ argument (ie.






    Bitburner purchase server code