วันจันทร์ที่ 28 พฤษภาคม พ.ศ. 2555

มาโครเดินตามกัน

Macro for SLAVE

################################
######FIND MASTER###############
################################
#find master
automacro findMaster {
timeout 3
console /^I lost my master/
call {
$master = @config (followTarget)
do pm "$master" x $.map $.pos
}
}
automacro findMaster2 {
timeout 3
console /^Calculating route to find master/
call {
$master = @config (followTarget)
do pm "$master" x $.map $.pos
}
}
#goto master
automacro gotoMaster {
pm /x (.*) (.*) (.*)/
call {
$pm = $.lastpm
if ($pm != $master) stop
do move $.lastMatch1 $.lastMatch2 $.lastMatch3
}
}
#when master is found
automacro foundMaster {
console /^Found my master!/
call {
do pm "$master" clear
}
}


Macro for MASTER
#######################################
########FIND SLAVE#####################
#######################################
#slave is lost
automacro findSlave {
pm /x (.*) (.*) (.*)/
call {
$slavemap = $.lastMatch1
$slavemapx = $.lastMatch2
$slavemapy = $.lastMatch3
$mymap = $.map
if ($slavemap == $mymap) goto findslave
do pm "$.lastpm" x $.map $.pos
stop
:findslave
do pm "$.lastpm" x $.map $.pos
do move $slavemap $slavemapx $slavemapy
}
}
#when slave is found
automacro clear {
pm /clear/
call {
do eval AI::clear("move", "route");
}
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น