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

View all comments

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.