Advertisement
Guest User

auto start script

a guest
Jan 20th, 2024
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. /** @param {NS} ns */
  2. export async function main(ns) {
  3. // ns.disableLog("ALL");
  4. ns.tail();
  5. var hackLevel = ns.getHackingLevel();
  6. var money = ns.getServerMoneyAvailable("home");
  7. const moneyThresh = 5000000000;
  8. var script = ns.scriptRunning("bighack.js", "home");
  9.  
  10. async function kill() {
  11. ns.run("kill-network-scripts.js");
  12. }
  13.  
  14. async function earlyGame() {
  15. if (money < moneyThresh) {
  16. if (hackLevel < 10) {
  17. ns.exec("batchhack.js", "home", 1, "n00dles");
  18. while (hackLevel < 10) {
  19. ns.print("------------------------------");
  20. ns.print("Hacking n00dles: Hack Level is " + hackLevel + "/10");
  21. ns.print("------------------------------");
  22. await ns.sleep(1000);
  23. //ns.clearLog();
  24. }
  25. }
  26. else if (hackLevel >= 10 && hackLevel < 100) {
  27. ns.exec("batchhack.js", "home", 1, "joesguns");
  28. while (hackLevel < 100) {
  29. ns.print("------------------------------");
  30. ns.print("Hacking joesguns: Hack Level is " + hackLevel + "/100");
  31. ns.print("------------------------------");
  32. await ns.sleep(1000);
  33. //ns.clearLog();
  34. }
  35. }
  36. else if (hackLevel >= 100 && !ns.fileExists("Formulas.exe")) {
  37. ns.exec("batchhack.js", "home", 1, "phantasy");
  38. while (money < moneyThresh) {
  39. ns.print("------------------------------");
  40. ns.print("Hacking phantasy: Money is " + money + "/" + moneyThresh);
  41. ns.print("------------------------------");
  42. await ns.sleep(1000);
  43. //ns.clearLog();
  44. }
  45. await midGame();
  46. }
  47. }
  48. else if (money >= moneyThresh) {
  49. await midGame();
  50. }
  51. }
  52.  
  53. async function midGame() {
  54. if (!ns.fileExists("Formulas.exe")) {
  55. ns.alert("You can now purchase Formulas.exe");
  56. while (!ns.fileExists("Formulas.exe")) {
  57. var money = ns.getServerMoneyAvailable("home");
  58. ns.print("------------------------------");
  59. ns.print("Hacking phantasy: Money is " + money + "/" + moneyThresh);
  60. ns.print("Waiting for Formulas.exe");
  61. ns.print("------------------------------");
  62. await ns.sleep(1000);
  63. //ns.clearLog();
  64. }
  65. }
  66. }
  67.  
  68. if (script === false) {
  69. if (money < moneyThresh) {
  70. await earlyGame();
  71. }
  72. else if (money >= moneyThresh && !ns.fileExists("Formulas.exe")) {
  73. await midGame();
  74. }
  75. else if (ns.fileExists("Formulas.exe")) {
  76. ns.print("------------------------------");
  77. ns.print("Formulas.exe exists: Killing all scripts");
  78. ns.print("------------------------------");
  79. await kill();
  80. await ns.sleep(1000);
  81. //ns.clearLog();
  82. ns.print("------------------------------");
  83. ns.print("Purchasing servers, Queuing Stock Trader");
  84. ns.print("Spawning bighack.js");
  85. ns.print("------------------------------");
  86. ns.run("purchase-server.js", 1, 32);
  87. await ns.sleep(1000);
  88. ns.run("stonks.js");
  89. ns.spawn("bighack.js", 1, 20);
  90. }
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement