[SOLVED]Cluttered Corridors (python)

# Help the pet find the exit.

def onHear(event):
    word = event.message
    # Convert the word to lower case.
    word = phrase.toLowerCase
    if word == "north":
        pet.moveXY(pet.pos.x, pet.pos.y + 16)
    elif word == "east":
        pet.moveXY(pet.pos.x + 12, pet.pos.y)
    elif word == "south":
        pet.moveXY(pet.pos.x, pet.pos.y - 16)
    elif word == "west":
        pet.moveXY(pet.pos.x - 12, pet.pos.y)

# Assign the event handler for the pet's "hear" event.
pet.on("Hear, onHear")

u put the quotes wrong.

@SuperSmacker This is now my code

# Help the pet find the exit.

def onHear(event):
    word = event.message
    # Convert the word to lower case.
    word = phrase.toLowerCase
    if word == "north":
        pet.moveXY(pet.pos.x, pet.pos.y + 16)
    elif word == "east":
        pet.moveXY(pet.pos.x + 12, pet.pos.y)
    elif word == "south":
        pet.moveXY(pet.pos.x, pet.pos.y - 16)
    elif word == "west":
        pet.moveXY(pet.pos.x - 12, pet.pos.y)

# Assign the event handler for the pet's "hear" event.
pet.on("hear", onHear)

1 Like

@Archion This is the topic.

ok i dont really see what is wrong. it seems correct. What is your problem

Use word not prase cuz phraze is not defined but word is

# Help the pet find the exit.

def onHear(event):
    word = event.message
    # Convert the word to lower case.
    word = word.toLowerCase()
    if word == "north":
        pet.moveXY(pet.pos.x, pet.pos.y + 16)
    elif word == "east":
        pet.moveXY(pet.pos.x + 12, pet.pos.y)
    elif word == "south":
        pet.moveXY(pet.pos.x, pet.pos.y - 16)
    elif word == "west":
        pet.moveXY(pet.pos.x - 12, pet.pos.y)

# Assign the event handler for the pet's "hear" event.
pet.on("hear", onHear)

I fixed it but it said I ran out of time.

Then i dont know whats wrong

ooof you try on your computer or something

see if it works on yours…
(2o chars)

30%20PM

The code works fine for me.

Do you have the right book equiped that give the String.ToLowerCase() Function ?
if you don’t you will have to make your own lowercase function.

@Gamestack don’t use griffin pet. it drifts and causes problems.

Isn’t the griffin pet the default pet in this level?

yay I did it thx. :yum::yum::yum: