PDA

View Full Version : NPC trade problems.



Xparn
02-01-2013, 06:48 PM
ManaId = 238
MaxMana = 200
ManaPrice = 120
MinMana = 130
MinSds = 200
SDsToBuy = 1000
SdID = 3155
SDPrice = 108


Self.SayToNpc({"Hi", "flasks", "yes", "yes", "yes", "yes", "yes", "Trade"}, 100)
sleep(math.random(800, 1700))
Self.SayToNpc("trade")
sleep(math.random(2000, 2400))
Self.ShopBuyItemsUpTo(ManaId, (MaxMana-Self.ItemCount(ManaId)))
wait(900, 1200)
Self.ShopBuyItemsUpTo(SdID, (SDsToBuy-Self.ItemCount(SdID)))
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
Self.ShopBuyItemsUpTo(3155, 100)
wait(900, 1200)
setWalkerEnabled(true)

I added the "Self.ShopBuyItemsUpTo(3155, 100)" Because the "Self.ShopBuyItemsUpTo(SdID, (SDsToBuy-Self.ItemCount(SdID)))" doesn't seem to work... neither do the Great mana potions..

Anyone can tell me what's wrong?

DarkstaR
02-01-2013, 06:50 PM
Self.ShopBuyItemsUpTo(SdID, (SDsToBuy - Self.ItemCount(SdID))) should work perfectly fine. If it's not, you either have no trade window open, no gold, or no capacity. Also, you cannot have a dialog window open while trading. Items are counted from open backpack only, so make sure your SD backpack is open.

Xparn
02-01-2013, 06:54 PM
Self.ShopBuyItemsUpTo(SdID, (SDsToBuy - Self.ItemCount(SdID))) should work perfectly fine. If it's not, you either have no trade window open, no gold, or no capacity. Also, you cannot have a dialog window open while trading. Items are counted from open backpack only, so make sure your SD backpack is open.

I have everything of that, though with "dialog window" do you mean private message tab window?

Tried again, with both gmps and sds in my main backpack (backpack of holding) but it doesn't buy up to 1000 SDS or 200 GMPS. I have the cap and the cash and NPC channel is the one "chat tab" that is open...

Infernal Bolt
02-01-2013, 07:33 PM
It should be:
Self.ShopBuyItemsUpTo(ManaId, MaxMana)
Self.ShopBuyItemsUpTo(SdID, SDsToBuy)

You also just need 1, why do you have like 10 of them?

DarkstaR
02-01-2013, 08:00 PM
It should be:
Self.ShopBuyItemsUpTo(ManaId, MaxMana)
Self.ShopBuyItemsUpTo(SdID, SDsToBuy)

You also just need 1, why do you have like 10 of them?

Right. It automatically calculates the difference for you. That's likely the issue. I overlooked that, haha.

Xparn
02-01-2013, 08:23 PM
It should be:
Self.ShopBuyItemsUpTo(ManaId, MaxMana)
Self.ShopBuyItemsUpTo(SdID, SDsToBuy)

You also just need 1, why do you have like 10 of them?
Oh nevermind, thanks both of you.. gonna try it now and see if it works. I think it will though :) Seems more logical.

EDIT; it still doesn't buy 1000 as it should guh :/ I'm going to try if it works with 999 instead... Will post answer when i've tried.
ADD; YEP IT MUST BE 999 (or maybe not must but it works)
ADD; tested some more, obvously it doesn't work fully just buys 100, then i tried to have my whole main backpack open and put all items except the gmps and sds in other backpacks ... then it seemed to work as it should. Kinda weird that it doesn't work otherwise.