http://forums.openkore.com/viewtopic.php?t=34618


看的懂的只要依照如上網址教學就可以自行修改了..


至於看不懂的,就參考這篇看看吧


首先打開pm檔的方式是>>>點右鍵>>>選擇EmEditor,這樣就能開啟pm檔了..

要修改的pm檔就是在plugins/Macro資料夾裡的pm檔了..

至於要取代的部分,可以利用ctrl+f來協助尋找..


1.修改Automacro.pm

複製以下的內容




 
CODE:

sub checkMonster {
       my ($monsterList, $mondist) = $_[0] =~ /^(.*),\s(\d+)\s*$/;
       return 0 if ($mondist < 1);
        foreach (@monstersID) {
                next unless defined $_;
                if (existsInList($monsterList, $monsters{$_}->{name})) {
                        my $mypos = calcPosition($char);
                        my $pos = calcPosition($monsters{$_});
                        my $dist = sprintf("%.0f", distance($mypos, $pos));
                        my $val = sprintf("%d %d %s", $pos->{x}, $pos->{y}, $field->name);
                        $varStack{".lastMonster"} = $monsters{$_}->{name};
                        $varStack{".lastMonsterPos"} = $val;
                        $varStack{".lastMonsterDist"} = $dist;
                        $varStack{".lastMonsterID"} = $monsters{$_}->{binID};
                        return $dist <= $mondist ?1:0
                }
        }
        return 0
}

取代Automacro.pm以下的部分




 
CODE:

sub checkMonster {
        my $monsterList = $_[0];
        foreach (@monstersID) {
                next unless defined $_;
                if (existsInList($monsterList, $monsters{$_}->{name})) {
                        my $pos = calcPosition($monsters{$_});
                        my $val = sprintf("%d %d %s", $pos->{x}, $pos->{y}, $field->name);
                        $varStack{".lastMonster"} = $monsters{$_}->{name};
                        $varStack{".lastMonsterPos"} = $val;
                        return 1
                }
        }
        return 0
}

2.修改Utilities.pm

複製以下內容




 
CODE:

our @EXPORT_OK = qw(ai_isIdle q4rx between cmpr match getArgs refreshGlobal getnpcID getmonsterID getPlayerID
        getVenderID getItemIDs getInventoryIDs getStorageIDs getSoldOut getInventoryAmount getCartAmount
        getShopAmount getStorageAmount getRandom getRandomRange getConfig getWord callMacro);

取代Utilities.pm以下的部分




 
CODE:

our @EXPORT_OK = qw(ai_isIdle q4rx between cmpr match getArgs refreshGlobal getnpcID getPlayerID
        getVenderID getItemIDs getInventoryIDs getStorageIDs getSoldOut getInventoryAmount getCartAmount
        getShopAmount getStorageAmount getRandom getRandomRange getConfig getWord callMacro);

接著再複製以下的內容




 
CODE:

sub getPlayerID {
        foreach my $pl (@{$playersList->getItems()}) {
                return $pl->{binID} if $pl->name eq $_[0]
        }
        return -1
}
sub getmonsterID {
        my ($name, $pool) = @_;
        for (my $id = 0; $id < @{$pool}; $id++) {
                next unless $$pool[$id];
                next unless $monsters{$$pool[$id]}->{name};
                if ($monsters{$$pool[$id]}->{name} eq $name) {return $id}
        }
        return -1
}

取代Utilities.pm以下的部分




 
CODE:

sub getPlayerID {
        foreach my $pl (@{$playersList->getItems()}) {
                return $pl->{binID} if $pl->name eq $_[0]
        }
        return -1
}

3.修改Parser.pm

複製以下內容




 
CODE:

use Macro::Utilities qw(refreshGlobal getnpcID getmonsterID getItemIDs getStorageIDs getInventoryIDs
        getPlayerID getVenderID getRandom getRandomRange getInventoryAmount getCartAmount
        getShopAmount getStorageAmount getConfig getWord q4rx);

取代Parser.pm以下的部分




 
CODE:

use Macro::Utilities qw(refreshGlobal getnpcID getItemIDs getStorageIDs getInventoryIDs
        getPlayerID getVenderID getRandom getRandomRange getInventoryAmount getCartAmount
        getShopAmount getStorageAmount getConfig getWord q4rx);

