bitburner-official / bitburner-src

Bitburner source code.
Other
843 stars 273 forks source link

Scripts not working (might be a skill issue) #1666

Closed Anger-mp3 closed 2 months ago

Anger-mp3 commented 2 months ago

For some reason my script just don't work. I'm currently using v2.6.2 (633da3830). So, I was trying to set up a (very) simple hacking algorithm to hack n00dles. Using the code below While (true) { await ns.hack('n00dles') } And then after I finish the code, no red boxes on the left that tell me I have errors btw, I type into the terminal "run n00dles.js" because I just name my scripts on whoever I'm hacking, and then an error message pops up that states "ns is not defined". So I'm like "Isn't ns a thing that's supposed to be there?" and that's why I'm here now. Help? (Using steam to run bitburner so save files aren't an issue I believe because steam has cloud save)

catloversg commented 2 months ago

You will have to provide a save file for this kind of issue. It's very likely that the issue is in your code. Generally, you will receive the best support if you join Discord and ask there for issues in your scripts.

This is my guess for your case:

The basic script should look like this:

/** @param {NS} ns */
export async function main(ns) {
  while (true) {
    await ns.hack('n00dles');
  }
}
Anger-mp3 commented 2 months ago

@catloversg thx, works now, after copying and pasting ur example

Anger-mp3 commented 2 months ago

Really shows that I literally know nothing about coding, I just copy what it tells me to and replace the target if necessary