u/Mr-Ordinary-

Logic Question

Hello, i am a bit lost here and wantet to ask for some help.

I am at a loss at why my variable wouldn work the same as the ns. "funktion?"? Is it cause if i declare a variable it only checks it when it starts the script and doesnt iterate it again, even the variable is called or what am i not understanding?
i am adding on the examples of the working one with the ns. version and the not working one with the call over the veriable. The script just keeps running with the veriable version.

#Trigger: i am dislexic XD no one ever told me coding is math *.*

Not working:

let target = ns.scan()
  let playerlvl = ns.getHackingLevel()
  while (playerlvl < 7) {
    ns.getHackingLevel()

Working Version:

 let target = ns.scan()
  let playerlvl = ns.getHackingLevel()
  let money = ns.getServerMoneyAvailable()
  while (ns.getHackingLevel() < 17) {

I even tried to call the Hackinglvl right after again to brutal force the information, still it didn't care.

Full working on:

/** u/param {NS} ns */
export async function main(ns) {


  ns.clearLog()


  let target = ns.scan()
  let playerlvl = ns.getHackingLevel()
  let money = ns.getServerMoneyAvailable()
  while (ns.getHackingLevel() < 17) {
    let runs = Math.floor(ns.getServerMaxRam() / 2.4)
    while (runs > 0, runs--)
      if ((ns.getServerMaxMoney(target[0]) * 0.8) > ns.getServerMoneyAvailable(target[0])) {
        await ns.grow(target[0])
      }
      else
        await ns.hack(target[0])
  }
  ns.getHackingLevel()


}

Only called it directly instead of the variable. And did try to call it directly before, after and so on, called it even in the parenttheses of the while() with (plvl<16, ns....) and it still didn't care.

Game is Bitburner btw, i think it's briliant.

The NS. call is Netscript so far as i did understand but game specific. Shouldn't change anything about the concept i am not getting, right?

Thank you and greetings to the community! Hope i am not asking too noob questions. Just started last week.

reddit.com
u/Mr-Ordinary- — 3 days ago
▲ 3 r/Bitburner+1 crossposts

Logic Question

Hello, i am a bit lost here and wantet to ask for some help.

I did a Prestige to myself in deleting my save state and trying it all by my own without copying something and now i am at a loss at why my variable wouldn work the same as the ns. "funktion?"? Is it cause if i declare a variable it only checks it when it starts the script and doesnt iterate it again, even the variable is called or what am i not understanding?
i am adding on the examples of the working one with the ns. version and the not working one with the call over the veriable. The script just keeps running with the veriable version.

#Trigger: i am dislexic XD no one ever told me coding is math *.*

Oh and greeting to the community! guess i will engage more in the future:))

https://preview.redd.it/uh9as4gw3z1h1.png?width=1831&format=png&auto=webp&s=5ffbfff05fa79767017851d1c5b1ed6ab39886d2

https://preview.redd.it/7xe838674z1h1.png?width=1707&format=png&auto=webp&s=ecc7be1c384a3694ce8ff5c72ba05805e60eae21

reddit.com
u/Mr-Ordinary- — 3 days ago