# MCP experience story

Andreas Dieberger (andreas.dieberger@lcc.gatech.edu)
Fri, 13 Oct 1995 20:11:59 PDT

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    Howdy.

    I am working on a fancy client for a system called TechMOO, that is based
    on a JHCore. So far I didnt make use of mcp, but when I found out that most
    of the necessary code is already in the JHcore I decided to use it. That is
    not as easy as it sounds at first as there is very little docu on mcp (at
    least I didnt find much). What you can get are the help texts on mcp in the
    db. Only they are not entirely consistent.

    As I see it so far there was a sort of specification that stems from the
    Jupiter and AstroVR systems. Then there is a rewrite that looks a little
    bit different. What came out of the MOO again looked a bit different. Well
    - I kept a short log of what changes I made to TechMOO so it finally
    worked. I thought other people might be interested in that as well - they
    might save a few hours code reading that way...

    First I should admit that TechMOO does no dot-quoting right now. That is a
    request is sent like this:

    #$#edit* 123456 type: text name: "test.text" upload: "@set-note-text #388.text"
    blablabla
    blablabla
    .

    Thats one of my next things to work on I think... Any hints how to best do
    that are very welcome (I probably have to use a modified
    $command_utils:read_lines huh?)

    Anyway - here are my notes:

    MCP changes in TechMOO:

    In $generic_editor there was a deviation from the mcp specs.

    The editor put out a line like this

    #$# edit name: test.text upload: @set-note-text #388.text

    There are five deviations from the specs here:

    1) the blank between #$# and the request name
    2) there is no * after the edit to show that additional text will follow
    3) there is no edit type
    4) There is no authentication key in the request
    5) No quotes around the name and the upload request

    the correct request should be:

    #$#edit* 12345678 type: text name: "test.text" upload: "@set-note-text
    #388.text"

    (12345678 is a dummy authentication key)

    To change that you have to modify one line in

    $generic_editor:invoke_local_editor

    line 23 now is:

    notify(player, tostr("#$#edit* type: ", type, " name: \"", name,
    "\" upload: \"", upload,"\""));

    The edit types are handled correctly by the children of the $generic_editor (in
    :local_edit_info).

    ----

    $player:notify contains a strange if-construct:

    if (line[1..3] == "#$#")
      line = " " + line;
    endif

    This additional blank was very disturbing so I threw that stuff out. I dont
    think that violates the mcp-spec. Actually the #$# should be at the
    beginning of the line I think. Perhaps the only reason for that was to make
    it a little harder for wizzes to send fake mcp commands to a colleague?

    ---

    I had a hard time to find out where the

      #$#mcp version: 1.0

    is generated. If you put it in the wrong places you get either errors, or
    nothing.

    Finally I found even 2 places where it can go:

    In the first case the #$#mcp version message is output *after* the
    description of the
    room where you log in

    @list $player:anyconfunc
    #6:"anyconfunc" this none this
     1:  if (valid(caller_perms()) && caller != this && caller != #0 && caller
    != $login)
     2:    return E_PERM;
     3:  endif
     4:  this:set_authentication_key(0);
     5:  notify(this, "#$#mcp version: 1.0");
     6:  this:("@last-connection")();
     7:  "Copied from generic player (#6):anyconfunc by Ken (#75) Tue Jan 24
    15:27:18 1995 EST";

    And in the next case it is in the right place - before everything else.

    @list $room:confunc
    #3:"confunc" this none this
     1:  if (!(caller in {#0, this}))
     2:    return E_PERM;
     3:  endif
     4:  player:tell("#$#mcp version: 1.0");
     5:  this:look_self(player:brief());
     6:  this:announce(player:inamec(), " ", player:verb_sub("has"), " connected.");

    So - and why did it take me a few hours to find that? Because I am
    **STUPID**. Well the problem was that I output the message using a :notify
    (as it should be) only I didnt realize that notify could not work when it
    was called from confunc (dumb dumb). That is: you have to use a tell in
    this case. Unless there is another way which I have not found...

    ---

    One last thing was to do (so far). When my client logs in it does a

      @edit-option +local

    in reply to the #$#mcp version: 1.0
    So far so good. Only when I log in next using a line-based client, the
    +local is still valid. Therefore this should be reset automatically, I
    thought. Here is what I did:

    In #6:maybe_really_disconnected there is a fork statement that transfers a
    player home after a certain amount of time. There I put in a line that
    resets the edit-option:

     10: fork task (300)
     11:   if ($recycler:valid(this) && (!(this in connected_players())))
     12:     this.disconnect_task = 0;
     13:     this:broadcast_event_really_disconnected();
    _14_     this.edit_options = {};
     15    endif
     16  endfork

    I hope somebody finds that useful - if not, sorry for wasting bandwidth

    Andreas

    -----------------------------------------------------------
                         Andreas Dieberger
    andreas.dieberger@lcc.gatech.edu    dieberger.chi@xerox.com
                Juggler@{TechMOO, JHM, MediaMOO}

     http://www.gatech.edu/lcc/idt/Faculty/andreas_dieberger/
    -----------------------------------------------------------
    "I don't even have an email address. I have reached an age
       where my main purpose is _not_ to receive messages."
                                                -- Umberto Eco
    -----------------------------------------------------------