Bot buys Potions and trowbag when allready there

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Bot buys Potions and trowbag when allready there

#1 Post by botje »

Like stated in Title, bot buys potion and trowbag, even when i have them.

i guess its because im botting in a region where i can only buy lower potions and trowbags, but should bot not be able to detect the higher ones anyway?

it should not buy lower ones if higher ones are present right?

Botje
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Bot buys Potions and trowbag when allready there

#2 Post by rock5 »

If it does, then it shouldn't. I'll look into it.

What it should do is, after finding the best store item, it should check the inventory and see how many items (of whatever level) are better than it. If there are more than the required amount, it doesn't buy any.
Last edited by rock5 on Fri Dec 03, 2010 5:50 am, edited 1 time in total.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Bot buys Potions and trowbag when allready there

#3 Post by botje »

cool, thanx man :)
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Bot buys Potions and trowbag when allready there

#4 Post by rock5 »

Ok Ive done it but I couldn't be bothered to properly test it as I don't usually use consumables and would have to do too much, to set up conditions like you described, to do a test.

Could you just replace the whole storeBuyConsumable function in your inventory.lua with this code and see how it goes?

Code: Select all

function CInventory:storeBuyConsumable(type, quantity)
	-- Find best store item
	local bestLevel = 0;
	for storeSlot = 1, 28, 1 do
		local storeItemLink, icon, name, storeItemCost = RoMScript("GetStoreSellItemLink("..storeSlot.."),GetStoreSellItemInfo("..storeSlot..")");

		if (storeItemLink == "" or storeItemLink == nil) then
			break;
		end

		storeItemId, storeItemColor, storeItemName = CItem:parseItemLink(storeItemLink);
--		printf("%s %s\n", storeItemId, storeItemName);

		local consumable = database.consumables[storeItemId];

		if( consumable
		  and consumable.Type == type
		  and consumable.Level <= player.Level ) then
			if consumable.Level > bestLevel then
				bestLevel = consumable.Level;
				bestItem = storeItemId;
				bestItemSlot = storeSlot;
			end
		end
	end

	if bestLevel == 0 then
	    return false;
 	end

	-- Count number of better items in inventory
	self:update();

	local totalCount = 0;
 	for slot,item in pairs(self.BagSlot) do
		local consumable = database.consumables[item.Id];
	    if item.Available and
		  consumable and
		  consumable.Type == type and
		  consumable.Level >= bestLevel then
			totalCount = totalCount + item.ItemCount
		end;
	end;

	-- See how many needed
	if totalCount < quantity then
	    numberToBuy = quantity - totalCount;
	    printf(language[1001]);  -- Shopping
	    for i = 1, numberToBuy, 1 do
	    	RoMScript("StoreBuyItem("..bestItemSlot..")");
	    	printf(".");
		end
		printf("\n");
	end

	return true;
end
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Bot buys Potions and trowbag when allready there

#5 Post by botje »

nice, works fine so far, doesnt buy any other items now :)

Botje
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Bot buys Potions and trowbag when allready there

#6 Post by rock5 »

Committed to rev 532.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: Bot buys Potions and trowbag when allready there

#7 Post by Giram »

Is it possible to select what potions bot is buying?
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Bot buys Potions and trowbag when allready there

#8 Post by rock5 »

Giram wrote:Is it possible to select what potions bot is buying?
Why would you want that? Isn't the highest one always the best?

It wouldn't be much of a auto buy function if you had to specify which potions to buy.

Which gives me a thought. Let me just check...

Yep, I forgot to check if the inventory potions are lower than the player level. Which means, when checking to see if you have higher lever items in your inventory, it will include ones that are too high for your player to use.

I'll have to fix that.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Bot buys Potions and trowbag when allready there

#9 Post by rock5 »

rock5 wrote:I forgot to check if the inventory potions are lower than the player level. Which means, when checking to see if you have higher lever items in your inventory, it will include ones that are too high for your player to use.

I'll have to fix that.
Finally added this fix in rev 536.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
Post Reply