Macro Coding question

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

Moderator: Moderators

vendetta
Noob
Noob
Posts: 4
Joined: 05 Jun 2013, 21:18
Noob?: No

Macro Coding question

#1 Post by vendetta »

Code: Select all

automacro vend {
location payon
cart "White Potion" > 0
call open_shop
timeout 10
}

macro open_shop {
do move 167 65
}

automacro open_shop_now {
run-once 1
location payon 167 65
call open_my_shop
}

macro open_my_shop {
do move 167 64
pause 1
do openshop
release open_shop_now
}


automacro get_whites {
location payon 167 64
console /Shop closed./
cart "White Potion" < 1
exclusive 1
call go_buy
}

macro go_buy {
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 5 265
pause 3
do cart add White Potion
pause 3
do talk @npc (5 49)
do store
pause 3
do buy 5 265
pause 3
do cart add White Potion
pause 3
do move payon_in01 16 51
do move payon 167 64
}
So basically what it does is it vends then when item is sold out, it purchases said item.

However, the hole in this is that the automacro won't initiate unless it had pots in the cart initially. It will only start running when there is pots in the cart prior to running the bot and then macro. I ran this 3x without pots in the cart to test the autobuy pathing but only when I bought pots and placed them in the cart did the automacro run. Can anyone help me fix this? I want the whole sequence to run with or without pots in the cart.


Thanks in advance!
Raider
The Kore Devil
The Kore Devil
Posts: 672
Joined: 22 Feb 2013, 03:40
Noob?: No
Location: The Netherlands

Re: Macro Coding question

#2 Post by Raider »

I would like to advice you to use run-once 1 and release #nameoftheautomacro
Another thing that would is very handy:

Code: Select all

do conf QuestPart #step1
automacro step1 {
eval $::config{QuestPart} eq "step1"
The automacro will then trigger only when the config variable is set to step1

Some useful examples: http://sourceforge.net/p/openkore/code/ ... fg_macros/
My last made macros: http://forums.openkore.com/viewtopic.php?f=32&t=49570
inv
Plain Yogurt
Plain Yogurt
Posts: 58
Joined: 18 Sep 2009, 01:28
Noob?: Yes

Re: Macro Coding question

#3 Post by inv »

It's too easy, but I'm too lazy to help
vendetta
Noob
Noob
Posts: 4
Joined: 05 Jun 2013, 21:18
Noob?: No

Re: Macro Coding question

#4 Post by vendetta »

Raider wrote:I would like to advice you to use run-once 1 and release #nameoftheautomacro
Another thing that would is very handy:

Code: Select all

do conf QuestPart #step1
automacro step1 {
eval $::config{QuestPart} eq "step1"
The automacro will then trigger only when the config variable is set to step1

Some useful examples: http://sourceforge.net/p/openkore/code/ ... fg_macros/
My last made macros: http://forums.openkore.com/viewtopic.php?f=32&t=49570

what does run-once1 and release #automacro do exactly?

I'm having a problem with this now though. Once the 2nd part of the code #buying items# ends. The first automacro doesn't kick in to vend anymore.
hukiju
Noob
Noob
Posts: 2
Joined: 19 Jun 2013, 08:45
Noob?: No

Re: Macro Coding question

#5 Post by hukiju »

For the first part, when you vend your white pots, dont vend all of it, left 1 pot in your cart and change a bit on this code
automacro get_whites {
location payon 167 64
console /Shop closed./
cart "White Potion" = 1
exclusive 1
call go_buy
}

For second part, your automacro "open_shop_now" only trigger when at location 167 65.

macro go_buy {
do move payon 141 85
.
.
.
pause 3
do move payon_in01 16 51
do move payon 167 65
}