… | |
… | |
182 | See C<@ifstate> for an example. |
182 | See C<@ifstate> for an example. |
183 | |
183 | |
184 | =item @ifstate state value |
184 | =item @ifstate state value |
185 | |
185 | |
186 | Requires that the named C<state> has the given C<value>, otherwise this |
186 | Requires that the named C<state> has the given C<value>, otherwise this |
187 | topic is skipped. For more complex comparisons, see C<@cond> with |
187 | topic is skipped. For more complex comparisons, see C<@cond> with |
188 | C<$state>. Example: |
188 | C<$state>. Example: |
189 | |
189 | |
190 | @match quest |
190 | @match quest |
191 | @setstate question quest |
191 | @setstate question quest |
192 | Do you really want to help find the magic amulet of Beeblebrox? |
192 | Do you really want to help find the magic amulet of Beeblebrox? |
… | |
… | |
341 | } elsif ($cmd eq "msg") { |
341 | } elsif ($cmd eq "msg") { |
342 | push @replies, [$self->{npc}, (scalar cf::safe_eval $args, %vars)]; |
342 | push @replies, [$self->{npc}, (scalar cf::safe_eval $args, %vars)]; |
343 | |
343 | |
344 | } elsif ($cmd eq "setflag") { |
344 | } elsif ($cmd eq "setflag") { |
345 | my ($name, $value) = split /\s+/, $args, 2; |
345 | my ($name, $value) = split /\s+/, $args, 2; |
346 | $value ? $flag->{$name} = $value |
346 | defined $value ? $flag->{$name} = $value |
347 | : delete $flag->{$name}; |
347 | : delete $flag->{$name}; |
348 | |
348 | |
349 | } elsif ($cmd eq "setstate") { |
349 | } elsif ($cmd eq "setstate") { |
350 | my ($name, $value) = split /\s+/, $args, 2; |
350 | my ($name, $value) = split /\s+/, $args, 2; |
351 | $value ? $state->{$name} = $value |
351 | defined $value ? $state->{$name} = $value |
352 | : delete $state->{$name}; |
352 | : delete $state->{$name}; |
353 | |
353 | |
354 | } elsif ($cmd eq "ifflag") { |
354 | } elsif ($cmd eq "ifflag") { |
355 | my ($name, $value) = split /\s+/, $args, 2; |
355 | my ($name, $value) = split /\s+/, $args, 2; |
356 | defined $value ? $flag->{$name} eq $value |
356 | defined $value ? $flag->{$name} eq $value |
357 | : $flag->{$name} |
357 | : $flag->{$name} |
358 | or next topic; |
358 | or next topic; |
359 | |
359 | |
360 | } elsif ($cmd eq "ifstate") { |
360 | } elsif ($cmd eq "ifstate") { |
361 | my ($name, $value) = split /\s+/, $args, 2; |
361 | my ($name, $value) = split /\s+/, $args, 2; |
362 | $state->{$name} eq $value |
362 | defined $value ? $state->{$name} eq $value |
|
|
363 | : $state->{$name} |
363 | or next topic; |
364 | or next topic; |
364 | |
365 | |
365 | } elsif ($cmd eq "trigger") { |
366 | } elsif ($cmd eq "trigger") { |
366 | my ($con, $state) = split /\s+/, $args, 2; |
367 | my ($con, $state) = split /\s+/, $args, 2; |
367 | |
368 | |