Vend bot with multiple items help!

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

Moderator: Moderators

Post Reply
Message
Author
suggipuss
Noob
Noob
Posts: 14
Joined: 31 Mar 2012, 18:25
Noob?: Yes

Vend bot with multiple items help!

#1 Post by suggipuss »

Hello guys..
I botte quite on and off and have come back to the game now.
I have a vend bot that i want to sell items and rebuy them once they are empty, but i doesnt seem to rebuy them.

Here is the code
[code#######################################
##### Vending in Payon #####
#######################################


#################################
##### Open Shop at location #####
#################################

automacro vend {
location payon
cart "Red Potion" > 25,cart "Orange Potion" > 25,cart "Awakening Potion" > 10,cart "Concentration Potion" > 10,cart "Fly Wing" > 25
call open_shop
timeout 10
}

macro open_shop {
do move 170 61
}

automacro open_shop_now {
run-once 1
location payon 170 61
call open_my_shop
}

macro open_my_shop {
do move 170 62
pause 1
do openshop
release open_shop_now
}

##########################################################################

####################
##### Buy Item #####
####################


automacro get_red {
location payon 170 62
shop "Red Potion" < 26
exclusive 1
call go_buyred
}

macro go_buyred {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 2 250
pause 3
do cart add Red Potion
pause 3
do move payon_in01 16 51
do move payon 170 62
}

automacro get_orange {
location payon 170 62
shop "Orange Potion" < 26
exclusive 1
call go_buyorange
}

macro go_buyorange {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 3 250
pause 3
do cart add Orange Potion
pause 3
do move payon_in01 16 51
do move payon 170 62
}

automacro get_Awak {
location payon 170 62
shop "Awakening Potion" < 11
exclusive 1
call go_buyawak
}

macro go_buyawak {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 8 30
pause 3
do cart add Awakening Potion
pause 3
do move payon_in01 16 51
do move payon 170 62
}

automacro get_conc {
location payon 170 62
shop "Concentration Potion" < 11
exclusive 1
call go_buyconc
}

macro go_buyconc {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 7 30
pause 3
do cart add Concentration Potion
pause 3
do move payon_in01 16 51
do move payon 170 62
}

automacro get_fly {
location payon 170 62
shop "Fly Wing" < 26
exclusive 1
call go_buyfly
}

macro go_buyfly {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 9 200
pause 3
do cart add Fly Wing
pause 3
do move payon_in01 16 51
do move payon 170 62
}
[/code]

As you can see i want the bot to buy Red Pot and Orange Pot when they are below 26 and open shop when they are above 25.. and so on
The Shop will have a total of 5 items, Red Potion, Orange Potion, Fy Wing, Awak and Conc..
I found this script for White Potion online and tried to modify it for my needs but because i have multiple items i cant seem to get it to work..
Basically I want the bot to go Buy whenever 1 item becomes too low.

suggipuss
Noob
Noob
Posts: 14
Joined: 31 Mar 2012, 18:25
Noob?: Yes

Re: Vend bot with multiple items help!

#2 Post by suggipuss »

I have got it to work now i think.. my solution probably isnt very elegant..
But there is still a problem.. when an item is sold out below the threshold the bot goes and buys the item and then walks back to open the shop.. but then immediately closes the shop again and buys the item again.. I dont know why this happens..
It also happens everytime when i first start the bot up..
Can someone help me plz? I dont want to be spoonfed, but i have zero knowledge of coding and read it all in the wiki here.

Here is the code

Code: Select all

#######################################
##### Vending in Payon #####
#######################################


#################################
##### Open Shop at location #####
#################################

automacro vend {
location payon
cart "Red Potion" > 25
cart "Orange Potion" > 25
cart "Awakening Potion" > 10
cart "Concentration Potion" > 10
cart "Fly Wing" > 25
call open_shop
timeout 10
}

macro open_shop {
do move 170 61
}

automacro open_shop_now {
run-once 1
location payon 170 61
call open_my_shop
}

macro open_my_shop {
do move 170 62
pause 1
do openshop
release open_shop_now
}

##########################################################################

####################
##### Buy Item #####
####################


automacro get_red {
shop "Red Potion" < 26
exclusive 1
call go_buyred
}

macro go_buyred {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 2 250
pause 3
do cart add Red Potion
pause 3
do move payon_in01 16 51
do move payon 170 62
}

automacro get_orange {
shop "Orange Potion" < 26
exclusive 1
call go_buyorange
}

macro go_buyorange {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 3 250
pause 3
do cart add Orange Potion
pause 3
do move payon_in01 16 51
do move payon 170 62
}

automacro get_Awak {
shop "Awakening Potion" < 11
exclusive 1
call go_buyawak
}

macro go_buyawak {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 8 30
pause 3
do cart add Awakening Potion
pause 3
do move payon_in01 16 51
do move payon 170 62
}

automacro get_conc {
shop "Concentration Potion" < 11
exclusive 1
call go_buyconc
}

macro go_buyconc {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 7 30
pause 3
do cart add Concentration Potion
pause 3
do move payon_in01 16 51
do move payon 170 62
}

automacro get_fly {
shop "Fly Wing" < 26
exclusive 1
call go_buyfly
}

macro go_buyfly {
do closeshop
pause 3
do move payon 141 85
do move payon_in01 11 49
do talk @npc (5 49)
do store
pause 3
do buy 9 200
pause 3
do cart add Fly Wing
pause 3
do move payon_in01 16 51
do move payon 170 62
}
I think the problem has something to do with these llines "shop "Fly Wing" < 26"..
I think the bot thinks the condition is met when the shop isnt even open and while he is opening the shop, the buymacro also get triggered at the same time.. Problem is i dont know how to fix it T_T

suggipuss
Noob
Noob
Posts: 14
Joined: 31 Mar 2012, 18:25
Noob?: Yes

Re: Vend bot with multiple items help!

#3 Post by suggipuss »

please someone can help me? I dont know how to fix it

c4c1n6kr3m1
The Way Of Human
The Way Of Human
Posts: 151
Joined: 24 Mar 2012, 04:13
Noob?: Yes

Re: Vend bot with multiple items help!

#4 Post by c4c1n6kr3m1 »

well, i haven't read your macro seriously

but yes, we have that problem. Normally we did trick that problem.

what if you test some code , so may be we get better result
you need to backup these 2 files 'src\Misc.pm' and 'src\Network\Receive\ServerType0.pm'

open those 2 files using Wordpad or Notepad++ ( not notepad.exe )
find this line in 'src\Misc.pm' ,

Code: Select all

$shopstarted = 1;
add '#' so it won't read

Code: Select all

#$shopstarted = 1;
then save

find this line in 'src\Network\Receive\ServerType0.pm'

Code: Select all

$shopEarned ||= 0;
edit become like this

Code: Select all

	$shopstarted = 1;
	$shopEarned ||= 0;
save it , than try it
report if succes

suggipuss
Noob
Noob
Posts: 14
Joined: 31 Mar 2012, 18:25
Noob?: Yes

Re: Vend bot with multiple items help!

#5 Post by suggipuss »

^ dude you are amazing! it works like a charm now.. I would have never found this fix myself.. thank you alot!

Now i have a last problem with this line

Code: Select all

automacro vend {
location payon
cart "Red Potion" > 25,cart "Orange Potion" > 25,cart "Awakening Potion" > 10,cart "Concentration Potion" > 10,cart "Fly Wing" > 25
call open_shop
timeout 10
}
I want this automacro to trigger when ANY of the things are below the threshold, so i should make an OR condition right?
but this seems to not work.

c4c1n6kr3m1
The Way Of Human
The Way Of Human
Posts: 151
Joined: 24 Mar 2012, 04:13
Noob?: Yes

Re: Vend bot with multiple items help!

#6 Post by c4c1n6kr3m1 »

i never try "cart"
but sometimes "inventory" got the same problem

i think you better try separate 1 by 1

c4c1n6kr3m1
The Way Of Human
The Way Of Human
Posts: 151
Joined: 24 Mar 2012, 04:13
Noob?: Yes

Re: Vend bot with multiple items help!

#7 Post by c4c1n6kr3m1 »

wait, below the threshold ? suppose to be "<"
you typed ">"

suggipuss
Noob
Noob
Posts: 14
Joined: 31 Mar 2012, 18:25
Noob?: Yes

Re: Vend bot with multiple items help!

#8 Post by suggipuss »

no i meant "above" not "below".. my mistake so yeah the symbol is correct.
I fixed it by making them all seperate automacros and it works now.
Thx for the help :)
I hope anyone can use my code now, if someone has a question write it here and ill help you out since i got it now. Thanks again :)

Post Reply