Just wondering how the game would be put together, maybe even a step by step tutorial. I could use this to practice with the commands used without Tkinter or Pygame. This could be a good learning experience.

The easiest game would be with a number of rooms. Draw yourself a map of 9 rooms (maybe a 3x3 pattern). Make notes on the map about details of the room, number of doors, contents, pictures, furniture and so on.

Let's say you come into the first room from the south. Now this room has a total of 4 doors, one to the south (S) where you came in, one to the east (E), north (N) and west (W). Ask the player which door he/she wants to enter. Like: "You want to go E, N or W?"

Rooms may have 2, 3 or 4 doors. Now the adventure begins. Some rooms contain a strength potion, or weapon, or some treasure, or cryptic instructions to read, or monsters to fight. When you fight a monster you lose strength. Some monsters are stronger than others. The player starts with a certain amount of strength points and gains more strength by picking up strength potions. Also loses less strength by picking up a better weapons. Each weapon has hit points, the more the better!

Describe the new room as the player enters. Like: "You entered a room that is painted green. There is a picture on the wall of an elderly gentleman. There are 5 gold pieces on the table for you. There are doors to the E and W. Do you want to go E or W?"

The rest is up to your imagination. When the player finds enough treasure (say 50 gold pieces total), he/she will have to get back to the exit alive to win the game. The room descriptions will aid. To make things more difficult, add a basement (stairs/doors to go down or D) or an upstairs (U) floor.

Show the player's present strength, weapon, gold pieces collected, and so on somehere on the screen.

I meant, should I def a room class, and make room objects with specific instructions?

Could someone please help me by telling me what code structure I should use, and an example? I'm trying, but I have no idea how to make it work. I've tried making a Room class, and making each room a sub-class am I on the right track? I just need pointing in the right direction.

It depends what you want to do. If you just want to make a simple fun game, there is no need for class objects. If you want to to do this to learn OOP, then by all means go for it. Your progress will be initially slow, because there is quite a learning curve.

Your approach making a class Room with the basics that all rooms can share, and then a class for each individual room that inherits the class Room makes the most sense. However, a lot of thought has to be put into this approach before any of the fun starts.

Just let us know what you have come up with, and how you would test each class to make sure it does what you want it to do.

Text based role playing games (RPG) used to be plentiful in the early days of personal computing. Usually written in Basic, C or Pascal, but I have not seen just a text based RPG in a modern language like Python.

I would most likely define a function for each room and handle all the descriptions, actions, and connections to other rooms from there. Looks like an interesting project and a good way to learn Python skills! Later, as the project grows, you can use classes to group the functions together.

You could start with a 3 by 3 cluster of connected rooms and ask the player to explore all the rooms with the least amount of moves. Hide a few gold pieces and maybe add a secret door or two that can be opend by solving a riddle. As you get the hang of it, you can add weapons, monsters, spells and potions.

There are some GUI based RPGs on the PyGame website, but that gets to be pretty large and complex for beginners.

Doing one command at a time, teting each one. Need help, I tried defining gold as a global variable, as it wasn't working when I just created it out of the loop, but the Reading Room won't add 30 gold Where am I going wrong?

#Text Adventure.py
#By Chris O'Leary

global gold
gold=0

def start():
    print '''You find yourself in the foyer of a large house. You
    have no idea how you got there. You look around, and see the front door.
    It is locked and barred, and the bar is nailed down. There is
    no way to open it. There are three other doors in the area. A voice says '50 gold is what you need,
    to escape my grasp, of this take heed!'''
    print
    
def foyer():
    print "Current Gold = ",gold
    print '''You are in the Foyer. The walls are lined with trophy cabinets
    and suits of armour. The exits are (N)orth, (E)ast and (W)est.
    Type 'Help' for a full list of commands.'''
    print
    prompt_foy()
    
def prompt_foy():
    prompt_f = raw_input("Type a command: ")
    if prompt_f == "W":
        reading_room()
    elif prompt_f == "Help":
        print "Look, Examine (Object), N, W, E, S, Take (Item)"
        prompt_foy()
    elif prompt_f == "Examine Armour":
        print "The armour is rusted, and not of any use."
        prompt_foy()
    elif prompt_f == "Examine Cabinet":
        print '''The cabinet is lined with trophies, dating back to the 1800s.
        Seems this was a talented family.'''
        prompt_foy()
    elif prompt_f == "S":
        if gold < 50:
            print "You can't get out untill you have 50 gold."
            prompt_foy()

def reading_room():
    print "Current Gold = ",gold
    print '''You are in an large reading room. The room is stuffed with novels
    and poetry books on every shelf. There is a large table in the middle
    of the room. It has a reading lamp, and a cluster of books scattered about
    on top. The exits are (N)orth and (E)ast. Type 'Help' for a full list of
    commands.'''
    print
    prompt_rea()
    
def prompt_rea():
    prompt_r = raw_input("Type a command: ")
    if prompt_r == "E":
        foyer()
    elif prompt_r == "Help":
        print "Look, Examine (Object), N, W, E, S, Take (Item)"
        prompt_rea()
    elif prompt_r == "Look":
        "You see 30 gold pieces on the table."
        prompt_rea()
    elif prompt_r == "Take Gold":
        print "You get 30 gold!"
        gold = gold+30
        reading_room()
start()
foyer()

Can you see the problem?

def prompt_rea():
    global gold
    ....
    ....

Can you see the problem?

if you want to use gold as global, u might like to put "global gold" inside prompt_rea()

Thanks, it works now!

You are off to an interesting start! Nice foyer, hehe, almost like mine at home!

Declare the variable gold global in each function that uses this global variable. This would also apply to strength, weapons, or any monster-kill flags. If a monster has been killed in a room you can set the flag so that this monster does not attack again. Of course you could revive the monster and make things much more difficult.

Sorry, I just realized that in your first version you might not go with monsters yet. Just explore, find enough gold, and get out! It will be interesting to read all your room descriptions.

I'm using flags to prevent getting the same gold hoardes twice. Setting the variable to false when the gold is taken. Done three rooms:

Reading Room -- Foyer -- Servants Quarters

That's a small map -----------^

Just sticking with the goal of 50 gold for now.

So Ene_Uran, your imprisoned in your own home too? You got the 50$ toll to get out :P.

6 rooms done! Just need to do the top three, the try...except statements and the ending!

I hope you let us see the result. We can play it, and give you helpful hints, if you don't mind!

I just have 2 rooms to go, and an ending. Then I'll playtest it, using every command programmed making sure they all work. You can wait a couple more days right?

I am willing to wait! Good things take their time. Hehe, try to tell that to your boss!

I am willing to wait! Good things take their time. Hehe, try to tell that to your boss!

