# Portable source form of MOO database

Kipp the Kidd (mcmudge@mailbox.syr.edu)
Thu, 30 Nov 1995 04:14:20 PST

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

    > I'm trying to avoid the use of object numbers, which are assigned
    > unpredictably by the server.  If a objnamed function were possible then
    > maybe

    This is a very hard thing to do.  I suggest poking around
    'me:my_match_object'

    >     @go objnamed("Train Station Steps")
    >
    >***Kipp> You're mixing the code parser with
    >***Kipp> the command parser (perhaps you can explain this better, Pavel)
    >***Kipp> To find out object numbers of objects you've forgotten, type
    >***Kipp> '@audit [<player>]'
    >
    > One of the questions I was trying to ask is `how do I create user
    > defined functions?  Is it even possible?'  I can't seem to find it in
    > the docs anywhere.

    Where did you even hear that you could?  They're called 'verbs'.

    >   Kipp> Okay, a brief summary that should make this easier...  Commands
    >   Kipp> go: <verb>[[ <dobj>][ <prep>[ <iobj>]]] CODE does just about
    >   Kipp> everything else..  (Keep in mind that <function>(<args>) and
    >   Kipp> <OBJ>:<VERB>(<args>) are in code, not commands.)
    >
    > I just looked to see if there is anything called code or @code (in the
    > LambdaCore DB)-- nope.  Assume I am a rank newbie, how can I define a
    > function?

    Nononono, I mean, CODE as in the stuff you put in when you type '@program...'

    <verb>[[ <dobj>][ <prep>[ <iobj>]]]
    Nowhere in this expression does it mention any builtin functions.  They
    may only be called from within CODE, not commands.  I think you're
    getting confused with unix shells.

    There is, though, a verb that is called every time the server wants to
    match an object; <player>:my_match_object(<objname>);
    The verb normally calls :match and then $string_utils:match_object.

    With the following code, you can type the names of objects you own, even
    if you aren't near the objects.
    You should write something like this:

    me:my_match_object()
    x=pass(@args);
    if(!valid(x))
      what=args[1];
      for y in (this.owned_objects)
        (seconds_left<2 || ticks_left() < 50) && suspend(0);
        if(index(y.name,what)==1)
          return y;
        endif
      endfor
    endif
    return x;
    .