cmpr wrong # argument error

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

surviveryuga
Human
Human
Posts: 30
Joined: 19 Dec 2012, 12:57
Noob?: No

cmpr wrong # argument error

#1 Post by surviveryuga »

As I post before about the trading macro between Rogues(Slave Trade) and Merchant (Main Trade).
I use this macro when my rogues have reach more than 48% weight to go back Geffen and start a deal with my merchant.
Seems that automacro 1 is successful, but when entering automacro 2 (deal process) it's get stuck by some errors.
The openkore screen always intend to show this :

Code: Select all

cmpr: wrong # of arguements <0>  <  > <  >
and bot stuck automatically and can't continue trading process.

here's first macro (go back when 48% weight from gef_fild08 to geffen xx xx to start a deal with my merchant where he stands on)
automacro 1 is SUCCESS ...

Code: Select all

automacro 1 {
map gef_fild08
weight >= 48%
run-once 1
exclusive 1
call {
do conf attackAuto 0
do conf lockMap geffen
do conf lockMap_x 35
do conf lockMap_y 90
do conf route_randomWalk 0
do move geffen 35 90
release 1 
}
}


This second macro works until deal @player and start adding the item, and then the "cmpr: wrong # of arguements <0> < > < >" error begins and bot quit automatically

Code: Select all

automacro 2 {
weight >= 48%
location geffen 35 90
timeout 65
run-once 1
call {
$ro = @player (mymerchantname)
$item1 = @inventory (Dragon Scale)
$item2 = @inventory (Zargon)
$item3 = @inventory (White Herb)
$item4 = @inventory (Dragon Tail)
$item5 = @inventory (Elunium)
$item6 = @inventory (Aloevera)
$item7 = @inventory (Khukri)
$item8 = @inventory (Sky Petite Card)
$item9 = @inventory (Maneater Blossom)
$item10 = @inventory (Stem)
$item11 = @inventory (Aloe Leaflet)
$item12 = @inventory (Singing Flower)
$item13 = @inventory (Aloe)
$item14 = @inventory (Sunflower)
$item15 = @inventory (Witherless Rose)
$item16 = @inventory (Flora Card)
$item17 = @inventory (Mantis Scythe)
$item18 = @inventory (Scell)
$item19 = @inventory (Red Herb)
$item20 = @inventory (Solid Shell)
$item21 = @inventory (Green Live)
$item22 = @inventory (Rough Elunium)
$item23 = @inventory (Emerald)
$item24 = @inventory (Mantis Card)

do deal $ro
pause 2
do deal add $item1
do deal add $item2
do deal add $item3
do deal add $item4
do deal add $item5
do deal add $item6
do deal add $item7
do deal add $item8
do deal add $item9
do deal add $item10
pause 1
do deal
pause 1
do deal
pause 3

do deal $ro
pause 2
do deal add $item11
do deal add $item12
do deal add $item13
do deal add $item14
do deal add $item15
do deal add $item16
do deal add $item17
do deal add $item18
do deal add $item19
do deal add $item20
pause 1
do deal
pause 1
do deal
pause 3


do deal $ro
do deal add $item21
do deal add $item22
do deal add $item23
do deal add $item24
pause 1
do deal
pause 1
do deal
stop
release 2
}
}
So far i guess and assume that :
1.Maybe my macro logic have problem
2.I used latest macro plugin and get updated (maybe,i dont know)
3.Maybe my openkore has problem (but i think is OK since there is no prob with my other bots)
4.Config.txt problem (I have check and nothing is weird there)

I will appreciate for those who can tell me the solution about this problem about. thx before

Code: Select all

[color=#FF0000]cmpr: wrong # of arguements <0>  <  > <  >[/color]
surviveryuga
Human
Human
Posts: 30
Joined: 19 Dec 2012, 12:57
Noob?: No

Re: cmpr wrong # argument error

#2 Post by surviveryuga »

one more, I always keep my mind about "case sensitive" but this time i need help guys :|
rocknroll
Been there done that!
Been there done that!
Posts: 118
Joined: 19 Sep 2011, 07:30
Noob?: Yes

Re: cmpr wrong # argument error

#3 Post by rocknroll »

can u see khukri in your inventory??
it doesn't stack, so maybe that's the error.
Sorry, my english is very bad !
Maseo84
Noob
Noob
Posts: 17
Joined: 14 Jun 2009, 07:06
Noob?: No

Re: cmpr wrong # argument error

#4 Post by Maseo84 »

You cannot deal or trade an item you do not have which will cause and argument

if ($item1 > 0) {
do deal add $item1
}

if ($item2 > 0) {
do deal add $item2
}

there is ppbly a cleaner way to do it, but you get the idea
Hello World!
franibaflo
Human
Human
Posts: 35
Joined: 06 May 2012, 10:11
Noob?: Yes

Re: cmpr wrong # argument error

#5 Post by franibaflo »

I don't mean to be spoonfed, but I really lack skills in coding/arguments. Anyway, is it possible or can anyone pls some argument in the macro wherein the bot would transfer/deal everything in the inventory that is ($item > 0). I hope anyone would be kind enough to point me into the right direction. otherwise, i'd resort to creating thousand of lines of "if ($item1 > 0) {do deal add $item1}" because my bot is set to loot everything. Thanks in advance for anyone kind enough!

EDIT: I've found a macro from one of the oldest posts in openkore (and from the web as well) although I still haven't been able to test it. I'm trying to decode what the macro does but it's too complex and difficult from what my comprehension allows me. Anyway, can anyone confirm if the macro below is working and/or maybe tell us if it does what it needs to do (transfer all inventory/storage items from a "sender slave" to a "receiver master". Thanks in advance! Hoping for a reply.

The source:http://www.gamerzplanet.net/forums/ragn ... ction.html
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
}