I'm working on this little text based game. Up to this point, I've gotten it to work, however I've heard I shouldn't be using global like I am. I have this set up to modify the global variables because I want the player to revisit a place and all the events have still been triggered.
I've just started programming, so I don't have knowledge of lots of concepts. The tutorials I've been reading include Learning Python the Hard Way.
print "You are a lone adventurer with the bounty to clear out the crypt." print "You come with nothing but your sword and a compass." print "You enter the crypt." print "To the north you have a gated portaculas and rooms to the west and east." print "What do you do?" gate = False lever = False def entrance(): global gate while True: choice = raw_input('> ') if choice == 'west': guard_shack() elif choice == 'east': lever_rm() elif choice == 'north' and gate == False: print "The gate is still closed and locked." entrance() elif choice == 'north' and gate == True: fountain_rm() else: entrance(gate) def lever_rm(): global lever global gate print "You enter the room." print "What do you do" while True: choice = raw_input('> ') if 'search' in choice: print "You look around the room and notice a lever on the opposite wall." elif "pull lever" in choice: print "You pull the lever." lever = True gate = True elif choice == 'west': entrance() else: print '> ' def fountain_rm(): print "you're in the lever room!" entrance()