MOO-cows Mailing List Archive

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

Re: commands like " and ;



>> How would I make a verb act like the " alias for say and the ;
>> alias for eval?  There are two things I have to figure out about this
>> problem:
>> 1. How I would add a verb to act that way no matter where you were,
>> like page, ie a global verb
>> 2. How do I get the verb to take what is adjacent to the command as
>> the args? (this is the hard part) I have been trying to get stuff so
>> you can have your args not seperated by a space but this doesn't seem
>> to work.

> This is a pretty simple thing that is probably covered in the
> programmer's manual.  I'll answer it, but next time, RTFM.  (F
> stands for 'Friendly') :-)

Mighty cocky for someone giving an incorrect answer.

The `:' and `"' and `;' characters are treated specially by the server (not
the database, as implied by the incorrect answer I'll deal with below).
Specifically, the following translations are made:
  `:' => `emote '
  `"' => `say '
  `;' => `eval '
and then the server parses the command normally, seeking (and usually, in
the common Cores, finding) appropriate `emote' or `say' or `eval' commands.

In order to hack together new commands and have them UNIVERSALLY available,
you'd need to find that appropriate section of the server (and here I regret
I can't help you) and clone the code to add the command you want.

However...

> 1) Stick it on $player.

(As an aside, $player isn't covered in the programmer's manual at all.
$player, so
far as the Programmer's Manual is concerned, is #0.player.  It acquires meaning
in the context of LambdaCore or its derivatives, which are not covered in
the manual.)

This method will work for nearly all purposes.

> 2) What is adjascent to the command is considered to be PART of the
> command.  Hence, if you use what I use for page: `` 'player Heya '', then
> the verb == "'player".  On the first line of the verb, simply do
> something like args = {verb[2..length(verb)], @args}.

Generally (I'll use eval here as an example), you'd add a verb like:
  ;*
with arguments 'any any any' (although this, too, isn't required; it'd make
things more interesting to do it otherwise) and appropriate security and bits.

Before dealing with the arguments, you'd need to grab the part attached to
the verb, so you'd use a code segment like:
  if (length(verb) > 1)
    args = {verb[2..length(verb)], @args};
    argstr = args[1] + " " + argstr;
  endif;

Sorry for being so pedantic, but there are very few things the server does and
this is one of them.  The ; and " and : pre-parsing are a server functionality,
not a database one, even though their behavior may be emulated in-DB.

Seth / Blackbriar
----------------------------------------------------------------------
Seth I. Rich
Woo, woo!  OpalMOO's back!       There is nothing more precious than
Rabbits on walls, no problem.    a tear of true repentance.




Home | Subject Index | Thread Index