Keep only clean HD items when selling items?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Keep only clean HD items when selling items?

#1 Post by Giram »

Can i set bot to sell all other items than clean HD items? I know i can set durability to ignore list but how keeping only clean items?
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Keep only clean HD items when selling items?

#2 Post by lisa »

When you say clean, do you mean with no bonus stats at all?
Actually I think the best way to do what you want is to get a loot filter addon and configure it to only collect what you want. Then set rombot autosell to false.
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: Keep only clean HD items when selling items?

#3 Post by rock5 »

lisa wrote:When you say clean, do you mean with no bonus stats at all?
Actually I think the best way to do what you want is to get a loot filter addon and configure it to only collect what you want. Then set rombot autosell to false.
But then he couldn't sell them.

You need some sort of specially written function.

Code: Select all

if player:openStore("npcname") then -- open store
	for i, item in pairs(inventory.BagSlot) do -- for each item
		-- only get tooltip if is type equipment, in bags and has high dura
		if i > 60 and (item:isType("Weapons") or item:isType("Armor")) and item.Durability > 100 then 
			local tooltip_right = item:getGameTooltip("right") -- get tooltip
			local statfound = false
			for i,tooltipline in pairs(_tooltip_right) do
				if string.match(tooltipline," [IVX]*$") then -- if ends in roman numeral
					statfound = true
					break
				end
			end
			if statfound then -- sell it
				item:use()
			end
		end
	end
end
This should work. If you also want to use the player:merchant function for other things like buying, repairing and selling other types of items then you'll need to add "Weapons,Armor" to the INV_AUTOSELL_TYPES_NOSELL option in your profile so it doesn't end up selling them anyway.
  • 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: Keep only clean HD items when selling items?

#4 Post by lisa »

I think what he is trying to do is keep only clean (no stat) items with high durability. So the loot filter will make sure he only picks up those items. I think selling the other items is just to clear bag space.
I could be wrong though.
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
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: Keep only clean HD items when selling items?

#5 Post by Giram »

Yes, items with no stats but high durability. Loot filter is not option cause i am collecting all items and selling them to merchant to get money. Clean items i would use my self or sell to ah cause from those i could get more money that way.

Edit: After trying out that code i get error: [string "..."]:8: bad argument #1 to 'pairs' (table expected, got nil).
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Keep only clean HD items when selling items?

#6 Post by rock5 »

Giram wrote:Yes, items with no stats but high durability. Loot filter is not option cause i am collecting all items and selling them to merchant to get money. Clean items i would use my self or sell to ah cause from those i could get more money that way.

Edit: After trying out that code i get error: [string "..."]:8: bad argument #1 to 'pairs' (table expected, got nil).
Oops, typo. And I noticed i had the dura check back-to-front.

No wait, there is more wrong with the code. Hold on a second.
  • 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: Keep only clean HD items when selling items?

#7 Post by rock5 »

Ok try this.

Code: Select all

if player:openStore("npcname") then -- open store
	for i, item in pairs(inventory.BagSlot) do -- for each item
		-- Only if equipment in bags
		if i > 60 and (item:isType("Weapon") or item:isType("Armor")) then
			-- only get tooltip if high dura
			if item.Durability > 100 then 
				local tooltip_right = item:getGameTooltip("right") -- get tooltip
				local sellit = false
				for i,tooltipline in pairs(tooltip_right) do
					if string.match(tooltipline," [IVX]*$") then -- if ends in roman numeral
						sellit = true
						break
					end
				end
			else
				sellit = true -- sell if dura is low
			end
			if sellit then
				item:use() -- sell it
			end
		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
User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: Keep only clean HD items when selling items?

#8 Post by Giram »

I don't understand how that is working now... It might sell item regardless of dura or stat or it might not sell. It can be any color, dura or have any stat on it.

I tried to change it so it would sell only low dura but its still skipping many items.

Code: Select all

	while(true) do
		if player:openStore("Carey Delis") then -- open store
			for i, item in pairs(inventory.BagSlot) do -- for each item
			-- Only if equipment in bags
				if i > 60 and (item:isType("Weapon") or item:isType("Armor")) then
				-- only get tooltip if high dura
					if 100 > item.Durability then
						item:use() -- sell it
					end
				end
			end
		end
	end
Could there be still something wrong with memory addresses?

Edit: Maybe i need to clean my profile before trying but i test that later.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Keep only clean HD items when selling items?

#9 Post by rock5 »

What my version does is, if dura is high it checks if there are any stats. If there are stats, then it sells. On the other hand if the dura is low then it sells anyway because you said you wanted to save only high dura clean items.

