How to make switchbot buy bonus switcher from NPC?

07/01/2015 21:12 xbossy#1
Hello, I have the logininfo.py switchbot and I use it on a server.
It's the only switchbot I can use, because this server has protection, but somehow this switchbot works, lol.

So there is no bonus switcher at the NPC directly. To buy the bonus switcher you need to click on the NPC, then a windows will appear and you need to select from a list of quests the "Bonus Switcher" and then a new window will appear and select "I want to buy Bonus switcher". So there is no actual shop that I can let open in order for the switchbot to auto buy...

How could I make my switchbot bypass this and autobuy when there is no bonus switcher in the inventory. Because like this I always have to be near the PC to buy another bonus switcher.

The code of the switchbot where it buys from the shop I think it's this:

Code:
			if player.GetItemCountByVnum(int(Switchvalue)) <= 0:
				for eachSlot in xrange(shop.SHOP_SLOT_COUNT):
					getShopItemID = shop.GetItemID(eachSlot)
					if getShopItemID == int(Switchvalue) and not itemVNum == int(Switchvalue):
						net.SendShopBuyPacket(eachSlot)
Can you help me change this code in order to auto buy bonus switcher?
Or if there is something else I need to do, please teach me :)
07/02/2015 05:53 Famouz™#2
Nice
07/02/2015 09:25 xbossy#3
Nice what??
I am asking how to do it, I don't explain how I do it...

Please help me make autobuy bonus switcher for this server!
07/02/2015 09:36 rollback#4
Idk how to do it exactly in python, but i would do something like this:

Code:
class switchbot
	
	shopslot = 0
	
	def switch():
		if switchercount < 1:
			if vnum_in_slot(shopslot) != 71084:
				shopslot = getShopslotForVnum(71084)
			buy_item_from_shopslot(shopslot)
		
		#switch_boni
		
	def getShopslotForVnum(vnum):
		for i = 0, shopslotcount, 1:
			if vnum_in_slot(i) == vnum:
				return i
07/02/2015 15:20 xbossy#5
Thank you Sensi for your response, but your code does the same as the one I posted? Because I think they are the same..
I don't know if you understood, the NPC doesn't have bonus switcher in a shop. It's in a quest, I need to choose from a menu "bonus switcher" and I will receive the bonus switcher in my inventory. How can I do this automatically?

It's like this.
[Only registered and activated users can see links. Click Here To Register...]