Loud Quietness. Help please [Solved]

hello me again, i am not quite sure whats up with my code her nut it is not working the way i want it to. i might have written it wrong no promises it has been written right. The pet seems to say the password at the wrong volume, which in turn monkeys up the whole level. my apologies if i wasted you time but you help is greatly appreciated.

# Get the volume and the password.

def onHear(event):
    # Get the volume and the password.
    words = event.message.split(" ")
    volume = words[0]
    password = words[1]
    # If the password should be loud:
    if volume == "Loud":
        # The pet says it in UPPER CASE.
        pet.say(words[1].toUpperCase())
    # If the password should be quiet:
    if volume == "Quiet":
        # The pet says it in lower case.
        pet.say(words[1].toLowerCase())
    pet.moveXY(pet.pos.x+ 24, pet.pos.y)

def passDoor():
    guard = hero.findNearest(hero.findFriends())
    password = guard.password
    # If the password should be loud:
    if guard.isLoud:
        # Use the .toUpperCase() method on the password.
        hero.say(password.toUpperCase())
        pass
    # If the password should be quiet:
    elif guard.isQuiet:
        # Use the .toLowerCase() method on the password.
        hero.say(password.toLowerCase)
        pass
    hero.moveXY(hero.pos.x+ 24, hero.pos.y)

# The pet can hear guards.
pet.on("hear", onHear)
# The hero should use their properties.
hero.moveXY(10, 14)
passDoor()
passDoor()
1 Like

take a look at this line again. Are you calling a method/function or sending a value from a variable?

1 Like

that fixed the hero problem but now my pet is refusing to work properly.

1 Like

Try submitting the level a few times and see what happens.

1 Like

i have been trying that… i am going to reset it, rewrite it, and see if that works.

1 Like

yes that worked… wierd.

1 Like

What does that mean?

You are asking a question of someone who has not been seen on this board for over a year.

Compare these two lines from the OP code:

hero.say(password.toUpperCase())
hero.say(password.toLowerCase)

In the first line, the hero.say argument is being used as a method/function with its own argument. In the second line, the hero.say argument is being used as a variable. One is wrong, the other is correct.

Thanks, but I already figured it out:joy: