Page 1 of 1

Question about spaces in INV_AUTOSELL_IGNORE

Posted: Sat Mar 27, 2010 7:55 am
by rock5
It was my understanding that if I use this;

Code: Select all

<option name="INV_AUTOSELL_IGNORE"	value=" V, IV, III,Power II,Endurance II,Resistance II,Elemental Spirit Stone,Spirit Herb" />
then item names with " V" and " IV" wont sell but names with "V" and "IV" will sell.

Am I wrong? Because I have a "Protective Dagger" and it wont sell unless I remove the " V, IV" options.

If so, is there a way to make it work?

Re: Question about INV_AUTOSELL_IGNORE

Posted: Sat Mar 27, 2010 9:43 am
by unicron
That is for names, you want this one for stats. Here you can use mine. Add to it whatever.

Code: Select all

<option name="INV_AUTOSELL_STATS_NOSELL" value="X, Authority, Rigor, Endurance, Oppresion, Cougar, Savage, Force, Barbarian, Hammer, Fang, Keen, Observance, Paladin, Defender, Reflex, Agility, Thunder, Illumine, Darkness, Mind, Mystic, Warlock, Soul, Shield, Sage, Blood, Rage, Precision, Speed, Fox, Crystal, Savant, Armor, Assault, Aureola, Bite, Blaze, Break, Constraint, Cruel, Dedication, Elder, Eruption, Excellence, Fright, Genius, Glory, Guard, Gulp, Inhibition, Inquisition, Mage, Mirage, Pioneer, Prophet, Ravage, Razor, Redemption, Repentance, Return, Slaughter, Speculation, Suppression, Surrender, Trial, Whip, Witt, of the Lost" />
.. also don't forget you may want to put in.

Code: Select all

<option name="INV_AUTOSELL_QUALITY" value="white,green" />
Unless you want to keep green quality items.

Re: Question about INV_AUTOSELL_IGNORE

Posted: Sat Mar 27, 2010 10:14 am
by rock5
I know it's for names. I use it to stop selling runes. eg. Endurance III, Power IV, etc

So can you please answer the question? Are leading spaces included? If not, is there a way I could include it? Maybe some sort of wild-card or pattern option?

ps. Nice stat list.

Re: Question about INV_AUTOSELL_IGNORE

Posted: Sat Mar 27, 2010 11:06 am
by unicron
I do not know if ", V" (double space) Would work vs ", V". (single space) You could try it though. I just throw in each item in my list individually. It is a pain, but it only needs to be done once.

Re: Question about INV_AUTOSELL_IGNORE

Posted: Sat Mar 27, 2010 12:47 pm
by Administrator
I believe leading spaces are counted. If not, let me know.

Re: Question about INV_AUTOSELL_IGNORE

Posted: Sat Mar 27, 2010 1:23 pm
by rock5
At first I couldn't work out where the spaces were being removed but then I broke down the code and did some testing and found the problem line. Line 347 of inventory.lua

Code: Select all

local hf_explode = string.gsub (settings.profile.options.INV_AUTOSELL_IGNORE, "%s*[;,]%s*", "\n");	-- replace ; with linefeed
A simple fix for me would be to remove the %s* from the pattern but I realize that it is working as intended.

Your idea of using double space is a good one though. At the moment the pattern removes all spaces. If you replace the * with a ? then it will only remove 1 space so you can use the double space idea. So the pattern would look like this "%s?[;,]%s?". I've tested it and it works.

So to recap. With my fix;
if you don't use leading spaces it works,
if you use leading or ending spaces to space out your list they get removed and it works,
if you want to match a leading space you use a double space so 1 of them gets removed and it works.

What do you think?

ps. The reason you might think it works is because it doesn't remove the leading space from the first name as it is not next to a comma. If you put a name with a leading space in the middle of your list it will remove the space.

Re: Question about INV_AUTOSELL_IGNORE

Posted: Sat Mar 27, 2010 5:47 pm
by Administrator
Sounds good to me. A better option might be to use an escape character or sequence, like "[SPACE]Itemname".

I'll wait before implementing this to give people a chance to test it further and get some more input.

Re: Question about spaces in INV_AUTOSELL_IGNORE

Posted: Sat Mar 27, 2010 9:33 pm
by rock5
Administrator wrote:Sounds good to me. A better option might be to use an escape character or sequence, like "[SPACE]Itemname".
Maybe. But maybe using anything but spaces would not be intuitive.
Administrator wrote:I'll wait before implementing this to give people a chance to test it further and get some more input.
It's a fairly small change. I think most people wont even notice. Maybe you wont get much feedback unless you ask them for it?

Hold on a second. I was just thinking about making the same changes to INV_AUTOSELL_STATS_SELL and INV_AUTOSELL_STATS_NOSELL but they use a different pattern.

Seems to me the proper programming behavior should have them behaving similarly for better consistency. If "[;,]" is good enough for these 2 variables why not use it with INV_AUTOSELL_IGNORE? I don't see any reason why it should be different and it would be the simplest fix.

That way, exactly what you type is exactly what it matches for. Just like the stats variables.

What do you think