Subject: OUTPUT*FIX

From: Greg Hudson <[email-masked]>
Date: Thu, 3 Dec 1992 06:41:16 -0800

A couple of commands I've noticed conspicuously missing in MOO are
OUTPUTPREFIX and OUTPUTSUFFIX.  A look at the programmer's reference
indicates that they would probably have to be treated in the server
code, which is a bit unfortunate aesthetically, but they are crucial
tools for intelligent clients.

Right now, VT has a number of tools which require the ability to get
the output of a command, a simple task on every social-mud server
except for MOO.  For instance, someone recently asked me what output I
get if I tried to take one of his objects.  Had I bracketing ability
on MOO, I could have simple typed "take Bob^XQ" or entered "/cquote
take Bob" and had sent to the MOO automatically:
	:> take Bob
	:| Sorry.
	:| You cannot pick that up.

Likewise, if I want to know what flags are set on me, I could do
"/filter Flags: * = @show me", similar to how I use /filter on other
kinds of servers.

I've heard tell that OUTPUT*FIX were taken out of the server at some
point, perhaps during the period when robots became unpopular.  I
don't think that's a consideration any more, and as clients get more
sophisticated, it's clear that at least some primitive way of dealing
with typed data streams is in order.

Any thoughts on this?

---

From: Pavel Curtis <[email-masked]>
Date: Thu, 3 Dec 1992 10:18:13 -0800

> Date:	Thu, 3 Dec 1992 06:41:16 -0800
> From:	Greg Hudson <[email-masked]>
> 

A closer look at the programmer's manual shows that they do, in fact, exist
under the names PREFIX and SUFFIX.  They are first mentioned in the following
paragraph from chapter 2, `Command Parsing':

      Having thus broken the string into words, the server next checks
   to see if the first word names any of the three "built-in" commands:
   `.program', `PREFIX', or `SUFFIX'.  The first one of these is only
   available to programmers and the other two are intended for use by
   client programs; all three are described in the final chapter of this
   document, "Server Commands and Database Assumptions".  If the first
   word isn't one of the above, then we get to the usual case: a normal
   MOO command.

The relevant section from the final chapter is the following:

    Command-Output Delimiters
    -------------------------

       Every MOO network connection has associated with it two strings,
    the "output prefix" and the "output suffix".  Just before executing
    a command typed on that connection, the server prints the output
    prefix, if any, to the player.  Similarly, just after finishing the
    command, the output suffix, if any, is printed to the player.
    Initially, these strings are not defined, so no extra printing takes
    place.

       The `PREFIX' and `SUFFIX' commands are used to set and clear
    these strings.  They have the following simple syntax:

	 PREFIX  OUTPUT-PREFIX
	 SUFFIX  OUTPUT-SUFFIX

    That is, all text after the command name and any following spaces is
    used as the new value of the appropriate string.  If there is no
    non-blank text after the command string, then the corresponding
    string is cleared.

       These commands are intended for use by programs connected to the
    MOO, so that they can issue MOO commands and reliably determine the
    beginning and end of the resulting output.  For example, one
    editor-based client program sends this sequence of commands on
    occasion:

	 PREFIX >>MOO-Prefix<<
	 SUFFIX >>MOO-Suffix<<
	 @list OBJECT:VERB without numbers
	 PREFIX
	 SUFFIX

    The effect of which, in a LambdaCore-derived database, is to print
    out the code for the named verb preceded by a line containing only
    `>>MOO-Prefix<<' and followed by a line containing only
    `>>MOO-Suffix<<'.  This enables the editor to reliably extract the
    program text from the MOO output and show it to the user in a
    separate editor window.  There are many other possible uses.

       The built-in function `output_delimiters()' can be used by MOO
    code to find out the output prefix and suffix currently in effect on
    a particular network connection.

Finally, the description of the `output_delimiters()' function mentioned
above appears as follows in section 3.4.4, `Evaluation and Tasks':

     -- Function: list output_delimiters (obj PLAYER)
	 Returns a list of two strings, the current "output prefix" and
	 "output suffix" for PLAYER.  If PLAYER does not have an active
	 network connection, then `E_INVARG' is returned.  If either
	 string is currently undefined, the value `""' is used instead.
	 See the discussion of the `PREFIX' and `SUFFIX' commands in the
	 next chapter for more information about the output prefix and
	 suffix.

You're right, of course; such a feature is quite essential for certain kinds of
intelligent client operations.  They have always been in the server, since
before it was LambdaMOO.

	Pavel/Haakon