Well, wait no longer! Advent House v1.0 is here. Let me know of any formatting errors. Hope you like it.

Nice, nice, nice and spooky!!!! Just in time for Halloween!
I haven't tested it all the way, but made few recommendations and corrections indicated by the #!!!!! marks:

#Text Adventure.py
#By Chris O'Leary

# functions will pick the external gold value (for instance), as long as gold is not 
# a variable declared locally inside the function, this behaviour may change in future
# versions of Python, the safest way would be add the statement "global gold" to each 
# function that uses it !!!!!!!!!!!!

"""
# global declarations go into the functions that use them!!!!!
global gold
global gotGold_reading
global gotGold_SQ
global gotGold_liv
global gotGold_draw
global gotGold_din
"""

gold = 0
gotGold_reading = 0
gotGold_SQ = 0
gotGold_liv = 0
gotGold_draw = 0
gotGold_din = 0

# recommend to make help a function and give a few more details ...
def help():
    print "look, examine (object), n, w, e, s, take (item)"
    print "Example: examine vase, take gold"

    

def start():
    print '''
        ADVENT HOUSE v1.0
    You find yourself in the foyer of a large house. You
    have no idea how you got there. You look around, and see the front door.
    It is locked and barred, and the bar is nailed down. There is
    no way to open it. There are three other doors in the area. A voice says
    '50 gold is what you need,
    to escape my grasp, of this take heed!'

    Note: All instructions must be typed in small letters. No capitals.'''
    # recommend to add .lower() to all raw_input() so you don't need the above note!!!!!
    # add this Note: All commands can be entered in lower or upper case!
    print
    
def foyer():
    global gold  # !!!!!!!!
    print "     Current Gold = ",gold
    print '''    You are in the Foyer. The walls are lined with trophy cabinets
    and suits of armour. The exits are (N)orth, (E)ast and (W)est.
    Type 'help' for a full list of commands.'''
    print
    prompt_foy()

def foy_desc():
    print '''    The walls are lined with trophy cabinets and suits of armour.
    The exits are (N)orth, (E)ast and (W)est.'''
    print
    prompt_foy()
    
def prompt_foy():
    global gold  # !!!!!!!
    # make input string lower case automatically!!!!
    prompt_f = raw_input("Type a command: ").lower()
    try:
        if prompt_f == "w":
            reading_room()
        elif prompt_f == "e":
            servants_quarters()
        elif prompt_f == "help":
            # made help a function call here ...
            help()
            #print "look, examine (object), n, w, e, s, take (item)"
            print
            prompt_foy()
        elif prompt_f == "examine armour":
            print "The armour is rusted, and not of any use."
            print
            prompt_foy()
        elif prompt_f == "examine cabinet":
            print '''    The cabinet is lined with trophies, dating back to the 1800s.
            Seems this was a talented family.'''
            print
            prompt_foy()
        elif prompt_f == "look":
            foy_desc()
        elif prompt_f == "s":
            if gold < 50:
                print "You can't get out untill you have 50 gold."
                print
                prompt_foy()
            elif gold == 50:
                ending()
        elif prompt_f == "n":
            main_hall()
        else:
            print "That command is invalid"
            print
            prompt_foy()
    except ValueError:
        print "That command is invalid"
        print
        prompt_foy()

def reading_room():
    global gold   # !!!!!
    print "      Current Gold = ",gold
    print '''    You are in an large reading room. The room is stuffed with novels
    and poetry books on every shelf. There is a large table in the middle
    of the room. It has a reading lamp, and a cluster of books scattered about
    on top. The exits are (n)orth and (e)ast. Type 'help' for a full list of
    commands.'''
    print
    prompt_rea()

def rea_desc():
    print '''    The room is stuffed with novels and poetry books on
    every shelf. There is a large table in the middle of the room.
    It has a reading lamp, and a cluster of books scattered about
    on top. The exits are (n)orth and (e)ast.'''
    print
    prompt_rea()
    
def prompt_rea():
    global gold
    global gotGold_reading
    prompt_r = raw_input("Type a command: ").lower()  #!!!!!
    try:
        if prompt_r == "e":
            foyer()
        elif prompt_r == "n":
            drawing_room()
        elif prompt_r == "help":
            print "look, examine (object), n, w, e, s, take (item)"
            print
            prompt_rea()
        elif prompt_r == "examine table":
            if gotGold_reading == 0:
                print "You see 30 gold pieces on the table."
                print
                prompt_rea()
            elif gotGold_reading == 1:
                print "The table is cluttered with books."
                print
                prompt_rea()
        elif prompt_r == "look":
            rea_desc()
        elif prompt_r == "take gold":
            if gotGold_reading==0:
                print "You get 30 gold!"
                print
                gold=gold+30
                gotGold_reading=1
                reading_room()
            elif gotGold_reading==1:
                print "No gold in here"
                print
                prompt_rea()
        elif prompt_r == "examine shelves":
            print '''    There are numerous bookshelves and countless books,
            and some novels are scattered under the reading lamp. Obviously
            they were terrible housekeepers.'''
            print
            prompt_rea()
        else:
            print "That command is invalid"
            print
            prompt_rea()
    except ValueError:
        print "That command is invalid"
        print
        prompt_rea()
def servants_quarters():
    global gold  # !!!!!
    print "Current Gold = ",gold
    print '''    You are in a small room, with a large, old bed. There is an open
    wardrobe in the corner with a small amount of clothes still in it.
    Obviously a servant used to sleep here.

    Type 'help' for a full list of commands.'''
    print
    prompt_SQ()
def serv_desc():
    print '''    There is an open wardrobe in the corner with
    a small amount of clothes still in it. There is a large bed.'''
    print
def prompt_SQ():
    global gold
    global gotGold_SQ
    prompt_s = raw_input("Type a command: ").lower()  #!!!!!
    try:
        if prompt_s == "w":
            foyer()
        elif prompt_s == "n":
            living_room()
        elif prompt_s == "help":
            print "look, examine (object), n, w, e, s, take (item)"
            print
            prompt_SQ()
        elif prompt_s == "examine bed":
            if gotGold_SQ == 0:
                print '''    There are no bedclothes. The mattress is old and motheaten. You
                see a hole with gold pieces in it. There are five.'''
                print
                prompt_SQ()
            elif gotGold_SQ == 1:
                print '''    There are no bedclothes. The mattress is old and motheaten. There
                is a hole in the matress.'''
                print
                prompt_SQ()
        elif prompt_s == "examine wardrobe":
            print "The door is ajar. You see a maid's uniform, but there is nothing of interest."
            print
            prompt_SQ()
        elif prompt_s == "take gold":
            if gotGold_SQ == 0:
                print "You get 5 gold!"
                print
                gold = gold+5
                gotGold_SQ = 1
                servants_quarters()
            elif gotGold_SQ == 1:
                print "There is no gold here."
                print
                prompt_SQ()
        elif prompt_s == "look":
            serv_desc()
        else:
            print "That command is invalid"
            print
            prompt_SQ()
    except ValueError:
        print "That command is invalid"
        print
        prompt_SQ()
def living_room():
    global gold         # !!!!!
    print "Current Gold = ",gold
    print '''    You are in a large room. There is an old, decaying sofa and
    a chair that has fallen into disrepair. Both are covered in cobwebs.
    There is an old, dusty fireplace, with a large chimney. The logs and carpet
    are caked with soot, presumably recent. It appears to have been a living
    room at some point. There are exits (n)orth, (w)est and (s)outh.

     Type 'help' for a full list of instructions.'''
    print
    prompt_liv()
def liv_desc():
    print '''    There is an old, decaying sofa and a chair that has
    fallen into disrepair. Both are covered in cobwebs. There is an old,
    dusty fireplace, with a large chimney. The logs and carpet are caked
    with soot, presumably recent.'''
    print
    prompt_liv()
    
def prompt_liv():
    global gold
    global gotGold_liv
    print
    prompt_l = raw_input("Type a command: ").lower()  #!!!!!!
    try:
        if prompt_l == "s":
            servants_quarters()
        elif prompt_l =="n":
            conservatory()
        elif prompt_l == "examine sofa":
            print '''    The sofa is in disrepair, there are springs poking
            out everywhere.'''
            print
            prompt_liv()
        elif prompt_l == "help":
            print "look, examine (object), n, w, e, s, take (item)"
            print
        elif prompt_l == "w":
            main_hall()  # was mail_hall()  !!!!!!!!!!
        elif prompt_l == "examine fireplace":
            if gotGold_liv == 0:
                print "There are ten, slightly sooty, gold pieces in the hearth."
                print
                prompt_liv()
            elif gotGold_liv == 1:
                print "The hearth is a mess."
                print
                prompt_liv()
        elif prompt_l == "examine chair":
            print "The chair is in awful condition. The cushions have rising damp."
            print
            prompt_liv()
        elif prompt_l == "take gold":
            if gotGold_liv == 0:
                print "You got 10 gold!"
                print
                gold = gold+10
                gotGold_liv = 1
                living_room()
            elif gotGold_liv == 1:
                print "There is no gold here."
                print
                prompt_liv()
        elif prompt_l == "look":
            liv_desc()
        else:
            print "That command is invalid"
            print
            prompt_liv()
    except ValueError:
        print "That command is invalid"
        print
        prompt_liv()

def main_hall():
    global gold  # !!!!!
    print "Current Gold = ",gold
    print '''    You are in the main hall. You see a staircase, however it has
    collapsed. There are three portraits surrounding you, captioned with names:
    Master Daniel Redwood, Mistress Stephanie Redwood and Mister Ivan Redwood.
    There are four exits, (n)orth, (s)outh, (e)ast and (w)est.'''
    print
    prompt_main()
def main_desc():
    print '''    You see a staircase, however it has
    collapsed. There are three portraits surrounding you, captioned with names:
    Master Daniel Redwood, Mistress Stephanie Redwood and Mister Ivan Redwood.'''
    print
    prompt_main()
def prompt_main():
    prompt_m = raw_input("Type a command: ").lower()  #!!!!!!
    try:
        if prompt_m == "s":
            foyer()
        elif prompt_m == "e":
            living_room()
        elif prompt_m == "w":
            drawing_room()
        elif prompt_m == "n":
            kitchen()
        elif prompt_m == "help":
            print "look, examine (object), n, w, e, s, take (item)"
            print
            prompt_main()
        elif prompt_m == "look":
            main_desc()
        elif prompt_m == "examine pictures":
            print '''    The family look happy in their respective photos.
            They are wearing champion ribbons.'''
            prompt_main()
        elif prompt_m == "examine staircase":
            print "The stairs are totally destroyed."
            prompt_main()
        else:
            print "That command is invalid"
            print
            prompt_main()
    except ValueError:
        print "That command is invalid"
        print
        prompt_main()
def drawing_room():
    print "Current gold = ",gold
    print '''    You are in the drawing room. There is a table with documents
    scattered all over it. There is a single painting, a portrait of the wife,
    on the south wall. The bookshelves here are filled with diaries.

    The exits are (n)orth, (s)outh and (e)ast.'''
    print
    prompt_draw()
def draw_desc():
    print '''    There is a table with documents scattered all over it.
    There is a single painting, a portrait of the wife, on the south wall.
    The bookshelves here are filled with diaries.'''
    print
    prompt_draw()
def prompt_draw():
    global gold
    global gotGold_draw
    prompt_d = raw_input("Type a command: ").lower()  #!!!!
    try:
        if prompt_d == "s":
            reading_room()
        elif prompt_d == "e":
            main_hall()
        elif prompt_d =="n":
            dining_room()
        elif prompt_d == "look":
            draw_desc()
        elif prompt_d == "examine bookshelves":
            print "The shelves are cluttered with diaries."
            print
            prompt_draw()
        elif prompt_d == "examine table":
            print '''    The floor plans are detailed here. The ground floor is layed out
            in a three-by-three grid.'''
            print
            prompt_draw()
        elif prompt_d == "examine portrait":
            if gotGold_draw == 0:
                print '''    She was hauntingly beautiful. There is a single
                gold piece adorning the frame.'''
                print
                prompt_draw()
            elif gotGold_draw == 1:
                print "She was hauntingly beautiful."
                print
                prompt_draw()
        elif prompt_d == "take gold":
            if gotGold_draw == 0:
                print "You got 1 gold!"
                gold = gold+1
                gotGold_draw = 1
                prompt_draw()
        elif prompt_d == "help":
            print "look, examine (object), n, w, e, s, take (item)"
            print
            prompt_draw()
        else:
            print "That command is invalid"
            print
            prompt_draw()
    except ValueError:
            print "That command is invalid"
            print
            prompt_draw()
def conservatory():
    global gold  #!!!!
    print "Current gold = ",gold
    print '''    You are in a large glass conservatory. There are plants everywhere.
    There is a set of garden furniture right in the centre, and an assortment of
    plants, potted around the edge. There are exits to the (s)outh and (w)est.

    Type 'help' for a full list of commands.'''
    print
    prompt_con()
def con_desc():
    print '''    You are in a large glass conservatory. There are plants everywhere.
    There is a set of garden furniture right in the centre, and an assortment of
    plants, potted around the edge.'''
    print
    prompt_con()  #!!!!!!!
def prompt_con():
    prompt_c = raw_input("Type a command: ").lower()  #!!!!!!
    try:
        if prompt_c == "s":
            living_room()
        elif prompt_c == "w":
            kitchen()
        elif prompt_c == "examine plants":
            print '''    There are several varieties of flowers and vines planted
            in various locations in the conservatory.'''
            print
            prompt_con()
        elif prompt_c == "look":
            con_desc()
        elif prompt_c == "examine furniture":
            print '''    The furniture is a complete set. It is white. There are
            three tables and a chair.'''
            print
            prompt_con()
        elif prompt_c == "help":
            print "look, examine (object), n, w, e, s, take (item)"
            print
            prompt_con()
        else:
            print "That command is invalid"
            print
            prompt_con()
    except ValueError:
        print "That command is invalid."
        print
        prompt_con()

def kitchen():
    global gold  #!!!!!
    print "Current Gold = ",gold
    print '''    You are in a large kitchen. The sideboard is solid mahogany,
    but hopelessly scratched. There is a large rusted gas stove in the corner
    with what looks like a mouldy roast inside. The knife rack has a large
    and menacing array of pointy things, but in stark contrast the cupboards
    are all bare. The exits are (s)outh, (e)ast and (w)est.

    Type help for a full list of commands.'''
    print
    prompt_kit()
def kit_desc():
    print '''    The sideboard is solid mahogany, but hopelessly scratched.
    There is a large rusted gas stove in the corner with what looks like
    a mouldy roast inside.The knife rack has a large and menacing array of
    pointy things, but in stark contrast the cupboards are all bare.'''
    print
    prompt_kit()
def prompt_kit():
    prompt_k = raw_input("Type a command: ")
    try:
        if prompt_k == "s":
            main_hall()
        elif prompt_k == "e":
            conservatory()
        elif prompt_k == "w":
            dining_room()
        elif prompt_k == "look":
            kit_desc()
        elif prompt_k == "examine sideboard":
            print '''    The sideboard has been badly scratched. The wood is
            worn away to almost nothing'''
            print
            prompt_kit()
        elif prompt_k == "examine stove":
            print "The stove is broken."
            print
            prompt_kit()
        elif prompt_k == "examine roast":
            print "Eeeeewwww!"
            print
            prompt_kit()
        elif prompt_k == "examine rack":
            print "The rack is full of sharp objects. Better stay away!"
            print
            prompt_kit()
        elif prompt_k == "examine cupboard":
            print "Empty"
            print
            prompt_kit()
        elif prompt_k == "help":
            print "look, examine (object), n, w, e, s, take (item)"
            print
            prompt_kit()
        else:
            print "That command is invalid!"
            print
            prompt_kit()
    except ValueError:
        print "That command is invalid!"
        print
        prompt_kit()

def dining_room():
    global gold  #!!!!!!
    print "Current Gold = ",gold
    print '''    There is a large oak table in the centre of the room. It, unlike
    the rest of the house, is in good condition. There are 6 chairs around the table
    that must have been used for the family and their friends. There is a large vase
    in the corner that is decorated with a Salvador Dali work involving melting
    clocks. On the north wall is a family photo containing not just the father, mother
    and children but other family members too. On the west wall is a tapestry
    depicting a great battle.
    The Exits are (s)outh and (e)ast.

    Type 'help' for a full list of commands.'''
    print
    prompt_din()
def din_desc():
    print '''    There is a large oak table in the centre of the room. It, unlike
    the rest of the house, is in good condition. There are 6 chairs around the table
    that must have been used for the family and their friends. There is a large vase
    in the corner that is decorated with a Salvador Dali work involving melting
    clocks. On the north wall is a family photo containing not just the father, mother
    and children but other family members too. On the west wall is a tapestry
    depicting a great battle.'''
    print
    prompt_din()
def prompt_din():
    global gotGold_din
    global gold
    prompt_di=raw_input("Type a command: ").lower()  #!!!!!!!
    try:
        if prompt_di == "e":
            kitchen()
        elif prompt_di == "s":
            drawing_room()
        elif prompt_di == "examine table":
            print "The table is untarnished. Strange..."
            print
            prompt_din()
        elif prompt_di == "examine chairs":
            print "There are enough for the whole family and three guests"
            print
            prompt_din()
        elif prompt_di == "examine vase":
            if gotGold_din == 0:
                print "There are 4 gold pieces in the vase."
                print
                prompt_din()
            elif gotGold_din == 1:
                print "It has a picture by Salvador Dali on it."
                print
                prompt_din()
        elif prompt_di == "examine photo":
            print "An old family photo. How sweet."
            print
            prompt_din()
        elif prompt_di == "examine tapestry":
            print "It depicts a ferocious war in the year... Let's see... 26BC."
            print
            prompt_din()
        elif prompt_di == "take gold":
            if gotGold_din == 0:        # added ==  !!!!!!!!!!!
                print "You got 4 gold"
                gotGold_din = 1
                gold=gold+4             # changed to gold=gold+4  !!!!!!! 
                print
                dining_room()
            elif gotGold_din == 1:      # added ==  !!!!!!!!!!!
                print "No gold here"
                print
                prompt_din()
        else:
            print "That command is invalid"
            print
            prompt_din()
    except ValueError:
        print "That command is invalid"
        print
        prompt_din()
def ending():
    print '''    You place the coins on the doormat. The voice rings out again:
    "I thank you for gathering these coins that I lost. I need them to fix the stairs.
    I can't get upstairs if the stairs are gone, and that is where I pay my bills.
    You may go now." And with that, the bolt disintegrates, allowing the door to swing
    open and you to leave.

    THE END'''

    dummy = raw_input("Press any button to quit.")
    
start()
foyer()

Thanks for the info. But I was already declaring all the globals within the functions that used them. I'll alter the help thing and the .lower(), and upload v1.1

Hi ya Chris, nice work indeed! Reads like a mystery novel!
Just a little note on global variables ...

x = 77

def test1():
    # this will work and print 77 without declaring x as a global
    # still, it would be better to declare global x in the function
    # so you have an idea where x comes from
    print x

def test2():
    # this works and will print 77 then print 33
    global x
    print x
    x = 33
    print x

def test3():
    # this will give an error since there is also a local variable x
    # UnboundLocalError: local variable 'x' referenced before assignment
    print x
    x = 33
    print x

test1()
print
test2()
print
test3()

Here's the version that converts the commands to lowercase, adds help as a function called help1() and alters a few other minor oopsies that will affect the game, such as improperly lined-up nested if-elif statements.

I am adding floor two now. 5 rooms, the gold fixes the stairs but you can't go back down, for story purposes. Two enemies to kill, three statues to collect, and I will finish off by adding a third floor, an attic to polish the game off. I have come up with a cool story behind the family.

Here's the version that converts the commands to lowercase, adds help as a function called help1() and alters a few other minor oopsies that will affect the game, such as improperly lined-up nested if-elif statements.

Just a few observation on your latest work of art ...

errata:

at the beginning remove the six lines starting with global
they don't accomplish anything!

in function prompt_liv() add () to .lower
also mail_hall() should be main_hall()

in function prompt_din() change gold=gold+1 to gold=gold+4

function servants_quarters() need door directions

Thanks, fixed. Now I'll continue working on floor two!

Good job!

Some testing results:


1) Starting in the foyer and going n, e, w leads to an endless loop of "invalid command" -- no commands, even help, are recognized.

2) Starting in the foyer and going e, followed by "look", gives this:

There is an open wardrobe in the corner with
a small amount of clothes still in it. There is a large bed.

>>>

(i.e., the program suddenly quits, with no warning!)

3) In the room with the oak table, I can take 4 gold but it only adds 1 to my gold total.

4) This may be a feature, or it may not, but I can go from room to room, typing "take gold", and I get the gold without having to search anything for it.

These comments are not intended critically in any way ... just the usual testing that I do with code.

Jeff

Thanks Jeff. I fixed everything on the list. If you find anything else, let me know. I'll upload at the end of this last update to give it 3 floors.

Having problem with battles. Tried all sorts of things in the random module, but nothing is working properly. I need help with the functions fight_unicorn() and monster_turn1()

#Text Adventure.py
#By Chris O'Leary
import random
gold=0
gotGold_reading = 0
gotGold_SQ = 0
gotGold_liv = 0
gotGold_draw = 0
gotGold_din = 0
monsterKilled_kid = 0
monsterKilled_Master = 0
statue = 0
gotStatue_serv = 0
gotStatue_Master = 0
gotStatue_kid = 0
gold_found1 = 0
gold_found2 = 0
gold_found3 = 0
gold_found4 = 0
gold_found5 = 0
monster_HP1 = 4
hp = 10
def help1():
    print "look, examine (object), n, w, e, s, take (item), attack (monster)"
    print "Examples: examine chair, take gold, attack demon"
    print
def start():
    print '''
        ADVENT HOUSE v2.0
    You find yourself in the foyer of a large house. You
    have no idea how you got there. You look around, and see the front door.
    It is locked and barred, and the bar is nailed down. There is
    no way to open it. There are three other doors in the area. A voice says
    '50 gold is what you need,
    to escape my grasp, of this take heed!'
    Note: All instructions can be typed in lower or upper case letters.'''
    print
    
def foyer():
    global gold
    global statue
    print "     Current Gold = ",gold,
    print "     Current statues = ",statue 
    print '''    You are in the Foyer. The walls are lined with trophy cabinets
    and suits of armour. The exits are (N)orth, (E)ast and (W)est.
    Type 'help' for a full list of commands.'''
    print
    prompt_foy()
def foy_desc():
    print '''    The walls are lined with trophy cabinets and suits of armour.
    The exits are (N)orth, (E)ast and (W)est.'''
    print
    prompt_foy()
    
def prompt_foy():
    global gold
    prompt_f = raw_input("Type a command: ").lower()
    try:
        if prompt_f == "w":
            reading_room()
        elif prompt_f == "e":
            servants_quarters()
        elif prompt_f == "help":
            help1()
            prompt_foy()
        elif prompt_f == "examine armour":
            print "The armour is rusted, and not of any use."
            print
            prompt_foy()
        elif prompt_f == "examine cabinet":
            print '''    The cabinet is lined with trophies, dating back to the 1800s.
            Seems this was a talented family.'''
            print
            prompt_foy()
        elif prompt_f == "look":
            foy_desc()
        elif prompt_f == "s":
            if gold < 50:
                print "You can't get out untill you have 50 gold."
                print
                prompt_foy()
            elif gold == 50:
                ending_floor1()
        elif prompt_f == "n":
            main_hall()
        elif prompt_f == "debug":
            fight_unicorn()
        else:
            print "That command is invalid"
            print
            prompt_foy()
    except ValueError:
        print "That command is invalid"
        print
        prompt_foy()
def reading_room():
    global gold
    global statue
    print "     Current statues = ",statue 
    print "      Current Gold = ",gold
    print '''    You are in an large reading room. The room is stuffed with novels
    and poetry books on every shelf. There is a large table in the middle
    of the room. It has a reading lamp, and a cluster of books scattered about
    on top. The exits are (n)orth and (e)ast. Type 'help' for a full list of
    commands.'''
    print
    prompt_rea()
def rea_desc():
    print '''    The room is stuffed with novels and poetry books on
    every shelf. There is a large table in the middle of the room.
    It has a reading lamp, and a cluster of books scattered about
    on top. The exits are (n)orth and (e)ast.'''
    print
    prompt_rea()
    
def prompt_rea():
    global gold
    global gotGold_reading
    global gold_found1
    prompt_r = raw_input("Type a command: ").lower()
    try:
        if prompt_r == "e":
            foyer()
        elif prompt_r == "n":
            drawing_room()
        elif prompt_r == "help":
            help1()
            prompt_rea()
        elif prompt_r == "examine table":
            if gotGold_reading == 0:
                print "You see 30 gold pieces on the table."
                print
                gold_found1 = 1
                prompt_rea()
            elif gotGold_reading == 1:
                print "The table is cluttered with books."
                print
                prompt_rea()
        elif prompt_r == "look":
            rea_desc()
        elif prompt_r == "take gold":
            if gotGold_reading==0 and gold_found1 == 1:
                print "You get 30 gold!"
                print
                gold=gold+30
                gotGold_reading=1
                reading_room()
                
            elif gotGold_reading==1:
                print "No gold in here"
                print
                prompt_rea()
                
            elif gold_found1 == 0:
                print "Where is the gold?"
                print
                prompt_rea()
        elif prompt_r == "examine shelves":
            print '''    There are numerous bookshelves and countless books,
            and some novels are scattered under the reading lamp. Obviously
            they were terrible housekeepers.'''
            print
            prompt_rea()
        else:
            print "That command is invalid"
            print
            prompt_rea()
    except ValueError:
        print "That command is invalid"
        print
        prompt_rea()
def servants_quarters():
    global gold
    global statue
    print "Current statues = ",statue 
    print "Current Gold = ",gold
    print '''    You are in a small room, with a large, old bed. There is an open
    wardrobe in the corner with a small amount of clothes still in it.
    Obviously a servant used to sleep here. There are exits to the north and west.
    Type 'help' for a full list of commands.'''
    print
    prompt_SQ()
def serv_desc():
    print '''    There is an open wardrobe in the corner with
    a small amount of clothes still in it. There is a large bed.'''
    print
    prompt_SQ()
