Page 1 of 1
kinky if statement
Posted: 14 Feb 2012, 13:02
by pawlow
I'm writing a tiny macro to bring my items to a waiting slavemule on a predetermined position, it runs fine untill I add items.
Now with this the interpreter seems to have a problem, telling me "munch, munch, strange block":
Code: Select all
macro walkToSlave {
do ai manual
$rherb = @inventory ("Red Herb")
$shell = @inventory ("Shell")
$phracon = @inventory ("Phracon")
do move 22 76 morocc
pause 5
$playerID = @player("tralfamador")
pause 5
do deal $playerID
pause 1
if($rherb != -1) {
do deal add $rherb
pause 1
}
if($shell != -1) {
do deal add $shell
pause 1
}
if($phracon != -1) {
do deal add $phracon
pause 1
}
do deal
pause 5
do deal
pause 5
do ai on
}
I've tried putting the actual adding of the items into extra macros and then just calling those, OpenKore then tells me "Unrecognized -> if <- subroutine".
Enlightment appreciated.
Re: kinky if statement
Posted: 14 Feb 2012, 23:15
by EternalHarvest
Macro plugin doesn't have such a normal syntax as you're trying to use.
http://wiki.openkore.com/index.php/Macro#IF_statement
Re: kinky if statement
Posted: 15 Feb 2012, 14:03
by pawlow
Thanks, found out about that myself. You just get used to the C syntax when you've been programming in it for years.
Here's what's working for me now if anyone's interested, all it does is go to my idling slave bot who sits at a fixed position and has dealAuto 2 on and deal him predetermined items that my farm bot is gonna pick up. Had to split it in two deals because all the items wouldn't fit into one deal. Rest is completely straightforward.
Code: Select all
automacro checkWeight {
weight >= 89%
call dealItemsToSlave
}
macro dealItemsToSlave {
do ai manual
pause 1
call walkToSlave
call getItemIds
call getSlaveId
call dealOne
call dealTwo
do ai on
}
macro getItemIds {
$shell = @inventory (Shell)
pause 1
$phracon = @inventory (Phracon)
pause 1
$bottle = @inventory (Empty Bottle)
pause 1
$china = @inventory (China)
pause 1
$rherb = @inventory (Red Herb)
pause 1
$guard = @inventory (Guard [1])
pause 1
$card = @inventory (Peco Peco Egg Card)
pause 1
$milk = @inventory (Milk)
pause 1
$feather = @inventory (Feather)
pause 1
$bfeather = @inventory (Feather of Birds)
pause 1
$ygem = @inventory (Yellow Gemstone)
pause 1
$mucus = @inventory (Sticky Mucus)
pause 1
}
macro getSlaveId {
$playerID = @player("slaveName")
pause 1
}
macro walkToSlave {
do move 110 291 morocc
pause 1
}
macro dealSlave {
do deal $playerID
pause 1
}
macro dealOne {
do deal $playerID
pause 1
if ($shell != -1) call addshells
pause 1
if ($phracon != -1) call addphracs
pause 1
if ($china != -1) call addchinas
pause 1
if ($rherb != -1) call addrherbs
pause 1
if ($guard != -1) call addguards
pause 1
if ($card != -1) call addcards
pause 1
do deal
pause 2
do deal
pause 2
}
macro dealTwo {
do deal $playerID
pause 1
if ($bottle != -1) call addbottles
pause 1
if ($milk != -1) call addmilks
pause 1
if ($feather != -1) call addfeathers
pause 1
if ($bfeather != -1) call addbfeathers
pause 1
if ($ygem != -1) call addygems
pause 1
if ($mucus != -1) call addmucus
pause 1
do deal
pause 2
do deal
pause 2
}
macro addshells {
do deal add $shell
}
macro addphracs {
do deal add $phracon
}
macro addbottles {
do deal add $bottle
}
macro addchinas {
do deal add $china
}
macro addrherbs {
do deal add $rherb
}
macro addguards {
do deal add $guard
}
macro addcards {
do deal add $card
}
macro addmilks {
do deal add $milk
}
macro addygems {
do deal add $ygem
}
macro addfeathers {
do deal add $feather
}
macro addbfeathers {
do deal add $bfeather
}
macro addmucus {
do deal add $mucus
}
Re: kinky if statement
Posted: 31 May 2017, 23:32
by hynospt
thankyou pawlow its work
macro version 2.0.3