I want to suggest a new type of command argument parser for CircleMUD. Instead of passing full argument to ACMD and then converting it to few strings and processing it with get_char_vis, get_obj_vis etc we can parse all arguments before calling ACMD, and pass only pointers to prepared linked lists to it. This way, most ACMD functions will become a lot smaller and easier to understand and even some parsing bugs will disappear. (for example: do_stat... currently if you have a sword in your hand and two swords in inventory, you _can't_ access first sword in inventory). Also, this system gives few additional features to players, for example: put 10 coins purse - will put 10 coins to purse. I already implemented this system in RMUD (aka 3MoonsWorld) and it works great! Compare this do_give (arguments given by external parser) with original one: ACMD(do_give) { struct obj_data *obj, *next_obj; if (!aobj1) send_to_char("Give what to whom?\r\n", ch); else if (!ach2) send_to_char("Give it to whom?\r\n", ch); else { for (obj = aobj1; obj; obj = next_obj) { next_obj = obj->ll1_next; if (GET_OBJ_TYPE(obj) == ITEM_MONEY) perform_give_gold(ch, ach2, obj); else perform_give(ch, ach2, obj); } } } aobj1, aobj2 - pointers to linked lists of objects (argument 1 & argument 2) ach1, ach2 - pointers to linked lists of chars Also, there is arg1 and arg2 - pointers to plain text arguments and argument - unparsed remainings of string. It took me only 3 days to implement this system. Alas, I can't make a patch since RMUD is heavily modified (more than 200 major code changes), but if Jeremy is interested in converting Circle to external parsing of arguments, I will provide all required information. Andrey (andrey@alex-ua.com) aka Zmey // RMUD +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST