Page 1 of 1

adding to INV_AUTOSELL_IGNORE in onLoad, keep failing

Posted: Tue Sep 28, 2010 6:15 pm
by MiesterMan
Ok, so to make using waypoint files smoother for my characters I wanted to add the ignore info to the waypoint file's onLoad but I can't seem to get it right. Here's what I've got so far:

Code: Select all

		local currentIgnoreList = settings.profile.options.INV_AUTOSELL_IGNORE
		if not currentIgnoreList then
			settings.profile.options.INV_AUTOSELL_IGNORE = "Sweet Home Alabama"
		end
		if settings.profile.options.HEALING_POTION then
			settings.profile.options.INV_AUTOSELL_IGNORE = currentIgnoreList .. ",Spirit Herb,Infinite Herb"
			currentIgnoreList = settings.profile.options.INV_AUTOSELL_IGNORE
		end
		if settings.profile.options.MANA_POTION then
			settings.profile.options.INV_AUTOSELL_IGNORE = currentIgnoreList .. ",Elemental Spirit Stone,Infinite Elemental Stone"
			currentIgnoreList = settings.profile.options.INV_AUTOSELL_IGNORE
		end
		if settings.profile.options.ARROW_QUIVER then
			settings.profile.options.INV_AUTOSELL_IGNORE = currentIgnoreList .. ",Gunpowder Arrow, Kerl's Mechanical Arrow"
			currentIgnoreList = settings.profile.options.INV_AUTOSELL_IGNORE
		end
		if settings.profile.options.THROWN_BAG then
			settings.profile.options.INV_AUTOSELL_IGNORE = currentIgnoreList .. ",Assasin's Blade,Iron Rose"
			currentIgnoreList = settings.profile.options.INV_AUTOSELL_IGNORE
		end
		if settings.profile.options.POISON then
			if player.Class1 == "ROGUE" then
				settings.profile.options.INV_AUTOSELL_IGNORE = currentIgnoreList .. ",Poison Bottle"
			elseif player.Class1 == "DRUID then
				settings.profile.options.INV_AUTOSELL_IGNORE = currentIgnoreList .. ",Poison Powder"
			end
			currentIgnoreList = settings.profile.options.INV_AUTOSELL_IGNORE
		end
If anyone know how I can concatenate or add the info please let me know. This would make using my waypoint files sooo much easier.

Edit: Oh yea, my reason for doing this. If I can add this info then I don't have to keep updating the profiles with all the different things to ignore. I can reinitialize profile info and have this info added by reloading the new waypoint files. Would make everything so much smoother if I could dicatate this info in the waypoint file.

Re: adding to INV_AUTOSELL_IGNORE in onLoad, keep failing

Posted: Tue Sep 28, 2010 7:16 pm
by Administrator

Code: Select all

local ignoreList = {};

if( something ) then
  table.insert(ignoreList, "Some Item");
end

if( somethingElse ) then
  table.insert(ignoreList, "Some Other Item");
end


for i,v in pairs(ignoreList) do
  settings.profile.options.INV_AUTOSELL_IGNORE = settings.profile.options.INV_AUTOSELL_IGNORE .. "," .. v;
end

Or you could also do it like this:

Code: Select all

local function addIgnoreItem(name)
  settings.profile.options.INV_AUTOSELL_IGNORE = settings.profile.options.INV_AUTOSELL_IGNORE .. "," .. name;
end

if( something ) then
  addIgnoreItem("Some Item");
end

Re: adding to INV_AUTOSELL_IGNORE in onLoad, keep failing

Posted: Tue Sep 28, 2010 11:25 pm
by MiesterMan
Ah, I see, tyvm. I guess I never really worked with tables before.

Edit: By chance is there a way to check if the items have already been added? How would I write the if statement?

Edit2: Ah, nm, I just came up with something.