import time import base64 invCount = 0 up = False up2 = False down = False down2 = False left = False right = False left2 = False right2 = False abutton = False bbutton = False inventory = [] # -- PREDEF FUNCTIONS # -- PREDEF ITEM PROPERTIES # DEFAULT canConsume = False canShoot = False canEquip = False canUse = False hp1 = 100 heal = 0 messageUponUseNormal = "..." messageuponUseSpecial = "...!" # BREAD canGo = False def bread(): global canConsume, canShoot, canEquip, canUse, heal canConsume = True canShoot = False canEquip = True canUse = False heal = 25 # APPLE def apple(): global canConsume, canShoot, canEquip, canUse, heal canConsume = True canShoot = False canEquip = False canUse = False heal = 15 # FLUTE def flute(): global canConsume, canShoot, canEquip, canUse canConsume = False canShoot = False canEquip = False canUse = True messageUponUseNormal = ("You play the flute. It didn't seem to have any effect") messageUponUseSpecial = ("You play the flute...") # INVENTORY MAIN def inventoryFunction(): global hp1 hp = hp1 print(inventory) use = input("Use an item? ").lower() if use == "yes": which = input("Which? ").title() for item in inventory: if item == which: isFound = True func = item.lower() + "()" print(func) eval(func) # load the properties of the item hpFunc() print("Do what with",item + "?") action = input("Action? ").lower() if action == "eat" or action == "drink": doHeal = heal # How much it will heal -- use a seperate variable so I can abruptly change this to 0, stopping the process, without modifying the data of the item. if canConsume == True: for x in range(doHeal): hp += 1 if hp == 150: doHeal = 0 else: doNothing = True hp1 = hp else: print("Eww. That looks disgusting.") if action == "use" or action == "play": if canUse == True: print(messageUponUseNormal) else: print("What am I supposed to operate?") print("Item found.") if isFound == True: doNothing = True