MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Server Modification Suggestion



Colin F. McCormick wrote:
>
>
>After browsing the server code, one can see that #0:do_command() (if it
>exists) is actually called _before_ the command line verb. 
>
>I'd really like a verb (say #0:do_after_command()) that would be called
>_after_ the command line verb.  This should be easy; just put in another
>run_server_task() call in do_command_task() in tasks.c, after the command
>is actually executed. 
>
>i.e.:
>
>>From tasks.c:
>
>... [from do_command_task()] ...
>
>	    if (run_server_task(pi.player, SYSTEM_OBJECT, "do_command", args,
>				command, &result) != OUTCOME_DONE
>		|| is_true(result)) {
>	
>==> So we call #0:do_command() first, and unless it dies or returns a 
>    true value ...
>
>	/* Do nothing more; we assume :do_command handled it. */
>	    } else if (p) {
>		current_task_id = new_task_id();
>		do_input_task(p, &pi, 0);
>
>==> ... we go ahead and do the task ...
>
>	    } else
>		notify(pi.player, "I couldn't understand that.");
>
>==> ... or cry ignorance.
>
>...
>
>==> And here, I would like to put in a second 
>run_server_task(..."do_after_command"...). 
>

There is a problem with this. If we suspend() or read() in command, the
command task suspends, and :do_after_command is executed, *not* after 
the command, but immediately after suspend()..
I've worked built-in command line prompt support in my MOO, so gained
some experience with this type of problem. In fact, the problem above is
that my first version of :prompt system owns. For logging, it may be no
problem, but for prompt, it may be serious... 
(after patching around 200 lines of server code, I can handle suspend(), 
read(), and fork(), and I'm happy with it! ^_^ but when I decided to 
add MPL patch, patch doesn't patch codes 'cause I patched codes so
extensively, and I have no choice but to patch codes by hand....) 

>
>In my case, this would allow me to be able to spit out an list of verbs
>available in the player's location, _after_ the output of an issued
>command.  Anyone see any problems with this?  Pavel, any chance of getting
>this into the 1.7.9 release? 
>
>Colin
>
>############################################################################
>#Colin F. McCormick	      Freelance Programmer -- MOO & Unix specialist#
>#colin@tripod.tripod.com	http://student_97ffa.williams.edu/~cmccormi#
># GS/Lit/M d? p- c++(---) l+(++) u++ e++ m++(-) s+/ n+ h* f* !g @w++ t+ y? #
>############################################################################
>
>

- Ahn




Home | Subject Index | Thread Index