On Sat, 20 Sep 1997, Ron Hensley wrote: > Ive noticed that some speicals code, trash the argument list passed into > them. Like if you assign a mob to be a shop keeper and also try to > MOB_ASSIGN it, youll see that the shop code obliterates the argument list > before your special gets called. That's not a problem with stock spec_procs. I think what's happening is your specials don't have enough checks to determine whether the special should act on the arguments before you call the argument functions. Any "return 0" in a special that is called after a destructive argument parse function is asking for trouble. What I've been doing as I've added the two_args function to my code is to create a local copy of the argument list and act on that instead of argument. I'm working with a different sort of interpreter setup that has a linked list of command parsers. If you're working in olc, your input is checked by an olc parser, and if that parser doesn't see anything to act on, the next parser in the player's list is called, until all parsers have been checked and either one of them takes control or you end up with an unknown command. Under normal conditions, the sequence would be a spec_proc check, then a wizcommand parser check (for imms only), then a basic command interpreter (replacement for command_interpreter), then the social interpreter. Other parsers such as the olc parsers, edit parser (writing messages), and player creation parser are added and removed as necessary. > If all specials left the original arguments unmolested, we could use a > linked list of function pointers instead of just one, and thuse put as > many sets of code per mob/roon/etc as we wanted... They really should already, but nondestructive parsing is as easy as: char local_arg[MAX_INPUT_LENGTH]; strcpy(local_arg, argument); [change all instances of argument to local_arg in special] Sam +------------------------------------------------------------+ | 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/08/00 PST