![]() |
|
|
|||||||
![]() |
Python - Command parsing... best module to use? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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 |
|
|
|
#3 |
|
Posts: n/a
|
"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 |
|
|
|
#4 |
|
Posts: n/a
|
Thanks for the replies. Pyparsing looks just like what I need.
Collin D |
|
|
|
#5 |
|
Posts: n/a
|
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 |
|
|
|
#6 |
|
Posts: n/a
|
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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |