[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Text-Based RPG



Nope. Sorry. I'm new to Python- what does strip() do?
And would this be easier to write in HTML?

On Jun 18, 2007, at 12:36 PM, Casey Duncan wrote:


On Jun 18, 2007, at 9:29 AM, Jonah Fishel wrote:


I've been away from Python for several months. I just came back to it, to start working on a text-based RPG. To get started, I decided to move by rooms. I have separate text files for each major message, to conserve file space. What troubles me is that when I tested it, whenever I enter anything into the command line, it says 'Invalid command' which I included as an error message. Here is where I think the trouble is:


Perhaps command has a trailing newline?

try this:

def command_line():
    command = raw_input('>>> ').strip()

and see if that helps.

-Casey