Can anyone help me with a couple series of Macros?

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

Moderator: Moderators

Message
Author
ytbro00
Noob
Noob
Posts: 14
Joined: 01 Aug 2017, 16:44
Noob?: No

Can anyone help me with a couple series of Macros?

#1 Post by ytbro00 »

So I'm trying to have my bots autodeal my merchant as soon as they're done auto selling & auto buying. My actual macro itself partially works. I'd just like to tweak on the trigger and auto adding. So here's a modified sample of what I'm trying to tweak around on.

1. I did not put weight trigger because I have my bots set to go back for auto buying and selling once they run out of potions and fly wings. Which is why I'm trying to get the macro to trigger as soon as I get to town.

2. Trying to get checkZeny to work. I'm able remove that line and simply do add z "amount," but is there a way to leave at least 50k - 100k on my farming bots so that they have enough money to auto-buy what they need?

3. I've been able to successfully add numerous amounts of items. Can anyone clarify if it's possible to just keep adding the same item like composite bow, wooden mail, knife until there are none left to trade without having to add multiple lines of the do deal add @inventory?

I have left a couple notes after "#" next to the code.


Code: Select all

automacro moveToMaster { #How can I trigger the macro to run as soon as my bot goes back to town (dies / uses butterfly wing)
   location #where my merchant is sitting
   call {
      do autosell
      do autobuy
      do conf lockMap
      do conf lockMap_x
      do conf lockMap_y
      do move payon
   }
   run-once 1
}

