Code: Select all
player /^(?![.*]$)/
EDIT: altered original topic title from "player not state and exceptions trough regexp" to "Condition to trigger macro when there are no players nearby"
Moderator: Moderators
Code: Select all
player /^(?![.*]$)/
Code: Select all
Index: Macro/Automacro.pm
===================================================================
--- Macro/Automacro.pm (revision 8296)
+++ Macro/Automacro.pm (working copy)
@@ -302,6 +302,8 @@
sub checkPerson {
my ($who, $dist) = $_[0] =~ /^(["\/].*?["\/]\w*)\s*,?\s*(.*)/;
+ return !scalar @{$playersList->getItems()} if $who = 'none';
+
foreach my $player (@{$playersList->getItems()}) {
next unless match($player->name, $who);
if ($dist > 0) {
I'm sorry but I can't understand this. How can I then use this code for an automacro? Any examples?EternalHarvest wrote:It's probably easy to implement such condition, for example with syntax "player none", with something like this:Code: Select all
Index: Macro/Automacro.pm =================================================================== --- Macro/Automacro.pm (revision 8296) +++ Macro/Automacro.pm (working copy) @@ -302,6 +302,8 @@ sub checkPerson { my ($who, $dist) = $_[0] =~ /^(["\/].*?["\/]\w*)\s*,?\s*(.*)/; + return !scalar @{$playersList->getItems()} if $who = 'none'; + foreach my $player (@{$playersList->getItems()}) { next unless match($player->name, $who); if ($dist > 0) {