Openkore.com

OpenKore Forums
It is currently 17 Oct 2018, 10:43

All times are UTC - 5 hours [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: kinky if statement
PostPosted: 14 Feb 2012, 13:02 
Offline
Noob
Noob

Joined: 14 Feb 2012, 12:54
Posts: 4
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:
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.


Top
 Profile  
 
 Post subject: Re: kinky if statement
PostPosted: 14 Feb 2012, 23:15 
Offline
Developers
Developers

Joined: 05 Dec 2008, 05:42
Posts: 1811
Macro plugin doesn't have such a normal syntax as you're trying to use.

http://wiki.openkore.com/index.php/Macro#IF_statement


Top
 Profile  
 
 Post subject: Re: kinky if statement
PostPosted: 15 Feb 2012, 14:03 
Offline
Noob
Noob

Joined: 14 Feb 2012, 12:54
Posts: 4
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:
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
}


Top
 Profile  
 
 Post subject: Re: kinky if statement
PostPosted: 31 May 2017, 23:32 
Offline
Noob
Noob

Joined: 16 May 2017, 13:41
Posts: 4
thankyou pawlow its work :)

macro version 2.0.3


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group