(For more serious games, you might want to use PUB instead.)
BUS includes a decent parser, which can handle compound commands such as "get the rock and put it in the sack then drop the sack and garbage". (Not that you'd ever type a command this long, but you could!)
BUS is based on object-oriented programming techniques; classes of objects in the game correspond to Python classes. BUS includes the following object classes:
Please check out the code -- it's rather short:
To try it out, enter Python and type the following commands:
>>>import busparse # loads the parser module >>>parser.test() # test it out -- type some commandsIn testing the parser, you're limited to a small set of built-in words -- please consult the code to see what these are.
The game objects and parser together are demonstrated as follows:
>>>import buscore # load the core game classes >>>thing.test() # try it out >lookCommands currently recognized by BUS include look, get, drop, put, and inv. You can also boss Bert around, e.g. Bert, go north.
The parser is case-sensitive. To exit either test function above, hit Control-C and press Return.
[ Back to Joe's Python Scripts for Newbies ]