What your version looks like it does is sell all high dura equipment.

So what happened when you tried my code? How did you use it?
  • 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: Keep only clean HD items when selling items?

#10 Post by Giram »

I though that my test would sell all low dura items...
But this is how i placed your code in my waypoint:

Code: Select all

	<!-- # 68 --><waypoint x="-33393" z="-16217">	</waypoint>
	<!-- # 69 --><waypoint x="-33391" z="-16198">
		if player:openStore("Carey Delis") then -- open store
		   for i, item in pairs(inventory.BagSlot) do -- for each item
			  -- Only if equipment in bags
			  if i > 60 and (item:isType("Weapon") or item:isType("Armor")) then
				 -- only get tooltip if high dura
				 if item.Durability > 100 then
					local tooltip_right = item:getGameTooltip("right") -- get tooltip
					local sellit = false
					for i,tooltipline in pairs(tooltip_right) do
					   if string.match(tooltipline," [IVX]*$") then -- if ends in roman numeral
						  sellit = true
						  break
					   end
					end
				 else
					sellit = true -- sell if dura is low
				 end
				 if sellit then
					item:use() -- sell it
				 end
			  end
		   end
		end
		
		
		loadPaths("RMoney");
		</waypoint>
And my current selling settings:

Code: Select all

<option name="INV_MAX_SLOTS" value="180" />
<option name="INV_UPDATE_INTERVAL" value="300" />
<option name="INV_AUTOSELL_ENABLE" value="true" />
<option name="INV_AUTOSELL_FROMSLOT" value="24" />
<option name="INV_AUTOSELL_TOSLOT" value="180" />
<option name="INV_AUTOSELL_QUALITY" value="white, green, blue" />
<option name="INV_AUTOSELL_IGNORE" value="nil" />	
<option name="INV_AUTOSELL_NOSELL_DURA" value="0" />
<option name="INV_AUTOSELL_STATS_NOSELL" value="nil" />
<option name="INV_AUTOSELL_STATS_SELL" value="nil" />	
But it sold my clean HD item and left many low dura or other items with stats on them. I think that there is some sort of pattern. It sells 2 or sometimes 3 items then skips one.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Keep only clean HD items when selling items?

#11 Post by rock5 »

I think to be sure, we should add a

Code: Select all

inventory:update()
before the 'if' statment

The profile settings only affect player:merchant() which we are not using.

I had to test the function myself to find the bugs. Turned out I forgot to move where the 'sellit' variable declaration when I did my last change and I used a wrong symbol in the pattern match.

This is now working for me.

I've attached it as a userfunction file. Who knows maybe I'll develop it further. For now, it does what you want it too.

To use it just put it in the userfunctions folder and use

Code: Select all

expertSell("Carey Delis",100)
the second value is the dura level the item must beat to be kept.
Attachments
addon_expertsell.lua
(816 Bytes) Downloaded 155 times
  • 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: Keep only clean HD items when selling items?

#12 Post by Giram »

That addon is still skipping many items. I tried changing this line:

Code: Select all

if i > 60 and (item:isType("Weapon") or item:isType("Armor")) then
to

Code: Select all

if i > 60  then
and then it didn't skip any items. It started from first slot and sold all items that dura is less than 100 or dura more than 100 and has stats on it. So i did this:

Code: Select all

if (i > (60 + settings.profile.options.INV_AUTOSELL_FROMSLOT - 1) and 60 + settings.profile.options.INV_AUTOSELL_TOSLOT > i) then
So it won't sell my potions.But if my inventory is not full it would just go through every slot one by one and checks if there is item to sell. That doesn't matter for now cause i go sell only if my inventory is full.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Keep only clean HD items when selling items?

#13 Post by rock5 »

That's a nice little addition.

Sorry, I see another error. Were the items skipped all weapons? It should be "Weapons" not "Weapon". I thought I fixed that. Also, of course, if you are playing in another language then you would translate "Weapons" and "Armor" to that language.
  • 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: Keep only clean HD items when selling items?

#14 Post by Giram »

I have english client. I fixed that typo and i now test how its working.

Code: Select all

if (i > 60 + settings.profile.options.INV_AUTOSELL_FROMSLOT - 1 and 60 + settings.profile.options.INV_AUTOSELL_TOSLOT + 1 > i) and (item:isType("Weapons") or item:isType("Armor")) then
edit: typo
edit: new typo and now it should be working well. It's keeping clean hd items and selling dirty items from right slots. Thank you so much Rock5 :)
I uploaded latest version from it.
Attachments
addon_expertsell.lua
(942 Bytes) Downloaded 122 times
User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: Keep only clean HD items when selling items?

