yeah, another one...but this time in python! yay, more errors! :)

first off, here's the code..

(based off of chris99's code...the only example i could find for a text adventure game!)

Now, my problem is where it says

elif prompt_p == 'examine sign':
       print """Behold the mysterious grating! For some unknown reason, it will not open until you have 57 gold.
Why the odd number? I don't know...just play along will ya? You won't get out unless you do!"""
 prompt_p()

I run the program, and at first it appears to be working. From the start, I can go north to the clear field spot. But from there, no matter what I try to do, it gives me a

Traceback (most recent call last):
  File "C:\Documents and Settings\enokar\My Documents\programming stuff\Python\better text adventure test.py", line 56, in <module>
    field()
  File "C:\Documents and Settings\enokar\My Documents\programming stuff\Python\better text adventure test.py", line 16, in field
    prompt_field()
  File "C:\Documents and Settings\enokar\My Documents\programming stuff\Python\better text adventure test.py", line 20, in prompt_field
    clear_path()
  File "C:\Documents and Settings\enokar\My Documents\programming stuff\Python\better text adventure test.py", line 29, in clear_path
    prompt_path()
  File "C:\Documents and Settings\enokar\My Documents\programming stuff\Python\better text adventure test.py", line 43, in prompt_path
    prompt_p()
TypeError: 'str' object is not callable

:note: not actualy username...

anyway, anyone know how to solve this??

Yes!! I got it! okay never mind guys...

just to let other people know, I had to change at the end where I called the prompt_p. First I changed everything on that part the prompt_cle, and at the end to call the prompt again I had to put prompt_clear() instead of prompt_p().

okay, sorry for _triple_ post...
(new code)

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

now what?

try putting global gold as the first statement in any function that uses the variable 'gold'

all right! it works now...thanks for explaining it a little bit better to me!

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.