Macro to auto transfer between two bots.
Taken from a different forum.
1. Start with this,
#Create an autoTransfer.txt inside Sender control folder and put all the items in the txt file
#Item Waiting List For AutoTransfer
#syntax: ItemName<space>weight
#Ex: Royal Jelly 15
Royal Jelly 15
Honey 10
Mastela Fruit 3
Dead Branch 5
#You can put stackable Items here.. put it as many as u like
#But, make sure you wont get over the storage limit list (300 is max)
1. Macro For Sender bot...
### Send.txt ###
Quote:
##################
automacro login {
map yuno
run-once 1
set List 5
#Put List value same as your autoTransfer.txt Item list
#Mine was 4 items.. I put 5 just to make it safe.
call autostorage
}
macro new {
$items = NotSpecify
$found = 0
$weights = 0
call scanList
if ($found = 1) goto player
:unknown
log Items Finish/NotSpecify/Not Found
do eval Utils::Win32::playSound('C:\Windows\media\tada.wav ');
pause 5
goto unknown
:player
log Scan For Master Name
$master = @config (followTarget)
$id = @player ($master)
if ($id >= 0) goto pm
pause 5
goto player
:pm
do pm "$master" $items $weights
}
automacro transfer {
pm /(.*)\s(\d+)\s(\d+)\s(\d+)$/
exclusive 1
call foo
}
macro foo {
$master = @config (followTarget)
$player = $.lastpm
if ($player != $master) stop
$id = @player ($master)
$item = $.lastMatch1
$itemStorageMax = $.lastMatch2
$dealRecv = $.lastMatch3
$itemWeight = $.lastMatch4
:operationB
$invamount = @invamount ($item)
if ($invamount = 0) goto inv0
if ($dealRecv <= $invamount) goto maxdealB
if ($itemStorageMax <= $invamount) goto operationB2
:operationB1
call dealAll
$itemStorageMax = @eval ($itemStorageMax-$invamount)
do autostorage
pause 2
goto inv0
:operationB2
call dealStorageMax
do pm "$master" Your Storage For $item Is Full!!!
do autostorage
pause 2
goto delete
:maxdealB
if ($itemStorageMax <= $dealRecv) goto operationB4
:operationB3
call dealRecv
$itemStorageMax = @eval ($itemStorageMax-$dealRecv)
do autostorage
pause 2
goto operationB
:operationB4
call dealStorageMax
do pm "$master" Your Storage For $item Is Full!!!
do autostorage
pause 2
goto delete
:operationA
call weight
if ($dealRecv < $dealSend) goto dealRecv
:dealSend
$storamount = @storamount ($item)
if ($storamount = 0) goto item0
if ($itemStorageMax <= $dealSend) goto operationASend2
:operationASend1
do storage get @storage($item) $dealSend
call dealAll
$itemStorageMax = @eval ($itemStorageMax-$dealSend)
do autostorage
pause 2
goto dealSend
:operationASend2
do storage get @storage($item) $itemStorageMax
call dealAll
do pm "$master" Your Storage For $item Is Full!!!
do autostorage
pause 2
goto delete
:dealRecv
$storamount = @storamount ($item)
if ($storamount = 0) goto item0
if ($itemStorageMax <= $dealRecv) goto operationARecv2
:operationARecv1
do storage get @storage($item) $dealRecv
call dealAll
$itemStorageMax = @eval ($itemStorageMax-$dealRecv)
do autostorage
pause 2
goto dealRecv
:operationARecv2
do storage get @storage($item) $itemStorageMax
call dealAll
do pm "$master" Your Storage For $item Is Full!!!
do autostorage
pause 2
goto delete
:end
log All ItemList in autoTransfer.txt is depleted!!!
do eval Utils::Win32::playSound('C:\Windows\media\tada.wav ');
pause 5
goto end
:inv0
$storamount = @storamount ($item)
if ($storamount = 0) goto item0
goto operationA
:item0
pause 2
do pm "$master" Items $item was not found or finish continuing on next items!!
pause 2
:delete
call delete
pause 2
if ($txtList >= $List) goto end
call new
}
macro scanList {
do eval if (open(FILE, "<", Settings::getControlFilename("autoTransfer.txt"))) {message "Reading autoTransfer.txt File... Please Wait...\n";while (<FILE>) {$_ =~ s/\x{FEFF}//g; chomp($_); next if ($_ =~ /^[\n\r#]/); $_ =~ /^(.*)$/; $_ = $1; $_ =~ s/\s+$//;$_ =~ s/^\s+//; $1 =~ /^.*,?\s(\d+)\s*$/; if (!defined $1 || $1 =~ /\D+/) { message "Please specify Item $_ weight\nEx: $_ #<number>\n"; $::Macro::Data::varStack{found} = 0; $::Macro::Data::varStack{weights} = NotSpecify; last; } $::Macro::Data::varStack{weights} = $1; $_ =~ /^(.*)$/; $_ = $1; $_ =~ s/\s+$//;$_ =~ s/^\s+//; $1 =~ /^(.*),?\s\d+\s*$/; if (Match::inventoryItem(lc($1)) || Match::inventoryItem($1)) {if (!$1->{equipped}) { $::Macro::Data::varStack{items} = $1; $::Macro::Data::varStack{found} = 1; last; } next;} if ($::storage{opened}) { if (Match::storageItem(lc($1)) || Match::storageItem($1)) {$::Macro::Data::varStack{items} = $1; $::Macro::Data::varStack{found} = 1; last; } next;} } close FILE; } if ($::Macro::Data::varStack{weights} eq "NotSpecify") { message "Please specify $_ weight\n";} else {message "Result: Found $::Macro::Data::varStack{found} Matching for $::Macro::Data::varStack{items} Weight= $::Macro::Data::varStack{weights}\n";}
}
macro delete {
do eval my @lines = ();if (open(FILE, "<", Settings::getControlFilename("autoTransfer.txt"))) {while (<FILE>) {$_ =~ s/\x{FEFF}//g; chomp($_);if ($_ =~ /^[#\n\r]/) { next; } $_ =~ /^(.*)$/; $_ =~ s/\s+$//;$_ =~ s/^\s+//; $1 =~ /^(.*),?\s\d+\s*$/;if (($::Macro::Data::varStack{item} || lc($::Macro::Data::varStack{item})) eq ($1 || lc($1))) {push @lines,$_; last;} } close FILE; } if (open(FILE, "<", Settings::getControlFilename("autoDelete.txt"))) {while (<FILE>) {$_ =~ s/\x{FEFF}//g; chomp($_); if ($_ =~ /^[#\n\r]/) { next; } $_ =~ /^(.*)$/; $_ =~ s/\s+$//;$_ =~ s/^\s+//; $1 =~ /^(.*),?\s\d+\s*$/;if (($::Macro::Data::varStack{item} || lc($::Macro::Data::varStack{item})) eq ($1 || lc($1))) {next;} else {push @lines,$_; next;} } close FILE;} open(FILE, ">", Settings::getControlFilename("autoDelete.txt")); print FILE join "\n", @lines; close FILE;
do eval my @lines = ();if (open(FILE, "<", Settings::getControlFilename("autoTransfer.txt"))) {while (<FILE>) { $_ =~ s/\x{FEFF}//g; chomp($_); if ($_ =~ /^[#\n\r]/) { push @lines,$_; next; } $_ =~ /^(.*)$/; $_ =~ s/\s+$//;$_ =~ s/^\s+//; $1 =~ /^(.*),?\s\d+\s*$/; if (($::Macro::Data::varStack{item} || lc($::Macro::Data::varStack{item})) eq ($1 || lc($1))) { next; } else { push @lines,$_; } } close FILE; } open(FILE, ">", Settings::getControlFilename("autoTransfer.txt")); print FILE join "\n", @lines; close FILE;
$txtList = @eval ($txtList + 1)
}
macro weight {
do eval $::Macro::Data::varStack{dealSend} = int(($::char->{'weight_max'} - $::char->{'weight'}) * 95 / 100 / $itemWeight)
}
macro dealAll {
do storage close
pause 2
do deal $id
pause 2
do deal add @inventory ($item)
pause 2
do deal
pause 2
do deal
pause 2
}
macro dealRecv {
do storage close
pause 2
do deal $id
pause 2
do deal add @inventory ($item) $dealRecv
pause 2
do deal
pause 2
do deal
pause 2
}
macro dealStorageMax {
do storage close
pause 2
do deal $id
pause 2
do deal add @inventory ($item) $itemStorageMax
pause 2
do deal
pause 2
do deal
pause 2
}
macro autostorage {
call loadFiles
if ($run = 0) goto load
do conf sitAuto_idle 0
do conf relogAfterStorage 0
do conf storageAuto_npc yuno 152 187
do autostorage
pause 2
stop
:load
log Error in loading autoTransfer.txt or autoDelete.txt
do eval Utils::Win32::playSound('C:\Windows\media\tada.wav ');
pause 5
goto load
}
macro loadFiles {
$run = 0
do eval $_d = 0; $_t = 0; foreach my $_file (@{$::Settings::files->getItems()}) {if ($_file->{name} eq "autoTransfer.txt") {$_t = 1;};if ($_file->{name} eq "autoDelete.txt") {$_d = 1;}} if ($_t == 0) {Settings::addControlFile("autoTransfer.txt", loader => [\&parseDataFile, \%autoTransfer]);} if ($_d == 0) {Settings::addControlFile("autoDelete.txt", loader => [\&parseDataFile, \%autoDelete]);}; foreach my $_file (@{$::Settings::files->getItems()}) {if ($_file->{name} eq "autoTransfer.txt") {$_t = 1;};if ($_file->{name} eq "autoDelete.txt") {$_d = 1;}} if ($_d == 0 || $_t == 0) {message "autoDelete= $_d Found\nautoTransfer= $_t Foundt\n", "macro";} else {$::Macro::Data::varStack{run} = 1}
}
3 Macro for the Reciever Bot.
Quote:
### Receive.txt ###
Quote:
###################
automacro StartDeal {
console /^\(From: (.*)\) : (.*) (\d+)$/
exclusive 1
set deal 0
call start
}
macro start {
$item = $.lastMatch2
$itemWeight = $.lastMatch3
$itemStorageMax = @eval (30000 - @storamount ($item))
do eval $::Macro::Data::varStack{deal} = int(($::char->{'weight_max'} - $::char->{'weight'}) * 95 / 100 / $itemWeight )
:player
log Scans Name
$master = $.lastMatch1
$id = @player ($master)
if ($id >= 0) goto pm
pause 5
goto player
:pm
do pm "$master" $item $itemStorageMax $deal $itemWeight
do storage close
stop
}
automacro storage {
console /Item added to inventory: (.*) \((\d+)\) x (\d+) -/i
exclusive 1
call start2
}
macro start2 {
do autostorage
$item = $.lastMatch1
$storevalue = @storamount ($item)
$invitem = @invamount ($item)
$eval = @eval ($invitem + $storevalue)
if ($eval < 30000) goto ok
$eval2 = @eval (30000 - $storevalue)
do e flg3
do storage add @inventory ($item) $eval2
log Currently There Are 30000 $item Inside Storage: Maximum Limit
log Transfer Aborted
stop
:ok
do storage add @inventory ($item) $invitem
pause 1
$storevalue = @storamount ($item)
log Currently There Are $storevalue $item Inside Storage
do storage close
stop
}
automacro transfer {
console /(.*) \(level (\d+)\) Requests a Deal/
exclusive 1
call trans
}
macro trans {
$name = $.lastMatch1
$master = @config (followTarget)
log $name Want To Have A Deal With You
if ($name = $master) goto ok
do deal no
stop
:ok
log Accepted!!!
do deal
stop
}
automacro deal {
console /Engaged Deal with (.*)/
exclusive 1
call deal
}
macro deal {
$name = $.lastMatch1
$master = @config (followTarget)
if ($name = $master) goto ok
do deal no
stop
:ok
do deal
stop
}
automacro deal1 {
console /(.*) finalized the Deal/
exclusive 1
call deal1
}
macro deal1 {
$name = $.lastMatch1
$master = @config (followTarget)
if ($name = You) goto ok2
if ($name = $master) goto ok
do deal no
stop
:ok
do deal
log Deal With $master Done
stop
:ok2
stop
}
automacro load {
map yuno
run-once 1
call load
}
macro load {
do conf sitAuto_idle 0
do conf relogAfterStorage 0
do conf storageAuto_npc yuno 152 187
do autostorage
}