Why not have the best of both worlds?
Someone should write a better error message though
Code: Select all
sub cmdMove {
my (undef, $args) = @_;
my ($arg1, $arg2, $arg3, $arg4) = $args =~ /^(\D+?)?\s*(\d+)?\s*(\d+)?\s*(\S+)?$/;
my $map = $arg1 ? $arg1 : $arg4;
if ( ($arg1 && $arg4) || ($arg2 eq "" && !$map) || ($map && $arg2 ne "" && $arg3 eq "") ) {
error T("Syntax Error in function 'move' (Move Player)\n" .
"Usage: move <x> <y> &| <map> or <map> &| <x> <y>\n");
} elsif (!$map && $arg3 eq "") {
if ($portalsID[$arg2]) {
message TF("Move into portal number %s (%s,%s)\n",
$arg2, $portals{$portalsID[$arg2]}{'pos'}{'x'}, $portals{$portalsID[$arg2]}{'pos'}{'y'});
main::ai_route($field{name}, $portals{$portalsID[$arg2]}{'pos'}{'x'}, $portals{$portalsID[$arg2]}{'pos'}{'y'}, attackOnRoute => 1, noSitAuto => 1);
} else {
error T("No portals exist.\n");
}
} elsif ($map eq "stop") {
AI::clear(qw/move route mapRoute/);
message T("Stopped all movement\n"), "success";
} else {
AI::clear(qw/move route mapRoute/);
$map = $field{name} if ($map eq "");
if ($maps_lut{"${map}.rsw"}) {
my ($x, $y);
if ($arg2 ne "" && $arg3 ne "") {
message TF("Calculating route to: %s(%s): %s, %s\n",
$maps_lut{$map.'.rsw'}, $map, $arg2, $arg3), "route";
$x = $arg2;
$y = $arg3;
} else {
message TF("Calculating route to: %s(%s)\n",
$maps_lut{$map.'.rsw'}, $map), "route";
}
main::ai_route($map, $x, $y,
attackOnRoute => 1,
noSitAuto => 1,
notifyUponArrival => 1);
} else {
error TF("Map %s does not exist\n", $map);
}
}
}