Username: Password:

Author Topic: [Share] Shop items selling script.  (Read 5342 times)

Offline =Mindee=

  • Commander Shepard
  • BOT Developer Administrator
  • Dragon
  • *****
  • Posts: 2,788
  • Cookies 9020
  • We'll bang, OKAY?
    • View Profile
    • http://mindee-bot.com
[Share] Shop items selling script.
« on: May 05, 2020, 11:44:17 PM »


1. Make hunting path in set 0. (Path must go through the spot location)
2. Make to shop path in set 1. (Must start from spot location and end in shop location)
3. Make back to hunt place path in set 2. (Must start from shop location and end in spot location)
4. Change spot location in script.
5. Change shop name in script. (Can be seen when you enter shop (in its title))
6. Change shop location (where to shop path ends) in script. (Near shop tile)


Script will sell items from autoloot list.


Script:
Code: [Select]
# Display kill count.
# 0 = disabled, 1 = enabled.
display_kill_count = 1
# 0 = don't drop anything, 1 = drop picked up/added to backpack items not in autoloot list.
# Warning! If enabled, bot will drop stuff when retrieving from depot, buying from shop.
# Just use it when hunting.
drop_items = 0

# Variables
spot = (31968, 31978, 8) # Spot where path changes to hunt or shop. 'Shop' path starts from it and 'Back' ends in it.
shop = (31965, 31981, 7) # Spot near shop, player enters shop from it
shop_name = 'Arsenal' # Change to your shop name which you will be using
sell_option_id = 2 # In shops like Scrapyard it's only possible to sell items, so in Scrapyard set it to 1.

# Paths
# Make hunting path in set 0.
# Make to shop path in set 1.
# Make back to hunt place path in set 2.
hunt = 0
to_shop = 1
back = 2

# Keep this as it is. (Must be 0)
ignore_menu = 0
last_time_shop = 0

def onTick():
global last_time_shop

if not script.IsInShop():
last_time_shop = 0
return

if last_time_shop > 0:
cur_time = script.GetCurrentTime()
if (cur_time - last_time_shop) > 60:
last_time_shop = 0
script.StatusMessage('Was stuck...')
script.LeaveShopEx()

def onScriptActivation():
global last_time_shop
last_time_shop = 0
script.EnableTickEvent(10000)

def getToShopPath():
return to_shop

def getToHuntPath():
return back

def onReceiveEnteredMenu(shopPacket, menuId, title):
global ignore_menu, last_time_shop

if title == shop_name:
ignore_menu = 0
last_time_shop = script.GetCurrentTime()
script.StatusMessage('Shop: ' + title)
if shopPacket == 1:
script.ChooseShopOption(menuId, sell_option_id) # Sell
elif title == 'Sell':
ignore_menu = 0
last_time_shop = script.GetCurrentTime()
if script.GetWay() != getToHuntPath():
script.SetWay(getToHuntPath(), 2)
script.StatusMessage('Selling items...')
else:
ignore_menu = 1

def onReceiveMenuRows(rows):
global last_time_shop

if ignore_menu == 1:
return

found = 0

for row in rows:
list = row.split()
menuId = int(list[0])
rowId = int(list[1])
title = list[2]
looktype = int(list[-1])

if script.IsInLoot(looktype):
script.ChooseMenuOption(menuId, 1, rowId) # Sell item
last_time_shop = script.GetCurrentTime()
found = 1
break # break to avoid flood
if found == 0:
script.StatusMessage('Done.')
script.LeaveShop() # didn't find items to sell.

def onReceiveMenuText(menuId, title, text):
if 'No entry in the list' in text:
script.StatusMessage('Done.')
script.LeaveShop() # didn't find items to sell.

def onChangeLocation(x, y, z):
if x == spot[0] and y == spot[1] and z == spot[2]:
if script.IsStorageFull() == 1:
if script.GetWay() != getToShopPath():
script.StatusMessage('Going to shop to sell items...')
script.SetWay(getToShopPath(), 2)
else:
if script.GetWay() != hunt:
script.StatusMessage('Hunt started!')
script.SetWay(hunt, 2)
elif x == shop[0] and y == shop[1] and z == shop[2]:
if script.GetWay() == getToShopPath():
if script.EnterShop():
script.StatusMessage('Entering shop.')
else:
script.Alarm('Can\'t find the shop.')

def onReceiveAddItemToBackpack(slot, itemId):
if drop_items == 1:
if not script.IsInLoot(itemId):
script.DropItem(slot, 1)

def onKilledEnemy(name, templateId):
if display_kill_count == 0:
return
varname = 'killed_' + name
mobs = script.GetVar(varname) + 1
script.SetVar(varname, mobs)
txt = str(mobs)
script.StatusMessage('Killed: ' + name + ' \nTotal: ~' + txt)
« Last Edit: June 05, 2020, 10:46:45 PM by =Mindee= »




Mindee-BOT creator, founder and developer.

Offline =Mindee=

  • Commander Shepard
  • BOT Developer Administrator
  • Dragon
  • *****
  • Posts: 2,788
  • Cookies 9020
  • We'll bang, OKAY?
    • View Profile
    • http://mindee-bot.com
Re: [Share] Shop items selling script.
« Reply #1 on: May 10, 2020, 04:42:34 PM »
- Updated.


Mindee-BOT creator, founder and developer.

Offline Pompaci

  • Bug
  • *
  • Posts: 2
  • Cookies 0
  • I love Mindee-BOT!
    • View Profile
Re: [Share] Shop items selling script.
« Reply #2 on: July 04, 2020, 12:20:05 PM »
I take all the steps. but he doesn't go into the shop to sell the items. When I enter the store manually, it says "sell product" and subtracts. still doesn't sell items

Offline =Mindee=

  • Commander Shepard
  • BOT Developer Administrator
  • Dragon
  • *****
  • Posts: 2,788
  • Cookies 9020
  • We'll bang, OKAY?
    • View Profile
    • http://mindee-bot.com
Re: [Share] Shop items selling script.
« Reply #3 on: July 04, 2020, 02:42:04 PM »
I take all the steps. but he doesn't go into the shop to sell the items. When I enter the store manually, it says "sell product" and subtracts. still doesn't sell items

Are all items in autoloot list?


Mindee-BOT creator, founder and developer.

Offline Pompaci

  • Bug
  • *
  • Posts: 2
  • Cookies 0
  • I love Mindee-BOT!
    • View Profile
Re: [Share] Shop items selling script.
« Reply #4 on: July 04, 2020, 02:51:59 PM »
Only collects items that fall from the creature i hunt

Offline =Mindee=

  • Commander Shepard
  • BOT Developer Administrator
  • Dragon
  • *****
  • Posts: 2,788
  • Cookies 9020
  • We'll bang, OKAY?
    • View Profile
    • http://mindee-bot.com
Re: [Share] Shop items selling script.
« Reply #5 on: July 04, 2020, 03:15:18 PM »
Problem is with your spot/shop location or waypoints then.
Make sure everything is correct. Download already made examples from here: https://mindee-bot.com/forum/index.php/board,53.0.html to see how it should work.


Mindee-BOT creator, founder and developer.