automacro dealToMaster {
   location #where my merchant is sitting
   call {
      do deal @player
      pause 3
      macro checkZeny { #not sure if this is working correctly
      switch ($.zeny) {
      case (> 200000) {
      do deal add z 100000 #any way to deal all zeny and just leave at least 100k on my farmer?
      pause 1
      do deal add @inventory(Hood [1]) #How can I add hood until I have none left without repeating the code?
      pause 1
      do deal
     pause 1
     do deal
   }
   run-once 1
}

automacro moveToFild { #where my bots are farming
   console /Deal Complete/i
   call {
      do conf lockMap
      do conf lockMap_x none
      do conf lockMap_y none
     do move
      do reload mac
   }
}


Any help is appreciated. Thanks.

hakore
Super Moderators
Super Moderators
Posts: 214
Joined: 16 May 2008, 08:28
Noob?: No
Contact:

Re: Can anyone help me with a couple series of Macros?

#2 Post by hakore »

location for moveToMaster should be the town name only.

If you already enabled sellAuto and buyAuto in config, remove the do autosell and do autobuy in you macro.

If you are already setting lockMap/_x/_y to near the location of the master, you don't have to add a do move, lockMap AI will move on it's own

Also, add a release in your macro as most of them are run-once

Try to work on this (not tested):

Code: Select all

automacro dealToMaster {
   location #where my merchant is sitting
   call {
      do deal @player(#your name)
      pause 3
       if ($.zeny >= 200000) {
         do deal add z @eval($.zeny - 100000)
      }
      pause 1
      $hoods = @Inventory(Hood [1])
      while ($hoods != -1 || $hoods != "") as loop
         do deal add [$hoods]
         pause 1
      end loop
      pause 1
      do deal
      pause 1
      do deal
   }
   run-once 1
}
Whatever...

ytbro00
Noob
Noob
Posts: 14
Joined: 01 Aug 2017, 16:44
Noob?: No

Re: Can anyone help me with a couple series of Macros?

#3 Post by ytbro00 »

hakore wrote:location for moveToMaster should be the town name only.

If you already enabled sellAuto and buyAuto in config, remove the do autosell and do autobuy in you macro.

If you are already setting lockMap/_x/_y to near the location of the master, you don't have to add a do move, lockMap AI will move on it's own

Also, add a release in your macro as most of them are run-once

Try to work on this (not tested):

Code: Select all

automacro dealToMaster {
   location #where my merchant is sitting
   call {
      do deal @player(#your name)
      pause 3
       if ($.zeny >= 200000) {
         do deal add z @eval($.zeny - 100000)
      }
      pause 1
      $hoods = @Inventory(Hood [1])
      while ($hoods != -1 || $hoods != "") as loop
         do deal add [$hoods]
         pause 1
      end loop
      pause 1
      do deal
      pause 1
      do deal
   }
   run-once 1
}



Thanks, Hakore. Got it to work but somehow after the zeny where the equipment adding are. it gives me an error. Removing those lines I'm able to get the zeny through no problem.


Image

hakore
Super Moderators
Super Moderators
Posts: 214
Joined: 16 May 2008, 08:28
Noob?: No
Contact:

Re: Can anyone help me with a couple series of Macros?

#4 Post by hakore »

Lol, I was assuming the syntax was more forgiving... Try this replacement:

Code: Select all

   $hoods = @Inventory(Hood [1])
   while ($hoods != -1 || $hoods != "") as loop
      $hood = [$hoods]
      do deal add $hood
      pause 1
   end loop
Whatever...

romcel11
Noob
Noob
Posts: 7
Joined: 09 Jul 2017, 19:54
Noob?: Yes

Re: Can anyone help me with a couple series of Macros?

#5 Post by romcel11 »

hakore wrote:Lol, I was assuming the syntax was more forgiving... Try this replacement:

Code: Select all

   $hoods = @Inventory(Hood [1])
   while ($hoods != -1 || $hoods != "") as loop
      $hood = [$hoods]
      do deal add $hood
      pause 1
   end loop


Am I correct to assume,
1) that in this code $hoods is a variable?
2) that $hood is being checked by the while loop if there are remaining hoods in inventory?
3) that $hood is also used to refer to that existing item?

Follow up question, is there a/any way to check for multiple (or a list of) items?

Thanks in advance!
rokes06 wrote:Guys I have problem with my Plugin Macro...
The ragexe.exe cant detect on my OpenKore..
Please Help me to Fix it :D :cry: :cry: :cry: :cry:

ytbro00
Noob
Noob
Posts: 14
Joined: 01 Aug 2017, 16:44
Noob?: No

Re: Can anyone help me with a couple series of Macros?

#6 Post by ytbro00 »

hakore wrote:Lol, I was assuming the syntax was more forgiving... Try this replacement:

Code: Select all

   $hoods = @Inventory(Hood [1])
   while ($hoods != -1 || $hoods != "") as loop
      $hood = [$hoods]
      do deal add $hood
      pause 1
   end loop


Worked after I removed "||" and did this. It added the items I wanted it to, but now it keeps looping and not executing "end loop" Used mufflers for testing.

Code: Select all

automacro dealToMaster {
   location #where my merchant is sitting
   call {
      do deal @player(#myname)
      pause 3
       if ($.zeny >= 400000) {
                do deal add z @eval($.zeny - 100000)
      }
      pause 1
      $mufflers = @Inventory(Muffler [1])
      while ($mufflers != -1 ) as loop
            do deal add $mufflers
            pause 1
      end loop
      pause 1
      do deal
      pause 1
      do deal
   }
   run-once 1
}


Image

hakore
Super Moderators
Super Moderators
Posts: 214
Joined: 16 May 2008, 08:28
Noob?: No
Contact:

Re: Can anyone help me with a couple series of Macros?

#7 Post by hakore »

Lol, you removed the [$...] part. That's the key to the loop. Try it again unchanged.

Code: Select all

   $list = @Inventory(Muffler [1])
   log This is the list of indexes for Mufflers (\$list): $list
   $i = 0
   while ($list != -1 && $list != "") as loop
      $item = [$list]
      log We are now adding item number (\$item):  $item
      log These are the remaining items on the list (\$list): $list
      do deal add $item
      pause 1
      $i++
      if ($i = 10) {
         $list = ""
      }
   end loop


Edit: || should be &&
Whatever...

ytbro00
Noob
Noob
Posts: 14
Joined: 01 Aug 2017, 16:44
Noob?: No

Re: Can anyone help me with a couple series of Macros?

#8 Post by ytbro00 »

Ok, did so without trying to fix anything in your code at all. It's working and adding it, but right after, it disconnects. Image below the console and error message.

EDIT: Actually just saw the comment about the || being &&. The image posted below is the one with ||. Just tried now with && successfully puts in all mufflers but right after it puts in the last one it gives the message "[macro] dealToMaster.call error: error in 9: syntax error in if statement"

Image

hakore
Super Moderators
Super Moderators
Posts: 214
Joined: 16 May 2008, 08:28
Noob?: No
Contact:

Re: Can anyone help me with a couple series of Macros?

#9 Post by hakore »

Well, maybe you can just remove the "if" there. And the $i. It's just an idea.

I think it wouldn't hurt except that it will attempt to loop through everything and add items to the deal even if the deal is already full.
Whatever...

ytbro00
Noob
Noob
Posts: 14
Joined: 01 Aug 2017, 16:44
Noob?: No

Re: Can anyone help me with a couple series of Macros?

#10 Post by ytbro00 »

No luck. Even if I remove "if" and "$i". It still gives me [macro] dealToMaster.call error: error in 5: syntax error in if statement

EDIT:

Tried it again. The if condition only works and successfully completes the macro if I input a number less than or equal to the mufflers I have. The number entered on $i is the number of mufflers it places on trade window. In this case, I have 5. Anything over than 5 returns the syntax error. Even If I remove it. So in this case it would still get stuck eventually if it doesn't get the amount specified before trading.

Code: Select all

$list = @Inventory(Muffler [1])
      log This is the list of indexes for Mufflers (\$list): $list
      $i = 0
      while ($list != -1 && $list != "") as loop
      $item = [$list]
      log We are now adding item number (\$item):  $item
      log These are the remaining items on the list (\$list): $list
      do deal add $item
      pause 1
      $i++
      if ($i = 5) { # Doesn't work when I enter 6 or up. The number I enter here is the number of mufflers it places on trade window.
      $list = ""
      }
      end loop
      pause 1
       do deal
      pause 1
     do deal
   }
   run-once 1
}


Post Reply