接著再複製以下內容




 
CODE:

        while (($kw, $targ) = parseKw($cmd)) {
                $ret = "_%_";
                # first parse _then_ substitute. slower but more safe
                $arg = subvars($targ);

                if ($kw eq 'npc')           {$ret = getnpcID($arg)}
                elsif ($kw eq 'monster') {$ret = getmonsterID($arg, $::monstersID)}
                elsif ($kw eq 'cart')       {($ret) = getItemIDs($arg, $::cart{'inventory'})}

取代Parser.pm以下的部分




 
CODE:

        while (($kw, $targ) = parseKw($cmd)) {
                $ret = "_%_";
                # first parse _then_ substitute. slower but more safe
                $arg = subvars($targ);

                if ($kw eq 'npc')           {$ret = getnpcID($arg)}
                elsif ($kw eq 'cart')       {($ret) = getItemIDs($arg, $::cart{'inventory'})}

4.修改Data.pm

複製以下的內容




 
CODE:

our $macroKeywords =
        "npc"          . "|" .
        "cart"         . "|" .
        "inventory"    . "|" .
        "store"        . "|" .
        "storage"      . "|" .
        "player"       . "|" .
        "monster"       . "|" .

取代Data.pm以下的部分




 
CODE:

our $macroKeywords =
        "npc"          . "|" .
        "cart"         . "|" .
        "inventory"    . "|" .
        "store"        . "|" .
        "storage"      . "|" .
        "player"       . "|" .


到這裡就已經大功告成了..

以下就是實測的部分..

修改前..(無法顯示距離,而造成無法迴避怪物




修改後..(正常顯示距離



 


感謝tvkid 大一路的教導~


 


 


-------------------------------------------------------------------------------------------------------------


我使用的下面的巨集,可以閃,



#用走的迥避巨集設定,3格的設定
automacro avoid {
 
        # 當地圖為...時
 
        map pay_fild10
 
        # 當魔物為...且距離你 12 格以內時
 
        # Notice the coma space and number 12 above? This avoid automacro only trigger if any of the monster list
 
        # distance is equal or less than the number given.
 
        monster 虎王, 12
 
        # 間隔 5 秒
 
        timeout 5
 
        exclusive 1
 
        # 打算要往反方向走幾格
 
        # set Move to how many distance per trigger you want it to move.
 
        set Move 11
 ##回頭走5格仍是魔法攻擊距離(大約是11格)
 
        call check
 
}
 
macro check {
 
[
 
        $mon = $.lastMonster
 
        $monID = $.lastMonsterID
 
        $dist = $.lastMonsterDist
 
        $monPos = $.lastMonsterPos
 
        $map = $.map
 
        $myPos = $.pos
 
        $myPosX = @arg ("$myPos", 1)
 
        $myPosY = @arg ("$myPos", 2)
 
        $monPosX = @arg ("$monPos", 1)
 
        $monPosY = @arg ("$monPos", 2)
 
        $map = $.map
 
        do eval message T("Macro Avoid: $::Macro::Data::varStack{mon} \($::Macro::Data::varStack{monID}\)\n"), "teleport"; message T("魔物距離\= $::Macro::Data::varStack{dist} \, 魔物座標\: \($::Macro::Data::varStack{monPosX},$::Macro::Data::varStack{monPosY}\) 地圖名\= $::Macro::Data::varStack{map}\n"), "teleport";
 
]
 
     do as
 


     if ($myPosX > $monPosX) goto east
 
     if ($myPosX < $monPosX) goto west
 
  :X0
 
     if ($myPosY < $monPosY) goto X0south
 
     if ($myPosY > $monPosY) goto X0north
 
     log We have the same co-ord to the Monster
 
     do @random ("east", "west", "south", "north") $Move
 
     log Move Random
 
     stop
 
  :X0south
 
     log Monster Loc: North X-axis0
 
     do south $Move
 
     log Move South
 
     stop
 
  :X0north
 
     log Monster Loc: South X-axis0
 
     do north $Move
 
     log Move North
 
     stop
 


:east
 
        if ($myPosY < $monPosY) goto eastSouth
 
        if ($myPosY > $monPosY) goto eastNorth
 
      :Y0east
 
        log Monster Loc: West Y-axis0
 
        do east $Move
 
        log Move East
 
        stop 
 
     :eastSouth
 
        log Monster Loc: NorthWest
 
        do southeast $Move
 
        log Move South East
 
        stop
 
     :eastNorth
 
        log Monster Loc: SouthWest
 
        do northeast $Move
 
        log Move North East
 
        stop
 


:west
 
        if ($myPosY < $monPosY) goto westSouth
 
        if ($myPosY > $monPosY) goto westNorth
 
      :Y0west
 
        log Monster Loc: East Y-axis0
 
        do west $Move
 
        log Move West
 
        stop 
 
     :westSouth
 
        log Monster Loc: NorthEast
 
        do southwest $Move
 
        log Move South West
 
        stop
 
     :westNorth
 
        log Monster Loc: SouthEast
 
        do northwest $Move
 
        log Move North West
 
        stop
 
}


 

創作者介紹
創作者 aaa1314 的頭像
aaa1314

RO相關資料資訊♂外掛腳本討論&請勿發表其他廣告(請保持畫面清爽)感謝

aaa1314 發表在 痞客邦 留言(0) 人氣()