#15 Post by Giram »

I have got this error few times when selling items: /addon_expertsell.lua:12: bad argument #1 to 'pairs' (table expected, got boolean). Any idea for fix?
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Keep only clean HD items when selling items?

#16 Post by rock5 »

Giram wrote:I have got this error few times when selling items: /addon_expertsell.lua:12: bad argument #1 to 'pairs' (table expected, got boolean). Any idea for fix?
getGameTooltip returns false if it fails to get the tooltip. You could do something like this.

Code: Select all

local tooltip_right
repeat tooltip_right = item:getGameTooltip("right") until tooltip_right
This will make sure you have a valid tooltip before proceeding.
  • 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
Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: Keep only clean HD items when selling items?

#17 Post by Mushroomstamp »

I want to keep all XI and XII gear regardless of dura, and all I-statted or clean, high-dura gear. Am I close?

Code: Select all

	if dura == nil then dura = 100 end
	inventory:update()
	if player:openStore(npcname) then -- open store
		for i, item in pairs(inventory.BagSlot) do -- for each item
			-- Only if equipment in bags
			if (item:isType("Weapons") or item:isType("Armor")) then
				local sellit = false
				local tooltip_right
				repeat tooltip_right = item:getGameTooltip("right") until tooltip_right -- get tooltip
				for i,tooltipline in pairs(tooltip_right) do
					if string.match(tooltipline,"XI,XII") then
						sellit = false
						break
					elseif item.Durability > dura then
						if string.match(tooltipline,"II,III,IV,V,VI,VII,VIII,IX,X") then
							sellit = true
							break
						end
						sellit = false
					end
				if sellit then
					item:use() -- sell it
				end
			end
		end
	end
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Keep only clean HD items when selling items?

#18 Post by rock5 »

It's a good effort but there are a few errors.

I was thinking of adding stat autosell options awhile ago so I can point out a few thinks for you.
1. The tooltip can sometimes return duplicate lines with the same stat but without the "|cffFFFFFF" prefix so you have to take that into account. This usually happens because of addons that lengthen the data on the line such as statrating. Actually it looks like it wouldn't matter to you if you got duplicate values.
2. string.match doesn't work that way and can take some time mastering.
3. Your sellit values are all over the place. Usually you would set sellit to true and then if it ends in XI, XII etc you set it to false or if it's is a clean HD then you set it to false.
4. If the item has 2 stats eg. XI and VI, then if the XI is first it wont sell but if the VI is first it will sell. So you need to decide which action you prefer and adjust the code to do it.

To return all stats that end in XI,XII,XIII etc you can use this

Code: Select all

if string.match(tooltipline,"XI+$") then
That should only match the stats that ends with 'X' and at least one 'I'.

To match any stat this should work.

Code: Select all

if string.match(tooltipline," [VXI]+$") then
That will match any line that ends in a space followed by any combination of X, V or I.

The version i've come up will is this.

Code: Select all

	if dura == nil then dura = 100 end
	inventory:update()
	if player:openStore(npcname) then -- open store
		for i, item in pairs(inventory.BagSlot) do -- for each item
			-- Only if equipment in bags
			if (item:isType("Weapons") or item:isType("Armor")) then
				local hasXI = false
				local hasDirty = false
				local tooltip_right
				repeat tooltip_right = item:getGameTooltip("right") until tooltip_right -- get tooltip
				
				for i,tooltipline in pairs(tooltip_right) do
					if string.match(tooltipline,"XI+$") then
						hasXI = true
					elseif string.match(tooltipline," [IVX]+$") then
						hasDirty = true
					end
				end

				local sellit = true
				if hasXI and not hasDirty then
					sellit = false
				elseif item.Durability > dura and
					 not hasXI and not hasDirty then
					sellit = false
				end

 				if sellit then
					item:use() -- sell it
				end
			end
		end
	end
This should sell all weapons and armor except ones with clean XI stats (ie. no lower stats) or clean hd items. Sorry for doing all the work for you but I'm really interrested in this as I still intend to add stat settings to autosell some day.

Note: this has not been tested.
  • 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
Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: Keep only clean HD items when selling items?

#19 Post by Mushroomstamp »

Rock, you kickass! I like to be able to understand the coding that's used and your pointers and explanations help immensely. I'll be testing this tomorrow hopefully and will post my findings afterward. 8-)
Post Reply