Phantasmal MUD Lib for DGD
|
Phantasmal Site > DGD > Writing a Library > GurbaLib Implementing From GurbaLibFrom DGD Mailing List Fri Aug 27 23:28:02 2004 From: DGD Mailing List (David Jackson) Date: Fri Aug 27 23:28:02 2004 Subject: [DGD] GurbaLib I'm glad you chimed in. I started trying to convert the H7 lib over, not realizing how involved the port would be. I've since returned to GurbaLib. If I'm going to have to do most of the work on the lib, I might as well work with something that already works with DGD. Which leads me to my next announcement... I have recently been in discussions with Erlend Simonsen, the original developer for GurbaLib, and after some lengthy talks, we have worked out an arrangement where I am to take over the maintenance and continued development of the GurbaLib mudlib. No, I do not claim to be a GurbaLib expert, so I can't really field technical questions just yet, but I am in the process of writing up documentation on it, in the hopes of bringing to focus the tremendous amount of work that Erlend has done on this lib so far. If you aren't aware, GurbaLib supports the following (existing) features; A "verb" system Rooms, Items, Monsters, Doors Channels InterMud3 an FTP Daemon Message Boards Events Combat Guilds Races My first goals are to; Update the command parsing, to be more in line with Lima, or Abermud. Overhaul the room code to include weather effects, and integrate the door code more closely Expand the Item code Streamline the combat code a bit Add several "stock" guilds Add several "stock" races Additionally, the monster code will receive a complete renovation, to incorporate some ideas regarding artificial life that I have (this is in response to Stephen Schmidt's ideas regarding new innovation in mudlibs). And, I intend to add an HTTP daemon, which I had started quite some time ago. Any input will be appreciated. David Jackson From: David Jackson <atari_x@bellsouth.net> Subject: [DGD] Algorithm for Parsing Commands Date: Sat, 04 Sep 2004 02:33:31 -0500 I have been working on the Gurba lib, and I wanted to make the command parser a little more robust, but I need some input. First, a question; for a long time, the paradigm has been to have a basic command parser determine which verb to use, and then call that verb function, which would parse the command further. What is the reasoning behind this? My basic algorith for parsing commands is as such; Our example command is; "Put the green rock into the yellow sack". Assumption: Most commands will follow the form "verb adjective noun preposition adjective noun" or, more likely, the form "verb adjective noun" acceptable input can be "verb noun" or "verb noun preposition noun" Assumption: Articles are treated as whitespace 1) Receive input, and split input into an array of seperate words a) If there is a "then" or "comma" or "and" in the sentence, then split the sentence into two arrays. b) operate on the first array now 2) Determine which words are verbs, by comparing them to a list of suitable verbs (this takes into account synonyms for verbs) a) If there is no suitable verb, produce error output 3) Determine which words are nouns, by checking for the existence of the object in the player's environment (or inventory) a) If no such noun exists, produce error output 4) Determine which words are adjectives, by checking it's companion noun (query_adjective()) in the player's environment a) If no adjective, and more than one noun exists with that name, produce error output 1) Error output should ask, "which noun, the adjective noun1 or the adjective noun2?" (etc.) 5) Check for legal prepositions a) If not legal, produce error output 5) If we have gotten this far, get object pointers for adjective-noun pairs, parsing sentence into verb/adj.noun1/preposition 6) Pass parsed sentence to verb function as a function call parameter. 7) Return to 2 with second sentence, if there was a then. I know that this, so far, is still relatively simple; it can handle "verb adjective noun preposition adjective noun" sentences all day long. I would like to make it more robust, to handle sentences such as; "cast gnusto at spellbook" - gnusto is a noun, but would forever be missed because it doesn't exist in the player's environment "wear red cloak from burlap sack" - Would only work if there was preposition/adjective/noun checking in "wear". "read newspaper by candlelight" - another sentence that would just fail. "check settings on dial" - and another sentence that would just fail. Any thoughts? David Jackson |