Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Buddy's name Help! (SOLVED)

I cant figure out how to make the pet say his name here is my code:

# We need to know the name of our new pet.

# Use this function as a handler for "hear" events on pet.
def onHear(event):
    # Don't change this function.
    pet.say("Meow Woof Meow")
    pet.say("Woof Woof")
    pet.say("Meow")
    pet.say("Meow")
    pet.say("Meow Woof Meow Meow")

# Use the pet.on(eventType, eventHandler) method
# Assign the onHear function to handle "hear" events.
def onHear(hear):
    
    pet.say("lol")
pet.on("hear", onHear)

# It must be after "pet.on".
hero.say("What's you name, buddy?")
pet.on("hear", onHear)

Delete that part, you need to define onHear again. Then you need to say the pets name with pet.on("hear", onHear). After that your hero needs to ask “What’s you name, buddy?”. Afterwards, your hero needs to ask “Could you repeat it?”. Then repeat the pet’s name.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.