Dangerous Key: please help me


#1

I need help please here is my code

# Listen to the paladin and fetch the right key.

def onHear(event):
    # The pet can find the paladin and keys.
    paladin = pet.findNearestByType("paladin")
    goldKey = pet.findNearestByType("gold-key")
    silverKey = pet.findNearestByType("silver-key")
    bronzeKey = pet.findNearestByType("bronze-key")
    # If event.speaker is the paladin:
    if event.speaker.type == "paladin":
        # If event.message is "Gold":
        if event.message == "Gold":
            # The pet should fetch the gold key.
            pet.fetch("gold-key")
        # If event.message is "Silver":
        if event.message == "Silver":
            # The pet should fetch the silver key.
            pet.fetch("silver-key")
        # If event.message is "Bronze":
        if event.message == "Bronze":
            # The pet should fetch the bronze key.
            pet.fetch("bronze-key")

pet.on("hear", onHear)

My pet keep saying I can’t carry that.
Why is that?
And also I am using a raven as a pet.
Plus there is no error in my code.


#2

A pet can’t carry a string of text.


#3

On top of what @Serg said, think about why you defined the variables bronzeKey, silverKey, and goldKey. What’s the purpose of defining them if you’re not going to fetch them. :wink:


#4

Ok thank guy sorry I took so long to get that message.