Skip to content

Create go.js#22

Open
Krolck wants to merge 1 commit into
bitburner-official:masterfrom
Krolck:patch-1
Open

Create go.js#22
Krolck wants to merge 1 commit into
bitburner-official:masterfrom
Krolck:patch-1

Conversation

@Krolck

@Krolck Krolck commented Jun 15, 2025

Copy link
Copy Markdown

IPvGo script with basic moves

IPvGo script with basic moves
Comment thread go.js
@@ -0,0 +1,222 @@
const OPPONENT = "Netburners" || ns.args[0]
const SIZE = 5 || ns.args[1]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two problems with these two consts, The first is you cant call any ns functions outside main(ns) the second being you're using the || operator incorrectly, it returns the first "truthy" value and since "Netburners" will always be define it will never use the args value

The Fix

...
export async function main(ns) {
  const OPPONENT = ns.args[0] || "Netburners" 
  const SIZE = ns.args[1] || 5
  
...

you'll also have to move const defendMove, const captureMove, const expansionMove, and const randomMove to after the end of export async function main(ns) { ... }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall though the script itself is great and i've been using it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the advice! I'm kind of new to JS, but I'm glad to see people using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants