(new code)

so, my new error message is 'local variable 'gold' refferenced before assignment.'

now what?

it's in the link...in the link is the whole code, but here is some....

#
if prompt_hou == 'examine table':
        print '''There are a lot of car magazines here. You flip through them and find
5 gold!'''
gold = gold+5
prompt_house()

and whenever run the program and enter that command, it gives me that error and quits...

did you define gold?
gold = gold + 5

if 'gold' is not defined before that statement then it doesn't know what to add 5 onto.

yeah, i did that at the beginning..

#
#better text adventure test
#Made by J. G. S.

gold = 0

def start():
   print '''You slowly open your eyes and find yourself lying on the ground.
You get up slowly, looking around as you do, and here is what you see.
As far as you can tell, you are in the middle of a field with tall grass.
You cannot see that good unless you jump. You see a sign off to the north.'''

but it still gives me that error...

If the first code you showed is part of a function you have to tell it that gold is a global variable, start your function code with

global gold

How would I do that? I tried adding global gold right before the gold = 0...but I got the same error. And i've also tried putting global gold like this:

def start(global gold):
    print '''You slowly open your eyes and find yourself lying on the ground.
You get up slowly, looking around as you do, and here is what you see.
As far as you can tell, you are in the middle of a field with tall grass.
You cannot see that good unless you jump. You see a sign off to the north.'''

but then it gives me "Invalid syntax"

what do I do?

This question has already been answered. Start a new discussion instead.