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.1 by root, Fri Dec 15 19:29:18 2006 UTC vs.
Revision 1.2 by elmex, Thu Jan 4 15:20:11 2007 UTC

164 164
165 @match hi 165 @match hi
166 @ifflag kings_quest 166 @ifflag kings_quest
167 Hi, I was told you want to do the kings quest? 167 Hi, I was told you want to do the kings quest?
168 168
169=item @trigger connected-id 169=item @trigger connected-id [state]
170 170
171Trigger all objects with the given connected-id. The trigger is stateful 171Trigger all objects with the given connected-id.
172and retains state per connected-id. 172
173When the state argument is omitted the trigger is stateful and retains an
174internal state per connected-id. There is a limitation to the use of this: The
175state won't be changed when the connection is triggered by other triggers. So
176be careful when triggering the connection from other objects.
177
178When a state argument is given it should be either 0 or 1. 1 will 'push' the connection
179and 0 will 'release' the connection. This is useful for example when you want to
180let a npc control a door.
181
182Trigger all objects with the given connected-id by 'releasing' the connection.
173 183
174=item @addtopic topic 184=item @addtopic topic
175 185
176Adds the given topic names (separated by C<|>) to the list of topics 186Adds the given topic names (separated by C<|>) to the list of topics
177returned. 187returned.
251 my ($name, $value) = split /\s+/, $args, 2; 261 my ($name, $value) = split /\s+/, $args, 2;
252 $state->{$name} eq $value 262 $state->{$name} eq $value
253 or next topic; 263 or next topic;
254 264
255 } elsif ($cmd eq "trigger") { 265 } elsif ($cmd eq "trigger") {
266 my ($con, $state) = split /\s+/, $args, 2;
267 $con = $con * 1;
268
269 if (defined $state) {
270 $self->{npc}->map->trigger ($args, $state);
271 } else {
256 my $rvalue = \$self->{npc}{dialog_trigger}{$args*1}; 272 my $rvalue = \$self->{npc}{dialog_trigger}{$con};
257 $self->{npc}->map->trigger ($args, $$rvalue = !$$rvalue); 273 $self->{npc}->map->trigger ($con, $$rvalue = !$$rvalue);
274 }
258 275
259 } elsif ($cmd eq "addtopic") { 276 } elsif ($cmd eq "addtopic") {
260 push @kw, split /\|/, $args; 277 push @kw, split /\|/, $args;
261 $self->{add_topic}->(split /\s*\|\s*/, $args) if $self->{add_topic}; 278 $self->{add_topic}->(split /\s*\|\s*/, $args) if $self->{add_topic};
262 279

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines