[Solved] "Fix code" Explanation is Confusing


Maybe because I’m inexperienced with code lingo but I can’t understand what it’s saying…maybe actually using complete sentences in an explanation to someone who is learning would make sense…doesn’t do that though…just seems like gibberish, but also as many times as I looked at the example and copied exactly, the code does not work. Something’s off and there’s just not any decent explanation from the game as to why.

Level is Mayhem of Munchkins and here’s what I have:

Inside a while-true loop, use findNearestEnemy() and attack!

while True:
e = hero.findNearestEnemy


Fix code explanation just says:
Line 4: attack’s argument target should have type unit, but got function. Target a Unit.

[Please don’t swear]!?!?


Figured it out and it wasn’t even the line that the fix code explanation was saying was the problem…it was because I didn’t have an empty parenthesis next to findNearestEnemy…pretty frustrating

  1. No cursing (read community guidelines)
  2. Post your code in a legible manner. dont just paste it directly (read FAQ)
  3. “Frustrating” Seriously. Look at the number of worlds after dungeon. It will get unbearable if you think it’s frustrating right now. (sorry for pep talks)
  4. I’m gonna fix the title of this post, and mark it solved

  1. Didn’t cuss. F is a letter, but I’ll refrain from such abbreviations the future.

  2. My bad on that one. I did just paste it from the game.

  3. The fix code explanation not being legible was what was frustrating, I can handle repetitive problem solving for a very long time, but being given an extremely poorly written explanation as to what I’m doing wrong, not even using complete sentences frustrates me and on top of that…the problem it was stating didn’t exist…it was telling me the wrong problem on the wrong line. I had to find it out for myself by finally just ignoring what the thing was saying and looking elsewhere. The fix code explanation was actually the problem itself and the reason I couldn’t figure it out in the first place.

  4. Okay, thanks.


the problem exists,the fix code explanation was actually right, it is just you didn’t understand it, because it is a little bit advanced, the explanation is saying that you passed a function-type variable to attack, which is what you did, when you write only hero.findNearestEnemy without parenthesis, you are referring to the function named findNearestEnemy, not its result or the something that it returns, and it didn’t give you an error in line 3 because you can actually store functions into variables, but it gave you an error on line 4 because you need a unit-type variable, not a function-type variable


Functions have to have parentheses too, i think.
cuz when u define or use a function, u have to use parentheses.

def ActionWhenBored():
    hero.say("I'm bored.")