Help on Signal Corpse - SOLVED!


#1

Hey everyone I’m stuck on Signal Corpse. It’s saying “Line 17: ReferenceError: enemy is not defined”. But I’m not sure how to define the enemy. Help on that would be great as well as any other errors.
Here’s my code:

loop:
    green = self.findFlag("green")
    black = self.findFlag("black")
    nearest = self.findNearestEnemy()
    
    if green:
        self.pickUpFlag(green)
        
        self.pickUpFlag(black)
        # Cleave!
    elif black and self.isReady("cleave"):
        self.cleave(enemy)

    elif nearest and self.distanceTo(nearest) < 10:
        # Attack!
        self.attack(enemy)
        pass

Thanks for the help!

@Luke10


#2

I believe you meant to use nearest instead of enemy:

self.cleave(nearest)
# ...
self.attack(nearest)

Look at what variables you have defined in the beginning of the loop. :wink:


#3

Thanks a bunch @UltCombo. I never realized that. Again, thanks a lot :grinning: :grinning: