… | |
… | |
140 | |
140 | |
141 | Example: check if the context object I<is> a spell, or I<contains> a spell. |
141 | Example: check if the context object I<is> a spell, or I<contains> a spell. |
142 | |
142 | |
143 | type=SPELL also in inv |
143 | type=SPELL also in inv |
144 | |
144 | |
145 | =item deep in ... |
145 | =item also deep in ... |
146 | |
146 | |
147 | Repeats the operation as many times as possible. This can be used to |
147 | Repeats the operation as many times as possible. This can be used to |
148 | recursively look into objects. |
148 | recursively look into objects. |
149 | |
149 | |
150 | =item also deep in ... |
150 | So for example, C<also deep in inv> means to take the inventory of all |
|
|
151 | objects, taking their inventories, and so on, and adding all these objects |
|
|
152 | to the context set. |
151 | |
153 | |
152 | C<also> and C<deep> can be combined. |
154 | Similarly, C<also deep in env> means to take the environment object, their |
|
|
155 | environemnt object and so on. |
153 | |
156 | |
154 | Example: check if there are any unpaid items in an inventory, |
157 | Example: check if there are any unpaid items in an inventory, |
155 | or in the inventories of the inventory objects, and so on. |
158 | or in the inventories of the inventory objects, and so on. |
156 | |
159 | |
157 | unpaid also deep in inv |
160 | unpaid also deep in inv |
… | |
… | |
569 | $expand = "map \$_->inv,"; |
572 | $expand = "map \$_->inv,"; |
570 | } elsif ($1 eq "env") { |
573 | } elsif ($1 eq "env") { |
571 | $expand = "map \$_->env // (),"; |
574 | $expand = "map \$_->env // (),"; |
572 | } elsif ($1 eq "arch") { |
575 | } elsif ($1 eq "arch") { |
573 | $expand = "map \$_->arch,"; |
576 | $expand = "map \$_->arch,"; |
|
|
577 | $deep = 0; # infinite loop otherwise |
574 | } elsif ($1 eq "map") { |
578 | } elsif ($1 eq "map") { |
575 | $expand = "map \$_->map->at (\$_->x, \$_->y),"; |
579 | $expand = "map \$_->map->at (\$_->x, \$_->y),"; |
|
|
580 | $deep = 0; # infinite loop otherwise |
576 | } |
581 | } |
577 | } else { |
582 | } else { |
578 | $expand = "map \$_->inv, grep { " . condition . " }"; |
583 | $expand = "map \$_->inv, grep { " . condition . " }"; |
579 | } |
584 | } |
580 | |
585 | |
… | |
… | |
678 | &{ |
683 | &{ |
679 | $CACHE{"$all$match"} ||= compile $match, $all |
684 | $CACHE{"$all$match"} ||= compile $match, $all |
680 | } |
685 | } |
681 | } |
686 | } |
682 | |
687 | |
|
|
688 | our $CACHE_CLEARER = AE::timer 3600, 3600, sub { |
|
|
689 | %CACHE = (); |
|
|
690 | }; |
|
|
691 | |
683 | #d# $::schmorp=cf::player::find "schmorp"& |
692 | #d# $::schmorp=cf::player::find "schmorp"& |
684 | #d# cf::match::match '', $::schmorp->ob |
693 | #d# cf::match::match '', $::schmorp->ob |
685 | |
694 | |
686 | |
695 | |
687 | =back |
696 | =back |