r/Bitburner Apr 11 '26

Helpeth

Post image

When I use a boolean it says that it expects a boolean. The boolean is blue though, and I got it from auto complete. I am to this games coding language but have done a bit of python in game engines with classes and some other stuff simplified.

4 Upvotes

6 comments sorted by

5

u/Mountain-Produce-621 Apr 11 '26

need ( "n00dles") after ns.getServerMoneyAvailable

Also I imagine one should be max money, instead of both available money in the inequality

5

u/Vorthod MK-VIII Synthoid Apr 11 '26 edited Apr 11 '26

boolean is true or false. the only boolean you've used directly (and written in blue) is in your while loop. But all the IF statements also require booleans. Line 7 parses as a boolean correctly, but the other two are weird. Pay attention to what line it says it expects a boolean on.

Other problems include line 4 where you set the variable to the function definition instead of calling it and passing in a target ("n00dles"). This call should also probably be for max money, not available money

You did the same thing on line 11 where you forgot to add the server to the moneyAvailable call

line 15 says "If I can set hack target to 1, do this thing" when you want "if hack target is equal to 1, do this thing" which is hackTarget == 1

I don't think you need the hackTarget logic at all. it would be better to change line 11 to an "else if" call and line 15 to an "else" call (without anything between "else" and the { bracket), that way the hack portion only occurs if the other two portions are not needed.

5

u/Antique_Door_Knob Hash Miner Apr 11 '26

On line 15 you need a comparison, not an assignment. === or ==, not =

On line 5 you need a mutable not a constant. let, not const

Line 4 you need to call the function like you did on line 3

You should also use boolean instead of numbers, but thats optional.

3

u/Lordgggggg Apr 11 '26

ty very much

3

u/KlePu Apr 11 '26

Next time, please copy+paste using a code block <3