def prompt_SQ():
    global gold
    global gotGold_SQ
    global gold_found2
    prompt_s = raw_input("Type a command: ").lower()
    try:
        if prompt_s == "w":
            foyer()
        elif prompt_s == "n":
            living_room()
        elif prompt_s == "help":
            help1()
            prompt_SQ()
        elif prompt_s == "examine bed":
            if gotGold_SQ == 0:
                print '''    There are no bedclothes. The mattress is old and motheaten. You
                see a hole with gold pieces in it. There are five.'''
                print
                gold_found2 = 1
                prompt_SQ()
            elif gotGold_SQ == 1:
                print '''    There are no bedclothes. The mattress is old and motheaten. There
                is a hole in the matress.'''
                print
                prompt_SQ()
        elif prompt_s == "examine wardrobe":
            print "The door is ajar. You see a maid's uniform, but there is nothing of interest."
            print
            prompt_SQ()
        elif prompt_s == "take gold":
            if gotGold_SQ == 0 and gold_found2 == 1:
                print "You get 5 gold!"
                print
                gold = gold+5
                gotGold_SQ = 1
                servants_quarters()
            elif gotGold_SQ == 1:
                print "There is no gold here."
                print
                prompt_SQ()
            elif gold_found == 0:
                print "Where is the gold?"
                print
                prompt_SQ()
        elif prompt_s == "look":
            serv_desc()
        else:
            print "That command is invalid"
            print
            prompt_SQ()
    except ValueError:
        print "That command is invalid"
        print
        prompt_SQ()
def living_room():
    global statue
    global gold
    print "Current Gold = ",gold
    print "Current statues = ",statue
    print '''    You are in a large room. There is an old, decaying sofa and
    a chair that has fallen into disrepair. Both are covered in cobwebs.
    There is an old, dusty fireplace, with a large chimney. The logs and carpet
    are caked with soot, presumably recent. It appears to have been a living
    room at some point. There are exits (n)orth, (w)est and (s)outh.
     Type 'help' for a full list of instructions.'''
    print
    prompt_liv()
def liv_desc():
    print '''    There is an old, decaying sofa and a chair that has
    fallen into disrepair. Both are covered in cobwebs. There is an old,
    dusty fireplace, with a large chimney. The logs and carpet are caked
    with soot, presumably recent.'''
    print
    prompt_liv()
    
def prompt_liv():
    global gold
    global gotGold_liv
    global gold_found3
    print
    prompt_l = raw_input("Type a command: ").lower()
    try:
        if prompt_l == "s":
            servants_quarters()
        elif prompt_l =="n":
            conservatory()
        elif prompt_l == "examine sofa":
            print '''    The sofa is in disrepair, there are springs poking
            out everywhere.'''
            print
            prompt_liv()
        elif prompt_l == "help":
            help1()
            prompt_liv()
        elif prompt_l == "w":
            main_hall()
        elif prompt_l == "examine fireplace":
            if gotGold_liv == 0:
                print "There are ten, slightly sooty, gold pieces in the hearth."
                print
                gold_found3= 1
                prompt_liv()
            elif gotGold_liv == 1:
                print "The hearth is a mess."
                print
                prompt_liv()
        elif prompt_l == "examine chair":
            print "The chair is in awful condition. The cushions have rising damp."
            print
            prompt_liv()
        elif prompt_l == "take gold":
            if gotGold_liv == 0 and gold_found3 == 1:
                print "You got 10 gold!"
                print
                gold = gold+10
                gotGold_liv = 1
                living_room()
            elif gotGold_liv == 1:
                print "There is no gold here."
                print
                prompt_liv()
            elif gold_found3 == 0:
                print "Where is the gold?"
                print
                prompt_liv()
        elif prompt_l == "look":
            liv_desc()
        else:
            print "That command is invalid"
            print
            prompt_liv()
    except ValueError:
        print "That command is invalid"
        print
        prompt_liv()
def main_hall():
    global gold
    global statue
    print "Current Gold = ",gold
    print "Current statues = ",statue
    print '''    You are in the main hall. You see a staircase, however it has
    collapsed. There are three portraits surrounding you, captioned with names:
    Master Daniel Redwood, Mistress Stephanie Redwood and Mister Ivan Redwood.
    There are four exits, (n)orth, (s)outh, (e)ast and (w)est.'''
    print
    prompt_main()
def main_desc():
    print '''    You see a staircase, however it has
    collapsed. There are three portraits surrounding you, captioned with names:
    Master Daniel Redwood, Mistress Stephanie Redwood and Mister Ivan Redwood.'''
    print
    prompt_main()
def prompt_main():
    prompt_m = raw_input("Type a command: ").lower()
    try:
        if prompt_m == "s":
            foyer()
        elif prompt_m == "e":
            living_room()
        elif prompt_m == "w":
            drawing_room()
        elif prompt_m == "n":
            kitchen()
        elif prompt_m == "help":
            help1()
            prompt_main()
        elif prompt_m == "look":
            main_desc()
        elif prompt_m == "examine pictures":
            print '''    The family look happy in their respective photos.
            They are wearing champion ribbons.'''
            prompt_main()
        elif prompt_m == "examine staircase":
            print "The stairs are totally destroyed."
            prompt_main()
        else:
            print "That command is invalid"
            print
            prompt_main()
    except ValueError:
        print "That command is invalid"
        print
        prompt_main()
def drawing_room():
    global gold
    global statue
    print "Current gold = ",gold
    print "Current statues = ",statue
    print '''    You are in the drawing room. There is a table with documents
    scattered all over it. There is a single painting, a portrait of the wife,
    on the south wall. The bookshelves here are filled with diaries.
    The exits are (n)orth, (s)outh and (e)ast.'''
    print
    prompt_draw()
def draw_desc():
    print '''    There is a table with documents scattered all over it.
    There is a single painting, a portrait of the wife, on the south wall.
    The bookshelves here are filled with diaries.'''
    print
    prompt_draw()
def prompt_draw():
    global gold
    global gotGold_draw
    global gold_found4
    prompt_d = raw_input("Type a command: ").lower()
    try:
        if prompt_d == "s":
            reading_room()
        elif prompt_d == "e":
            main_hall()
        elif prompt_d =="n":
            dining_room()
        elif prompt_d == "look":
            draw_desc()
        elif prompt_d == "examine bookshelves":
            print "The shelves are cluttered with diaries."
            print
            prompt_draw()
        elif prompt_d == "examine table":
            print '''    The floor plans are detailed here. The ground floor is layed out
            in a three-by-three grid.'''
            print
            prompt_draw()
        elif prompt_d == "examine portrait":
            if gotGold_draw == 0:
                print '''    She was hauntingly beautiful. There is a single
                gold piece adorning the frame.'''
                print
                gold_found4 = 1
                prompt_draw()
            elif gotGold_draw == 1:
                print "She was hauntingly beautiful."
                print
                prompt_draw()
        elif prompt_d == "take gold":
            if gotGold_draw == 0 and gold_found4 == 1:
                print "You got 1 gold!"
                gold = gold+1
                gotGold_draw = 1
                prompt_draw()
            elif gotGold_draw == 1:
                print "There is no gold here"
                print
                prompt_draw()
            elif gold_found4 == 0:
                print "Where is the gold?"
                print
                prompt_draw()
        elif prompt_d == "help":
            help1()
            prompt_draw()
        else:
            print "That command is invalid"
            print
            prompt_draw()
    except ValueError:
            print "That command is invalid"
            print
            prompt_draw()
