Openkore.com

OpenKore Forums
It is currently 13 Dec 2017, 22:18

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Vend bot with multiple items help!
PostPosted: 02 Sep 2017, 11:44 
Offline
Noob
Noob

Joined: 31 Mar 2012, 18:25
Posts: 14
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.


Top
 Profile  
 
 Post subject: Re: Vend bot with multiple items help!
PostPosted: 02 Sep 2017, 12:46 
Offline
Noob
Noob

Joined: 31 Mar 2012, 18:25
Posts: 14
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:
#######################################
##### 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


Top
 Profile  
 
 Post subject: Re: Vend bot with multiple items help!
PostPosted: 04 Sep 2017, 07:34 
Offline
Noob
Noob

Joined: 31 Mar 2012, 18:25
Posts: 14
please someone can help me? I dont know how to fix it


Top
 Profile  
 
 Post subject: Re: Vend bot with multiple items help!
PostPosted: 04 Sep 2017, 09:30 
Offline
Plain Yogurt
Plain Yogurt

Joined: 24 Mar 2012, 04:13
Posts: 97
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:
$shopstarted = 1;

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

then save

find this line in 'src\Network\Receive\ServerType0.pm'
Code:
$shopEarned ||= 0;

edit become like this
Code:
   $shopstarted = 1;
   $shopEarned ||= 0;

save it , than try it
report if succes


Top
 Profile  
 
 Post subject: Re: Vend bot with multiple items help!
PostPosted: 04 Sep 2017, 11:07 
Offline
Noob
Noob

Joined: 31 Mar 2012, 18:25
Posts: 14
^ 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:
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.


Top
 Profile  
 
 Post subject: Re: Vend bot with multiple items help!
PostPosted: 04 Sep 2017, 12:49 
Offline
Plain Yogurt
Plain Yogurt

Joined: 24 Mar 2012, 04:13
Posts: 97
i never try "cart"
but sometimes "inventory" got the same problem

i think you better try separate 1 by 1


Top
 Profile  
 
 Post subject: Re: Vend bot with multiple items help!
PostPosted: 04 Sep 2017, 12:52 
Offline
Plain Yogurt
Plain Yogurt

Joined: 24 Mar 2012, 04:13
Posts: 97
wait, below the threshold ? suppose to be "<"
you typed ">"


Top
 Profile  
 
 Post subject: Re: Vend bot with multiple items help!
PostPosted: 05 Sep 2017, 09:44 
Offline
Noob
Noob

Joined: 31 Mar 2012, 18:25
Posts: 14
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 :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 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