Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - Command parsing... best module to use?

 
Thread Tools Search this Thread
Old 11-02-2009, 02:27 PM   #1
Default Command parsing... best module to use?


Hey everyone.

I am writing a game in python, and it includes a text console somewhat
like the one in WoW and Runescape. I want to be able to include "/"
commands, like IRC, and was wondering what the best module would be to
parse these.

Thanks a lot,
Collin D


Collin D
  Reply With Quote
Old 11-02-2009, 04:22 PM   #2
TerryP
 
Posts: n/a
Default Re: Command parsing... best module to use?
On Nov 2, 2:27*pm, Collin D <collin.da...@gmail.com> wrote:
> Hey everyone.
>
> I am writing a game in python, and it includes a text console somewhat
> like the one in WoW and Runescape. I want to be able to include "/"
> commands, like IRC, and was wondering what the best module would be to
> parse these.
>
> Thanks a lot,
> Collin D


I'm not aware of any module designed for parsing arbitrary text in
that way, although it may be possible to subvert something to the
task. If you are following the usual IRC client behavioural pattern,
then just suck up the line - then see if the first non-whitespace
character is a '/', then react accordingly. Simple.


TerryP
  Reply With Quote
Old 11-02-2009, 06:21 PM   #3
Mark Tolonen
 
Posts: n/a
Default Re: Command parsing... best module to use?

"Collin D" <> wrote in message
news:94dbc92b-0682-4995-b358-...
> Hey everyone.
>
> I am writing a game in python, and it includes a text console somewhat
> like the one in WoW and Runescape. I want to be able to include "/"
> commands, like IRC, and was wondering what the best module would be to
> parse these.


Check out the pyparsing module. Here is a presentation given by the author
for parsing an interactive game.

http://us.pycon.org/zope/talks/2006/.../04/index.html

-Mark




Mark Tolonen
  Reply With Quote
Old 11-03-2009, 01:14 AM   #4
Collin D
 
Posts: n/a
Default Re: Command parsing... best module to use?
Thanks for the replies. Pyparsing looks just like what I need.



Collin D
  Reply With Quote
Old 11-03-2009, 03:17 PM   #5
Simon Hibbs
 
Posts: n/a
Default Re: Command parsing... best module to use?
On 3 Nov, 01:14, Collin D <collin.da...@gmail.com> wrote:
> Thanks for the replies. Pyparsing looks just like what I need.


The cmd module in the standard library is fine for simple command
interpreters. Depending on your needs you might find it does what you
want. Doug Hellmann has covered it in his "Python module of the week"
series of articles.

http://www.doughellmann.com/PyMOTW/cmd/index.html

Simon Hibbs


Simon Hibbs
  Reply With Quote
Old 11-07-2009, 10:27 PM   #6
van Asselt
 
Posts: n/a
Default Re: Command parsing... best module to use?
Hello Colin,

I have been using 'cmdloop.py' from Crutcher Dunnavant in a few programs....
See http://py-cmdloop.googlecode.com/svn/trunk/cmdloop.py

Regards,
Henk

---------------------

"Collin D" <> wrote in message
news:94dbc92b-0682-4995-b358-...
> Hey everyone.
>
> I am writing a game in python, and it includes a text console somewhat
> like the one in WoW and Runescape. I want to be able to include "/"
> commands, like IRC, and was wondering what the best module would be to
> parse these.
>
> Thanks a lot,
> Collin D





van Asselt
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
type of RAM to add which is economical s Computer Support 1 10-15-2009 03:52 AM
Dimm issue? Diana BB Computer Information 45 03-08-2008 09:28 PM
Minidumps available ! Skybuck Flying Windows 64bit 21 10-09-2007 09:23 PM
Kompass Europe on Disk, EKOD CD, 1 CD, Kompass International on Disc, IKOD, 1 DVD, other 2006/September/24 new programs T.E.L. Computer Support 0 09-24-2006 12:35 PM
Guide: Character LCD Module RObErT_RaTh Case Modding 2 09-01-2005 06:04 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46