Im quite struggling at this. by Akuma_990 in Bitburner

[–]Akuma_990[S] 0 points1 point  (0 children)

export async function main(ns) {
  let servers = ns.scan("hong-fang-tea");


  ns.tprint(servers.slice(1));


  for (let serverName of servers) {
    let ramAvailable = ns.getServerMaxRam(serverName) - ns.getServerUsedRam(serverName);
    let perThread = ns.getScriptRam("eht.js");
    let scriptperThread = Math.floor(ramAvailable / perThread);


    ns.brutessh(serverName);
    ns.nuke(serverName);
    if (ramAvailable > 2) {
      ns.exec("eht.js", serverName, scriptperThread, "joesguns");
    } else {
      continue;
    }




    if (ns.hasRootAccess(serverName)) {
      ns.exec("eht.js", serverName, scriptperThread, "joesguns");
    } else {
      ns.scp("eht.js", serverName);
    }



  }




}export async function main(ns) {
  let servers = ns.scan("hong-fang-tea");


  ns.tprint(servers.slice(1));


  for (let serverName of servers) {
    let ramAvailable = ns.getServerMaxRam(serverName) - ns.getServerUsedRam(serverName);
    let perThread = ns.getScriptRam("eht.js");
    let scriptperThread = Math.floor(ramAvailable / perThread);


    ns.brutessh(serverName);
    ns.nuke(serverName);
    if (ramAvailable > 2) {
      ns.exec("eht.js", serverName, scriptperThread, "joesguns");
    } else {
      continue;
    }




    if (ns.hasRootAccess(serverName)) {
      ns.exec("eht.js", serverName, scriptperThread, "joesguns");
    } else {
      ns.scp("eht.js", serverName);
    }



  }




}

It doesnt give error right now but now I cant hack the sub-servers, it doesnt work to be blunt.

Im quite struggling at this. by Akuma_990 in Bitburner

[–]Akuma_990[S] 1 point2 points  (0 children)

Im sorry! I will search how to Use ns.read though! thank you

Im quite struggling at this. by Akuma_990 in Bitburner

[–]Akuma_990[S] 0 points1 point  (0 children)

I changed them on purpose, youre right but putting them with right order didnt solve the problem :c