def conservatory():
    global gold
    global statue
    print "Current gold = ",gold
    print "Current statues = ",statue
    print '''    You are in a large glass conservatory. There are plants everywhere.
    There is a set of garden furniture right in the centre, and an assortment of
    plants, potted around the edge. There are exits to the (s)outh and (w)est.
    Type 'help' for a full list of commands.'''
    print
    prompt_con()
def con_desc():
    print '''    You are in a large glass conservatory. There are plants everywhere.
    There is a set of garden furniture right in the centre, and an assortment of
    plants, potted around the edge.'''
    print
def prompt_con():
    prompt_c = raw_input("Type a command: ").lower()
    try:
        if prompt_c == "s":
            living_room()
        elif prompt_c == "w":
            kitchen()
        elif prompt_c == "examine plants":
            print '''    There are several varieties of flowers and vines planted
            in various locations in the conservatory.'''
            print
            prompt_con()
        elif prompt_c == "look":
            con_desc()
        elif prompt_c == "examine furniture":
            print '''    The furniture is a complete set. It is white. There are
            three tables and a chair.'''
            print
            prompt_con()
        elif prompt_c == "help":
            help1()
            prompt_con()
        else:
            print "That command is invalid"
            print
            prompt_con()
    except ValueError:
        print "That command is invalid."
        print
        prompt_con()
def kitchen():
    global gold
    global statue
    print "Current Gold = ",gold
    print "Current statues = ",statue
    print '''    You are in a large kitchen. The sideboard is solid mahogany,
    but hopelessly scratched. There is a large rusted gas stove in the corner
    with what looks like a mouldy roast inside. The knife rack has a large
    and menacing array of pointy things, but in stark contrast the cupboards
    are all bare. The exits are (s)outh, (e)ast and (w)est.
    Type help for a full list of commands.'''
    print
    prompt_kit()
def kit_desc():
    print '''    The sideboard is solid mahogany, but hopelessly scratched.
    There is a large rusted gas stove in the corner with what looks like
    a mouldy roast inside.The knife rack has a large and menacing array of
    pointy things, but in stark contrast the cupboards are all bare.'''
    print
    prompt_kit()
def prompt_kit():
    prompt_k = raw_input("Type a command: ").lower()
    try:
        if prompt_k == "s":
            main_hall()
        elif prompt_k == "e":
            conservatory()
        elif prompt_k == "w":
            dining_room()
        elif prompt_k == "look":
            kit_desc()
        elif prompt_k == "examine sideboard":
            print '''    The sideboard has been badly scratched. The wood is
            worn away to almost nothing'''
            print
            prompt_kit()
        elif prompt_k == "examine stove":
            print "The stove is broken."
            print
            prompt_kit()
        elif prompt_k == "examine roast":
            print "Eeeeewwww!"
            print
            prompt_kit()
        elif prompt_k == "examine rack":
            print "The rack is full of sharp objects. Better stay away!"
            print
            prompt_kit()
        elif prompt_k == "examine cupboard":
            print "Empty"
            print
            prompt_kit()
        elif prompt_k == "help":
            help1()
            prompt_kit()
        else:
            print "That command is invalid!"
            print
            prompt_kit()
    except ValueError:
        print "That command is invalid!"
        print
        prompt_kit()
def dining_room():
    global gold
    global statue
    print "Current Gold = ",gold
    print "Current statues = ",statue
    print '''    There is a large oak table in the centre of the room. It, unlike
    the rest of the house, is in good condition. There are 6 chairs around the table
    that must have been used for the family and their friends. There is a large vase
    in the corner that is decorated with a Salvador Dali work involving melting
    clocks. On the north wall is a family photo containing not just the father, mother
    and children but other family members too. On the west wall is a tapestry
    depicting a great battle.
    The Exits are (s)outh and (e)ast.
    Type 'help' for a full list of commands.'''
    print
    prompt_din()
def din_desc():
    print '''    There is a large oak table in the centre of the room. It, unlike
    the rest of the house, is in good condition. There are 6 chairs around the table
    that must have been used for the family and their friends. There is a large vase
    in the corner that is decorated with a Salvador Dali work involving melting
    clocks. On the north wall is a family photo containing not just the father, mother
    and children but other family members too. On the west wall is a tapestry
    depicting a great battle.'''
    print
    prompt_din()
def prompt_din():
    global gotGold_din
    global gold
    global gold_found5
    prompt_di=raw_input("Type a command: ").lower()
    try:
        if prompt_di == "e":
            kitchen()
        elif prompt_di == "s":
            drawing_room()
        elif prompt_di == "help":
            help1()
            prompt_din()
        elif prompt_di == "examine table":
            print "The table is untarnished. Strange..."
            print
            prompt_din()
        elif prompt_di == "examine chairs":
            print "There are enough for the whole family and three guests"
            print
            prompt_din()
        elif prompt_di == "examine vase":
            if gotGold_din == 0 and gold_found5 == 0:
                print "There are 4 gold pieces in the vase."
                print
                gold_found5 = 1
                prompt_din()
            elif gotGold_din == 1:
                print "It has a picture by Salvador Dali on it."
                print
                prompt_din()
        elif prompt_di == "examine photo":
            print "An old family photo. How sweet."
            print
            prompt_din()
        elif prompt_di == "examine tapestry":
            print "It depicts a ferocious war in the year... Let's see... 26BC."
            print
            prompt_din()
        elif prompt_di == "take gold":
            if gotGold_din == 0 and gold_found5 == 1:
                print "You got 4 gold"
                gotGold_din = 1
                gold=gold+4
                print
                dining_room()
            elif gotGold_din == 1:
                print "No gold here"
                print
                prompt_din()
            elif gold_found == 0:
                print "Where is the gold?"
                print
                prompt_din()
        else:
            print "That command is invalid"
            print
            prompt_din()
    except ValueError:
        print "That command is invalid"
        print
        prompt_din()
