I want a room to be removed from my dictionary from the start of the game while snowboots = False. When snowboots = True, I want the room to be reachable, and I want picking up the snowboots to make them True.
if that makes sense.
roomDirections = {
"hallEnt":{"e":"hallMid"},
"hallMid":{"s":"snowRoom", "e":"giantNature", "w":"hallEnt"},
"snowRoom":{"n":"hallMid"},
"giantNature":{"s":"strangeWall", "e":"riverBank", "w":"hallMid"},
"strangeWall":{"s":"hallOuter", "e":"riverBank", "n":"giantNature"},
"riverBank":{"e":"lilyOne", "w":"giantNature"},
"lilyOne":{"e":"lilyTwo", "w":"riverBank", "n":"riverBank", "s":"riverBank"},
"lilyTwo":{"e":"riverBank", "w":"lilyThree", "n":"riverBank", "s":"riverBank"},
"lilyThree":{"e":"riverBank", "w":"lilyFour", "n":"riverBank", "s":"riverBank"},
"lilyFour":{"e":"riverBank", "w":"treasureRoom", "n":"riverBank", "s":"riverBank"},
"treasureRoom":{"w":"hallEnt"},
}
roomItems = {
"hallEnt":["snowboots"],
"snowRoom":["lamp"],
"treasureRoom":["treasure"],
}
snowboots = lamp = treasure = False
these are my dictionaries and my alleged variables.
if "snowboots" == False:
del roomDirections["hallMid"]
else:
print ("you cannot go that way")
this was meant to remove hallMid from roomDirections so movement from it is impossible, until...
elif playerInput in roomItems[currentRoom]:
print("picked up", playerInput)
invItems.append(playerInput)
playerInput == True
for i in range(0, len(roomItems[currentRoom])):
if playerInput == roomItems[currentRoom][i]:
del roomItems[currentRoom][i]
break
the snowboots = True, which is what this chunk was suppose to do but it doesn't seem to be working, am I close or am I completely off track?
EDIT -- My main game loop --
while True:
playerInput = input("What do you want to do? ")
playerInput = playerInput.lower()
if playerInput == "quit":
break
elif playerInput == "look":
print(roomDescriptions[currentRoom])
elif playerInput in dirs:
playerInput = playerInput[0]
if playerInput in roomDirections[currentRoom]:
currentRoom = roomDirections[currentRoom][playerInput]
print(roomEntrance [currentRoom])
else:
print("You can't go that way")
elif playerInput == "lookdown":
if currentRoom in roomItems.keys():
print ("You see", roomItems[currentRoom])
else:
print ("You see nothing on the ground")
elif playerInput == "inventory" or playerInput == "inv":
print (invItems)
elif playerInput in roomItems[currentRoom]:
print("picked up", playerInput)
invItems.append(playerInput)
for i in range(0, len(roomItems[currentRoom])):
if playerInput == roomItems[currentRoom][i]:
del roomItems[currentRoom][i]
break
elif playerInput in invItems:
print("dropped", playerInput)
roomItems[currentRoom].append (playerInput)
for i in range (0, len(invItems)):
if playerInput == invItems[i]:
del invItems[i]
break
else:
print ("I don't understand")