ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/NPC_Dialogue.pm
(Generate patch)

Comparing deliantra/server/ext/NPC_Dialogue.pm (file contents):
Revision 1.8 by root, Sun Aug 26 04:07:40 2007 UTC vs.
Revision 1.10 by root, Mon Jul 14 23:57:45 2008 UTC

11=cut 11=cut
12 12
13package NPC_Dialogue; 13package NPC_Dialogue;
14 14
15use strict; 15use strict;
16
17sub has_dialogue($) {
18 my ($ob) = @_;
19
20 $ob->msg =~ /^\@match /;
21}
22 16
23sub parse_message($) { 17sub parse_message($) {
24 map [split /\n/, $_, 2], 18 map [split /\n/, $_, 2],
25 grep length, 19 grep length,
26 split /^\@match /m, 20 split /^\@match /m,
125 119
126=item B<matching for an item name and removing the matched item> 120=item B<matching for an item name and removing the matched item>
127 121
128 @match found earhorn 122 @match found earhorn
129 @cond grep $_->slaying =~ /Gramp's walking stick/, $who->inv 123 @cond grep $_->slaying =~ /Gramp's walking stick/, $who->inv
130 @eval my @g = grep { $_->slaying =~ /Gramp's walking stick/ } $who->inv; $g[0]->decrease_ob_nr (1); 124 @eval my @g = grep { $_->slaying =~ /Gramp's walking stick/ } $who->inv; $g[0]->decrease;
131 Thanks for the earhorn! 125 Thanks for the earhorn!
132 126
133This example is a bit more complex. The C<@eval> statement will search 127This example is a bit more complex. The C<@eval> statement will search
134the players inventory for the same term as the C<@cond> and then 128the players inventory for the same term as the C<@cond> and then
135decreases the number of objects used there. 129decreases the number of objects used there.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines