Store.lua suggestion for selling obsolete consumables

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
imaginethat
Posts: 61
Joined: Sun Jul 10, 2011 10:39 pm

Store.lua suggestion for selling obsolete consumables

#1 Post by imaginethat »

Hi
I have been working on getting the bot to keep the bags clear of items it does not need to have in them, and just be more efficient, and have made some improvements, and a suggestion for a possible addition to the Store.lua file.

I have added a sell function to sell items that are too high a level for the bot to use. This situation generally happens when swapping to your lower level class, leaving items in your bag that are of no use until you level. I solved this with Rock5 help. See post http://www.solarstrike.net/phpBB3/viewt ... =21&t=3086

I then worked on removing the inventory items that were too low a level, such as when you gain a level and then stock up on higher level consumables (mana/health, quivers etc)
The low level items stay in my bags for potentially ever, as the bot keeps topping up consumables when the high level ones run low, never using/selling or dropping the lower level ones. There must be other people that have this issue, or is it just me?

So I started looking around at how the bot identified the level of consumable to buy, and it looks like the Store.lua file determines the "bestLevel" from the self.item table (generated from the vendors sell items.)
So once the bestLevel is determined, the Store.lu code then goes on to search(and total) the inventory for all the items that >= bestLevel and <= player.Level.

I added some code in to this inventory search loop to sell any item that is a consumable and does not fit into the above category, meaning it is too high or too low a level to use.

This is what the code was:

Code: Select all

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

	local totalCount = 0;
 	for slot,item in pairs(inventory.BagSlot) do
		local consumable = database.consumables[item.Id];
	    if item.Available and
		  consumable and
		  consumable.Type == type and
		  consumable.Level >= bestLevel and
		  consumable.Level <= player.Level then
			totalCount = totalCount + item.ItemCount
		end;
	end;
I then added a line making it this:

Code: Select all

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

	local totalCount = 0;
 	for slot,item in pairs(inventory.BagSlot) do
		local consumable = database.consumables[item.Id];
	    if item.Available and
		  consumable and
		  consumable.Type == type and
		  consumable.Level >= bestLevel and
		  consumable.Level <= player.Level then
			totalCount = totalCount + item.ItemCount
		elseif settings.profile.options.INV_AUTOSELL_ENABLE == true and 
			item.Available and
			consumable and
			consumable.Type == type then
			item:use()
			yrest(500) --not sure if rest is needed
		end;
	end;
There could be other checks added in to check for level of item etc, but did put in a flimsy check to see if the person wanted to "AUTOSELL" items mainly to illustrate a possible profile option for this, like "INV_SELLUNUSABLE_ENABLE" or "INV_SELLOBSOLETE_ENABLE" or something similar could allow people to sell or not sell these unusable/obsolete consumables.

I have implemented it in the last 30mins and looks like it works as expected, but still have more testing to do. Servers have just shut down, so will have to test more tomorrow.

Keen to get some feedback on this. Is this useful to more than just me? How do others keep their bags clear of too high/low consumables?
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Store.lua suggestion for selling obsolete consumables

#2 Post by rock5 »

I like the way you think. I was thinking, as I read your post, that there will probably need to be a profile option for it and then I read that you were thinking that too. I thinking maybe "INV_AUTOSELL_SELLOBSOLETECONSUMABLES". That's a mouthfill though.

I think this is worth adding. It could be a waste of money if you keep changing class but otherwise would save inventory space.

To simplify the code I would first do the checks that are common to both the items you want to count and the items you want to get rid of. Then I would say 'if the levels are correct then count it else if sellconsumables option then sell end'. Eg.

Code: Select all

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

	local totalCount = 0;
	for slot,item in pairs(inventory.BagSlot) do
		local consumable = database.consumables[item.Id];
		if item.Available and
		consumable and
		consumable.Type == type then
			if consumable.Level >= bestLevel and
			 consumable.Level <= player.Level then
				totalCount = totalCount + item.ItemCount
			elseif settings.profile.options.INV_AUTOSELL_ENABLE == true and 
			 settings.profile.options.INV_AUTOSELL_SELLOBSOLETE == true then
				item:use()
				yrest(500) --not sure if rest is needed
			end
		end;
	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
imaginethat
Posts: 61
Joined: Sun Jul 10, 2011 10:39 pm

Re: Store.lua suggestion for selling obsolete consumables

#3 Post by imaginethat »

