Tuesday, 23 July 2013

macro otomatis detect hide

ini macro request, gimana caranya untuk bikin bot dengan trigger hiding. sebetulnya sama aja kayak yang pake pubm cuma diubah dikit aja. berikut macronya.
macro ini bekerja seperti ini :
- dia akan merespon saat di dekatnya ada yang hiding
- dia akan memberitahu nick yang hiding
- dia akan memberitahu koordinat yang hiding

automacro teshide {
eval main::testhide()
run-once 1
timeout 10
call {
do c beware someone is hiding somewhere near
$result = subhide()
do c $result
release teshide
}
}

sub subhide {
use strict;
use Misc;
my ($say, $nama, $pljob, $pllv, $plx, $ply);
my $result = "no one is hiding";
for my $player (@{$playersList->getItems()}) {
    my $plstatus = $player->statusesString;
    next unless $player;
    if ( $plstatus =~ /(Hiding|Cloaking|Chase Walk)/i) {
        $nama = $player->name;
        $pljob = $player->job;
        $pllv = $player->{lv};
        $plx = $player->{pos_to}{x};
        $ply = $player->{pos_to}{y};
        $say = "nick : $nama job: $pljob lvl: $pllv pos: ($plx , $ply)\n";
        sendMessage($messageSender, "c", "$say");
        $result = "complete";
        }
    }
return $result;
}

sub testhide {
use strict;
use Misc;
my $result = 0;
for my $player (@{$playersList->getItems()}) {
    my $plstatus = $player->statusesString;
    next unless $player;
    if ( $plstatus =~ /(Hiding|Cloaking|Chase Walk)/i) {
        $result = 1;
        }
    }
return $result;
}

No comments:

Post a Comment