--- deliantra/server/ext/NPC_Dialogue.pm 2006/12/15 19:29:18 1.1 +++ deliantra/server/ext/NPC_Dialogue.pm 2007/01/04 15:20:11 1.2 @@ -166,10 +166,20 @@ @ifflag kings_quest Hi, I was told you want to do the kings quest? -=item @trigger connected-id +=item @trigger connected-id [state] -Trigger all objects with the given connected-id. The trigger is stateful -and retains state per connected-id. +Trigger all objects with the given connected-id. + +When the state argument is omitted the trigger is stateful and retains an +internal state per connected-id. There is a limitation to the use of this: The +state won't be changed when the connection is triggered by other triggers. So +be careful when triggering the connection from other objects. + +When a state argument is given it should be either 0 or 1. 1 will 'push' the connection +and 0 will 'release' the connection. This is useful for example when you want to +let a npc control a door. + +Trigger all objects with the given connected-id by 'releasing' the connection. =item @addtopic topic @@ -253,8 +263,15 @@ or next topic; } elsif ($cmd eq "trigger") { - my $rvalue = \$self->{npc}{dialog_trigger}{$args*1}; - $self->{npc}->map->trigger ($args, $$rvalue = !$$rvalue); + my ($con, $state) = split /\s+/, $args, 2; + $con = $con * 1; + + if (defined $state) { + $self->{npc}->map->trigger ($args, $state); + } else { + my $rvalue = \$self->{npc}{dialog_trigger}{$con}; + $self->{npc}->map->trigger ($con, $$rvalue = !$$rvalue); + } } elsif ($cmd eq "addtopic") { push @kw, split /\|/, $args;