1998Q4/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: MUD verb handling (Was: DevMUD &#45; thoughts.1) -->
<!--X-From-R13: Xba Zrbaneq <wyrbaneqNqvipbz.fyvzl.pbz> -->
<!--X-Date: Mon, 26 Oct 1998 22:57:02 &#45;0800 -->
<!--X-Message-Id: 19981026225136.A27334#divcom,slimy.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199810250458.WAA02465@ami&#45;cg.GraySage.Edmonton.AB.CA -->
<!--X-Reference: Pine.LNX.3.96.981025123253.3986C&#45;100000@localhost -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:jleonard#divcom,slimy.com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00542.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00544.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00487.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00549.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00543">Author</A>
&nbsp;|&nbsp;<A HREF="#00543">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00543">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: [MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</LI>
<LI><em>From</em>: Jon Leonard &lt;<A HREF="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</A>&gt;</LI>
<LI><em>Date</em>: Mon, 26 Oct 1998 22:51:36 -0800</LI>
<LI><em>Cc</em>: Jon Leonard &lt;<A HREF="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</A>&gt;</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On Sun, Oct 25, 1998 at 12:54:34PM +0100, The Arrow wrote:
&gt; On Sat, 24 Oct 1998, Chris Gray wrote:

[stuff about parsing, like LPC's individual objects parsing user commands,
and his (Chris Gray's) grammar system]

&gt; Hmm, reminds me of the system I have thought of for my mud.  However, I
&gt; haven't got anything else than some random thoughts and a yacc grammar for
&gt; my mud-language (based on a mix of C and the IF languages Hugo and Inform)
&gt; for the definition of the verbs.  Verb handlers exists either as functions
&gt; in the mud language, or not at all (a "Huh?!?" type message gets written),
&gt; and all mud-objects may have one or more (or none) after and before handlers
&gt; wich gets called after and before the verb default function.  The after and
&gt; before handlers can return false to stop the verb parser from searching for
&gt; more handlers and not execute the default verb function.
&gt; For example, assume Bubba the human tries to pick up a rock, the rock object
&gt; have a a before handler for the OnGet verb that checks the strength of the
&gt; actor and prints "The rock is to heavy for you." message and returns false
&gt; if the actors strength is to small, making the rock ungetable for Bubba.

I implemented something like this back when I ran an LPmud.

In the scheme I used, verb handlers had a string and a priority.  When
a player typed a command, the handlers were run through in priority order
until one returned success.  Handlers that failed also had the option of
setting the error message, so that if no handler matched, an error message
more meaningful than the default "What?" could be displayed.

For example, if there were two rocks in a room, one of which was just
scenery, the scenery rock would define a get function, but it's only
behaviour was to fail and set an error message saying that it was too
heavy to pick up.  The other rock would have normal get behavior.

That way, "get rock" the first time would pick up the movable rock even
if it got checked second, and subsequent attempts would print the
appropriate error message.

This worked reasonably well for commands that succeeded, since it ran
down the list of functions in priority order, and usually picked the most
sensible result if more than one could succeed.  If there were multiple
failure messages (and no successes), then it would print the error message
for the least likely one, which wasn't always so sensible.

I eventually concluded that the proper way to do things was not to have
verb handlers defined by objects at all, because there isn't a good way
to find the most useful error message to print if a given command has
several interpretations, none of which work.   I favor systems where each
potential action (verb in this context) has a handler, and it then queries
objects to see what's the best way to proceed.  Localizing the error
handling makes it easier to do a good job with it.  (The side effect of
avoiding guess the verb games was a bigger motivation.)

I think that a mud configuration using object-defined verbs should get
implemented in DevMUD, but my ideal remains the system where the parser
(whichever one is appropriate for the natural language the user typed)
translates into an internal command language, and is then executed.  The 
internal language would consist of parse trees of verbs, objects and so
on, and would exist in order to allow uniform responses to commands
across the whole MUD.

Jon Leonard


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00549" HREF="msg00549.html">[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</A></strong>
<ul compact><li><em>From:</em> Niklas Elmqvist &lt;d97elm#dtek,chalmers.se&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00477" HREF="msg00477.html">[MUD-Dev] DevMUD - thoughts.1</A></STRONG>
<UL><LI><EM>From:</EM> Chris Gray &lt;cg#ami-cg,GraySage.Edmonton.AB.CA&gt;</LI></UL></LI>
<LI><STRONG><A NAME="00482" HREF="msg00482.html">[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</A></STRONG>
<UL><LI><EM>From:</EM> The Arrow &lt;arrow#trelleborg,mail.telia.com&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00542.html">[MUD-Dev] Re: DevMUD module configuration</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00544.html">[MUD-Dev] Re: Why did it take years?</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00487.html">[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00549.html">[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00543"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00543"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><strong><A NAME="00477" HREF="msg00477.html">[MUD-Dev] DevMUD - thoughts.1</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 25 Oct 1998, 05:04 GMT
<UL>
<LI><strong><A NAME="00481" HREF="msg00481.html">[MUD-Dev] Re: DevMUD - thoughts.1</A></strong>, 
Niklas Elmqvist <a href="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</a>, Sun 25 Oct 1998, 09:39 GMT
</LI>
<LI><strong><A NAME="00482" HREF="msg00482.html">[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</A></strong>, 
The Arrow <a href="mailto:arrow#trelleborg,mail.telia.com">arrow#trelleborg,mail.telia.com</a>, Sun 25 Oct 1998, 11:57 GMT
<UL>
<LI><strong><A NAME="00487" HREF="msg00487.html">[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</A></strong>, 
Adam J. Thornton <a href="mailto:adam#phoenix,Princeton.EDU">adam#phoenix,Princeton.EDU</a>, Sun 25 Oct 1998, 15:11 GMT
</LI>
<LI><strong><A NAME="00543" HREF="msg00543.html">[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</A></strong>, 
Jon Leonard <a href="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</a>, Tue 27 Oct 1998, 06:57 GMT
<UL>
<LI><strong><A NAME="00549" HREF="msg00549.html">[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)</A></strong>, 
Niklas Elmqvist <a href="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</a>, Tue 27 Oct 1998, 16:32 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
<LI><strong><A NAME="00483" HREF="msg00483.html">[MUD-Dev] Re: DevMUD - thoughts.1</A></strong>, 
James Wilson <a href="mailto:jwilson#rochester,rr.com">jwilson#rochester,rr.com</a>, Sun 25 Oct 1998, 13:47 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00475" HREF="msg00475.html">[MUD-Dev] Re: I wanna do it OO</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 25 Oct 1998, 03:53 GMT
<LI><strong><A NAME="00472" HREF="msg00472.html">[MUD-Dev] Re: DevMUD Event Language</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 25 Oct 1998, 02:37 GMT
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>