--- deliantra/server/lib/cf/match.pm 2009/10/12 04:02:17 1.14
+++ deliantra/server/lib/cf/match.pm 2010/10/12 20:15:48 1.33
@@ -1,3 +1,25 @@
+#
+# This file is part of Deliantra, the Roguelike Realtime MMORPG.
+#
+# Copyright (©) 2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
+#
+# Deliantra is free software: you can redistribute it and/or modify it under
+# the terms of the Affero GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the Affero GNU General Public License
+# and the GNU General Public License along with this program. If not, see
+# .
+#
+# The authors can be reached via e-mail to
+#
+
=head1 NAME
cf::match - object matching language
@@ -68,6 +90,13 @@
Once the final set of context objects has been established, each object
is matched against the C.
+It is possible to chain modifiers from right-to-left, so this example
+would start with the originator, take it's inventory, find all inventory
+items which are potions, looks into their inventory, and then finds all
+spells.
+
+ type=SPELL in type=POTION in inv of originator
+
Sometimes the server is only interested in knowing whether I
matches, and sometimes the server is interested in I objects that
match.
@@ -79,8 +108,19 @@
=item and, or, not, ()
Conditions can be combined with C or C to build larger
-expressions. C negates the expression, and parentheses can be used to
-group conditions.
+expressions. C negates the condition, and parentheses can be used to
+override operator precedence and execute submatches.
+
+Not that C only negates a condition and not the whole match
+expressions, thus
+
+ not applied in inv
+
+is true if there is I non-applied object in the inventory. To negate
+a whole match, you have to use a sub-match: To check whether there is
+I applied object in someones inventory, write this:
+
+ not (applied in inv)
Example: match applied weapons.
@@ -90,6 +130,10 @@
type=HORN or type=ROD
+Example: see if the originator is a player.
+
+ type=PLAYER of originator
+
=item in ...
The in operator takes the context set and modifies it in various ways. As
@@ -120,12 +164,16 @@
Replaces all objects by the objects that are on the same mapspace as them.
-=item in
+=item in head
+
+Replaces all objects by their head objects.
+
+=item in
Finds all context objects matching the condition, and then puts their
inventories into the context set.
-Note that C is simply a special case of an C<< in >> that
+Note that C is simply a special case of an C<< in >> that
matches any object.
Example: find all spells inside potions inside the inventory of the context
@@ -142,14 +190,17 @@
type=SPELL also in inv
-=item deep in ...
+=item also deep in ...
Repeats the operation as many times as possible. This can be used to
recursively look into objects.
-=item also deep in ...
+So for example, C means to take the inventory of all
+objects, taking their inventories, and so on, and adding all these objects
+to the context set.
-C and C can be combined.
+Similarly, C means to take the environment object, their
+environemnt object and so on.
Example: check if there are any unpaid items in an inventory,
or in the inventories of the inventory objects, and so on.
@@ -180,6 +231,11 @@
but submatches start at the current object, and in this case C
can be used to start at the original object once more.
+=item of self
+
+Starts with the object initiating/asking for the match - this is basically
+always the object that the match expression is attached to.
+
=item of source
Starts with the I