[586] in Coldmud discussion meeting

root meeting help first previous next last

Addition to match_template()

daemon@ATHENA.MIT.EDU (Wed Nov 16 19:42:40 1994 )

From: brandon@avon.declab.usu.edu
To: coldstuff@MIT.EDU
Date: Wed, 16 Nov 94 17:39:48 -0700

This just hit me, dunno how easy it would be to implement (or if it would be
worth it), but it would be rather nice to have a [] ability in a template
for match_template(), which would basically say "this can exist, but it does
not have to, and if it doesn't, put it in (which is the hard part)", such as:

    "@descend?ants [from] * [to|down?to] *"

Where matches could be:

    "@descend $object $object"
    => ["@descend", "from", "$object", "to", "$object"]

    "@descendants from $object $object"
    => ["@descendants", "from", "$object", "to", "$object"]

    "@descendants from $object downto $object"
    => ["@descendants", "from", "$object", "downto", "$object"]

Comments?  Implementation ideas?  The inserting of default values was because
otherwise it could cause problems with defining the method... (or perhaps, an
even better addition would be to have match_template return args where it only
splits apart the sections that were matched:

    match_template("c on * to *", "c on x to y")
    => ["c on", "x", "to", "y"]

Actually, I would like to see this last even without the above...(splitting the
command is nice, but rarely useful, if you want the first word just explode

-Brandon (Lynx)-