Hint: Posting only the piece of code causing the problem will give you more answers...
Ara Kooser wrote: > Hello all, > > I hope I am posting this correctly. I am running Python 2.4.2 on > Slackware 11.0 using IDLE. I am in the process of learning python so I > am writing a text adventure game using functions and global variables > only. I know there is a better way to do this but that is for later. > > When I run the python program it works fine until I try to go west > from my inital start room. I get the room description but no raw_input > prompt. I just get dumped back to >>> in the python shell. I think I > am missing something simple. I pasted in the code below. I am using > gmail so I hope the formatting stays. If not I can send the .py as an > attachment if needed. Thanks. > > Ara > <clip> Giving the command 'w', you call meadow1() > elif prompt_o1 == "w": > meadow1() > def meadow1(): > <clip> > print > prompt_meadow1 So you end up here, the meadow1() function returns to the except ValueError: and ends then as expected. > > def meadow1_desc(): > prompt_meadow1 Same problem would occur in here. I guess you want to call this: > def prompt_meadow1(): > > prompt_m1 = raw_input("Type a command: ").lower() So write prompt_meadow1() instead of prompt_meadow1 (experiment in python shell and you see the difference. >>> raw_input <built-in function raw_input> >>> raw_input() now python waits for your input For the player, create a class. class player(object): def __init__(self): self.poisoned = False def take_poison(self): print 'You are poisoned' self.poisoned = True # effects of poison in here: # take some hitpoints # maybe reduce some stats # and so on... # now, generate a player instance p = player() # calls __init__ # poison the player p.take_poison() -- Juho Schultz -- http://mail.python.org/mailman/listinfo/python-list