Dangerous key help


#21

@Chaboi_3000 are you able to help.


#22

You have some keys goldKey , silverKey and bronzeKey . What will fetch your pet, some property of the keys or the real keys?


#23

This isn’t a bug, you just need to check these lines: (btw is used Diff checker as @xython recommended and it was really helpful)

if you’re using these: “gold-key”, “bronze-key”, “silver-key”.
then what’s this for?

:wink:


#24

@Deadpool198 is right, @Gamestack. You can’t carry a string. :stuck_out_tongue: Use the variables you have defined.


#25

Woooooo hooo i am a regular now! So awsome!


#26

Good job dude! Keep up with the activity because after the grace period, you will have to work hard. XD


#27

Congratulations @Enderlord832 !
The above program has a logic flaw, commonly made and almost always neglected. If the code is into a while True loop you will make at least many additional iterations. See yourself the code execution

def mess(message):
    if message == "Gold":
        print("gold-key")
    if message == "Silver":
        print("silver-key")
    if message == "Bronze":
        print("bronze-key")

# def mess(message):
#     if message == "Gold":
#         print("gold-key")
#     elif message == "Silver":
#         print("silver-key")
#     elif message == "Bronze":
#         print("bronze-key")

keyMessages = ["Gold", "Silver", "Bronze"]

for message in keyMessages:
    mess(message)


#28

Thank you @Deadpool198 so I get rid of this?

paladinUnit = pet.findNearestByType("paladin")
    goldKey = pet.findNearestByType("gold-key")
    silverKey = pet.findNearestByType("silver-key")
    bronzeKey = pet.findNearestByType("bronze-key")

#29

Or this

pet.fetch("gold-key")
pet.fetch("silver-key")
pet.fetch("bronze-key")

#30

Neither. Replace each string in the pet.fetch with their respective variable.