Codecombat - I am stuck on Alchemic Power

Can someone tell me what is wrong with my code? Theres other examples but they are all Python lol

can you go to the error or tell us what it says?

ahh ok i know the issue, on line 6 it says

auto potion = pet.findNearestByType("potion")

you dont need the nearest so it would be like

auto potion = pet.findByType("potion")

Or try this:

# Wait for alchemist's commands to fetch potions.

# The event handler for the pet's event "hear".
def onHear(event):
    # Find the nearest potion.
    potion = pet.findNearestByType("potion")
    message = event.message
    # If the event's message is "Fetch"
    if message == "Fetch":
        # Have the pet fetch the potion.
        pet.fetch(potion)
    # Else (for any other messages):
    else:
        # Use pet.moveXY to return the pet to the red mark.
        pet.moveXY(54, 34)

pet.on("hear", onHear)

# You don't have to change the code below.
while True:
    enemy = hero.findNearest(hero.findEnemies())
    if enemy:
        hero.attack(enemy)
    else:
        hero.moveXY(40, 34)

P.S. if this helps pls mark as solution…

@ChickenMaster He isn’t using python; also please don’t just give out solutions to levels

Okay, oops, and Sorry…!!!