def ending_floor1():
    print '''    You place the coins on the doormat. The voice rings out again:
    "I thank you for gathering these coins that I lost. I need them to fix the stairs.
    I can't get upstairs if the stairs are gone, and that is where I pay my bills.
    Follow me upstairs" You go to the Main Hall and are suprised to see the stairs
    are already repaired. Amazed you follow him up.
    "I have three statues that I may need to sell. Can you help me find them?"
    You nod. "Fine then, here is a sword. You may need it." You see a blue barrier
    form around the stairs. You move to ask him what it is, but he cuts you off with
    "Can't have you trying to run off on me now can we?"'''
    print
    landing()
def landing():
    print "Current statues = ",statue
    print '''You are on the landing. The stairs back down are blocked by a blue
    aura. The stairs to the attic are nonexistant. There are paintings
    of a wide array of mythical creatures. There is just a large hole in the
    ceiling where the ladder should be. The exits are (n)orth, (s)outh, (e)ast
    and (w)est.
    Type 'help' for a full list of commands.'''
    print
    prompt_land()
def landing_desc():
    print '''The stairs back down are blocked by a blue aura. The stairs to the
    attic are nonexistant. There are paintings of a wide array of mythical
    creatures. There is just a large hole in the ceiling where the ladder
    should be. The exits are (n)orth, (s)outh, (e)ast and (w)est.'''
    print
    prompt_land()
def prompt_land():
    try:
        print "Current Statues = ",statue
        prompt_la = raw_input("Type a command: ").lower()
        if prompt_la == "w":
            bathroom()
        elif prompt_la == "e":
            servants_quarters2()
        elif prompt_la == "n":
            master_bedroom()
        elif prompt_la == "s":
            kid_bedroom()
        elif prompt_la == "examine aura":
            print "There is no way through. You are trapped."
            print
            prompt_land()
        elif prompt_la == "examine paintings":
            print '''On closer examination, all the paintings do share one creature.
            They all have a Sphinx somewhere in the background or foreground.'''
            print
            prompt_land()
        elif prompt_la == "help":
            help1()
            prompt_land()
        else:
            print "That command is invalid"
            prompt_land()
    except ValueError:
        print "That command is invalid"
        prompt_land()
def fight_unicorn():
    global monster_HP1
    global hp
    hit_miss = random.choice('01')
    if hit_miss == 1:
        print "You hit the monster!"
        monster_HP1 = monster_HP1 - 1
        if monster_HP1 == 0:
            print "You win!"
            master_bedroom()
        else:
            monster_turn1()
    else:
        print "You Missed"
        monster_turn1()
def monster_turn1():
    monster_hit = random.choice('01')
    if monster_hit == 1:
        print "You are hit!"
        hp = hp-1
        if hp == 0:
            print "Game Over"
    else:
        print "The monster missed"
        fight_unicorn()
        
            
def master_bedroom():
    global monsterKilled_Master
    print "Current statues = ",statue
    print '''You appear to be in the main bedroom. There is a large double bed
    against the wall. There are two wardrobes on either side of it, and a bedside table
    with an 1880s alarm clock.'''
    if monsterKilled_Master == 0:
        print '''There is a hideous demon on the bed. It resembles a unicorn, but it
        has no skin, and it has a fifth leg that dangles from it's underbelly.'''
        print
        prompt_mas()
    elif monsterKilled_Master == 1 and gotStatue_Master == 0:
        print '''The bedsheets are stained with blood. There is a small statue of an
        old man on the bed.'''
        print
        prompt_mas()
    elif gotStatue_Master == 1:
        print "The bedsheets are stained with blood."
        
def prompt_mas():
    prompt_m = raw_input("Type a command: ")
    if prompt_m == "s":
        landing()
    elif prompt_m == "attack demon":
        fight_unicorn()
start()
foyer()

The problem lies here:

def fight_unicorn():
    global monster_HP1
    global hp
    hit_miss = random.choice('01')
    if hit_miss == 1:
        print "You hit the monster!"
        monster_HP1 = monster_HP1 - 1
        if monster_HP1 == 0:
            print "You win!"
            master_bedroom()
        else:
            monster_turn1()
    else:
        print "You Missed"
        monster_turn1()
def monster_turn1():
    monster_hit = random.choice('01')
    if monster_hit == 1:
        print "You are hit!"
        hp = hp-1
        if hp == 0:
            print "Game Over"
    else:
        print "The monster missed"
        fight_unicorn()

Heres how it is meant to play out:

1) Player's turn. Select a number at random from 0 or 1
2)If 1 then you have hit the monster. Check to see if the monsters HP is at 0
3)If yes then player wins. Return to the room
4)If no then monster's turn
5)Monster's turn
6)See player step 1
7)If 1 then you are hit. -1 hp
8)If hp at 0 then GAME OVER
9)If 0 then miss. Player Turn
10) Repeat until one character is at 0 HP.

It keeps going:

Monster miss
Monster miss
Monster miss... Repeat ad infinitum.

How do I fix this?

At first glance, random.choice('01') returns a string '0' or '1' so your if statement has to reflect that:

def fight_unicorn():
    global monster_HP1
    global hp
    hit_miss = random.choice('01')
    if hit_miss == '1':                  #!!!!!!!
        print "You hit the monster!"
        monster_HP1 = monster_HP1 - 1
        if monster_HP1 == '0':      #!!!!!!!!
            print "You win!"
            master_bedroom()
        else:
            monster_turn1()
    else:
        print "You Missed"
        monster_turn1()

def monster_turn1():
    monster_hit = random.choice('01')
    if monster_hit == '1':             #!!!!!!
        print "You are hit!"
        hp = hp-1
        if hp == 0:
            print "Game Over"
    else:
        print "The monster missed"
        fight_unicorn()

Note, if you want an integer returned, use one of the following:

x = random.choice([0, 1])
print x, type(x)  # testing

x = random.randrange(0, 2)
print x, type(x)

x = random.randint(0, 1)
print x, type(x)

Thanks, it works perfectly now! That part was hard...

Chris, this approach would avoid the repetition of the room description and make the code shorter. Here is a test code:

gold = 0
gotGold_reading = 0

def reading_room():
    global gold
    print "    Current Gold = ",gold
    print "    You are in a large reading room ..."
    rea_desc()
    #prompt_rea()

def rea_desc():
    print '''    The room is stuffed with novels and poetry books on every
    every shelf. There is a large table in the middle of the room.
    It has a reading lamp, and a cluster of books scattered about
    on top. The exits are (N)orth and (E)ast.  
    Type 'help' for a full list of commands.'''
    print
    prompt_rea()

def prompt_rea():
    global gold
    global gotGold_reading
    prompt_r = raw_input("Type a command: ").lower()
    # etc etc ...

reading_room()

Ok, I'll take that into account, Bumsfield.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.