Thanks rock5, glad you see the value in this. I hope it helps others keep their bags cleaner.
Another suggestion for the profile options...thinking that the AUTOSELL and SELL both do not need to be in it, seems to mean the same (to me at least),
so maybe "INV_AUTOSELL_OBSOLETECONSUMABLES".

I was also thinking last night after posting, that people may not want to get rid of either the too high unusable or too low obsolete items, due to money or what ever, so could there be two options..."INV_AUTOSELL_OBSOLETECONSUMABLES" and "INV_AUTOSELL_UNUSABLECONSUMABLES", one to cover the lower level items, and the other to cover the higher end items, or is this getting too granular?

Code: Select all

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

   local totalCount = 0;
   for slot,item in pairs(inventory.BagSlot) do
      local consumable = database.consumables[item.Id];
      if item.Available and
           consumable and
           consumable.Type == type then
        if consumable.Level >= bestLevel and
	     consumable.Level <= player.Level then
             totalCount = totalCount + item.ItemCount
        elseif settings.profile.options.INV_AUTOSELL_ENABLE == true and 
	     settings.profile.options.INV_AUTOSELL_OBSOLETECONSUMABLES == true and
	     item.RequiredLvl < bestLevel then
             item:use()
             yrest(500) --not sure if rest is needed
	elseif settings.profile.options.INV_AUTOSELL_ENABLE == true and 
	     settings.profile.options.INV_AUTOSELL_UNUSABLECONSUMABLES == true and
	     item.RequiredLvl > player.Level then
             item:use()
             yrest(500) --not sure if rest is needed
         end
      end;
   end;
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Store.lua suggestion for selling obsolete consumables

#4 Post by rock5 »

When would someone use separate options? If the higher level consumables are too expensive? I would think the most obvious use of the original idea is, when your character is low level and you still don't have much money, then you don't want to waste money selling stuff you might still need, so you leave the option off. Later on, when you are higher level, the price of store purchased consumables is negligible so you could enable it to save inventory space.

Also at lower levels, if you loot higher level pots, it might not be too long before you level up and can use them. Whereas at higher levels it takes ages to level so you don't want to be holding onto unusable pots for the time it would take to level.

I think 2 option could be usefull to some but on the whole, it's overkill IMHO.
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Store.lua suggestion for selling obsolete consumables

#5 Post by lisa »

At lower levels 1-15 you get plenty of potions from the level bags, low gold shouldn't be an issue.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Store.lua suggestion for selling obsolete consumables

#6 Post by rock5 »

lisa wrote:At lower levels 1-15 you get plenty of potions from the level bags, low gold shouldn't be an issue.
Yeh, but you still waste money if you keep changing class and selling your stuff and buying replacements. Also you might not be opening your bag if you are saving them for when you need the mounts.

So what would you prefer? Would you like to have 2 options or is the one enough?
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Store.lua suggestion for selling obsolete consumables

#7 Post by lisa »

I personally love as many options as I can get, I do find that having more options can confuse people though.

An example, as a R/S you have mana with the scout side but you will probably never need any mana potions for the scout side as you will just do pulls with ranged and then use your much stronger rogue skills in melee range to kill the mobs. So even though the character has mana I wouldn't have mana potions in my bag as it wastes space.

example 2
R/P
Obviously have mana on priest side and you use priest side for healing yourself, can be very important and you may want the mana potions in this case. I know I would but I wouldn't want more then a stack.

How about use the profile setting of how many to buy to also be how many to be left after selling. If in profile you say to buy 99 mana pots then if you are at the merchant sell anything more then 99.

So no extra options for that part.

As for switching classes and level being an issue, not sure. I personally just use second/third class to boost main class and actually don't play it at all. So just do dailies on second class but farm the items for dailies on main class.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
imaginethat
Posts: 61
Joined: Sun Jul 10, 2011 10:39 pm

Re: Store.lua suggestion for selling obsolete consumables

#8 Post by imaginethat »

I will be happy to use just one option that covers both unusable and obsolete items, but there could be others out there that may just want to sell the obsolete and continue to loot/hold onto the higher level items for use when they level up.
For the amount of code needed to implement the two options, I would lean toward having both autosell_obsoleteconsumables and autosell_unusableconsumables.

Having the two options gives people the ability to implement them as they need them, or just leave them alone. I use less than half the existing options, but its nice to know that there are options there to support they way I may start botting in the future, without having to hassle you into adding an additional option latter on.

Either way I am happy with the implementation into store.lua

cheers
Post Reply