mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-08 08:37:48 +02:00
DOCUMENTATION: Update tutorial script for buying cloud servers (#2653)
This commit is contained in:
@@ -33,12 +33,12 @@ Adding a sleep like in the first example, or changing the code so that the `awai
|
||||
|
||||
Common infinite loop when translating the server purchasing script in starting guide to scripts is to have a while loop, where the condition's change is conditional:
|
||||
|
||||
var ram = 8;
|
||||
var i = 0;
|
||||
const ram = 8;
|
||||
let i = ns.cloud.getServerNames().length;
|
||||
|
||||
while (i < ns.cloud.getServerLimit()) {
|
||||
if (ns.getServerMoneyAvailable("home") > ns.cloud.getRamLimit(ram)) {
|
||||
var hostname = ns.cloud.purchaseServer("cloud-server-" + i, ram);
|
||||
const hostname = ns.cloud.purchaseServer("cloud-server-" + i, ram);
|
||||
ns.scp("early-hack-template.js", hostname);
|
||||
ns.exec("early-hack-template.js", hostname, 3);
|
||||
++i;
|
||||
|
||||
Reference in New Issue
Block a user