[quote=“MunkeyShynes, post:12, topic:13952”]
Ok so going back to your comments and checking I’ve done them.
1)Half your code uses the variable “target” and the other half uses an undefined variable “enemy”. Pick one and stick with it. Done!
- “Also, when you call your function, you don’t have to put hero”. in front of it.Done removed!
3)“You already have an if enemy conditional in the function, so you don’t have to use one in your while True loop. Just move to the xy coordinates and call the function”. Ok removed!
- “In your function the else statement doesn’t need an if enemy conditional statement after it”. Removed Done.!
5)“Read my comments in your code below.” Done!
6)“In your while true loop just move XY.” (I don’t think I have the coordinates wrong do I?)
- “And call the function. You don’t need to redefine the enemy variable or check for an enemy again.” This is all taken care of in your function. Done I believe!
[quote=“MunkeyShynes, post:15, topic:13952”]
Also, there should not be arguments in the parenthesis when you call your function. You should call the function just like it appears in the definition.
[/quote] Done too I think
so this is what I have now and I get this error message`def cleaveOrAttack():
# In the function, find an enemy, then cleave or attack it.
def cleaveOr Attack():
enemy = hero.findNearestEnemy()
if enemy:
if hero.isReady(“cleave”):
hero.cleave(enemy)
else:
hero.attack(enemy)
Move between patrol points and call the function.
while True:
hero.moveXY(37, 34)
# Use cleaveOrAttack function you defined above.
cleaveOrAttack()
hero.moveXY(47, 30)
# Call the function again.
cleaveOrAttack()
hero.moveXY(58,31)
# Call the function again.
cleaveOrAttack()`
Error Message highlights hero.attack(enemy) in red and Reads: Fix Your Code. Line 12: attack’s argument target should have type object, but got null. Target is null. Is there always a Target to attack? (Use if?)
My apologies for my stupidy and thank you for your patience.