shopIgnore.Add

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Post Reply
Message
Author
User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

shopIgnore.Add

#1 Post by MiesterMan » Thu Jun 16, 2011 3:37 pm

I promised this to administrator ages ago and I'm not sure if it was already implemented or not but here it is.

~~~Tested after the patch. Working fine.~~~


Description: Add items to your INV_AUTOSELL_IGNORE list so they will be ignored when your bot goes to shops. This enables you to do it after the fact, in your waypoint files and such.

Syntax: shopIgnore.Add("Item Name");

Also Accepts:
  • "ore" - all ores, sands, nuggets, and ingots
  • "herb" - all herbs, bundles, saps, and extracts
  • "wood" - all woods, lumbers, timbers, and planks
  • "cook" - Pineapple, Lettuce, Celery, and Oriental Tea Leaves
  • "all" - all craft mats (my cooking list is limited to guild harvest drops)
  • tables - it's set up to accept tables as well
Examples of use:

Code: Select all

<onLoad>
      shopIgnore.Add("all");
      shopIgnore.Add("Spirit Herb Essence");
      shopIgnore.Add({"Item One","Item Two","Item Three"});
      _myTempTable = {"Pennies", "Nickels", "Dimes"};
      shopIgnore.Add(_myTempTable);
</onLoad>
V 1.1
The function is:

Code: Select all

shopIgnore = {}
shopIgnore.CRAFTMATS = {
	ORE = {"Ore", "Sand", "Nugget", "Ingot", "Flame Dust", 
		"Cyanide", "Rock Crystal", "Dark Crystal", "Frost Crystal", "Mithril", 
		"Abyss-Mercury", "Mica", "Mysticite"}, -- End MINING
	HERB = {"Bundle", "Sap", "Extract", "Mountain Demon Grass",
		"Rosemary", "Beetroot", "Bitterleaf", "Moxa", "Folian Nut",
		"Dusk Orchid", "Green Thistle", "Barsaleaf", "Moon Orchid",
		"Straw Mushroom","Sinners Palm", "Dragon Mallow", "Mirror Sedge",
		"Thorn Apple", "Goblin Grass"}, -- End HERBALISM
	COOK = {"Pineapple", "Lettuce", "Celery", "Oriental Tea Leaves"}, -- End COOKING
	WOOD = {"Timber", "Lumber", "Plank", "Ash Wood",
		"Chime Wood", "Willow Wood", "Stone Rotan Wood", "Maple Wood",
		"Oak Wood", "Redwood", "Pine Wood", "Dragon Beard Root Wood", 
		"Holly Wood", "Yew Wood", "Sagewood", "Tarslin Demon Wood",
		"Fairywood", "Ancient Spirit Oak", "Aeontree Wood"} -- End WOODCUTTING
	}
function shopIgnore.Add(_toadd)
	if not _toadd then _toadd = "all"; end; -- Default to all craft mats
	
	local _ignorelist = "";
	if not settings.profile.options.INV_AUTOSELL_IGNORE then
		settings.profile.options.INV_AUTOSELL_IGNORE = "";
	else
		_ignorelist = settings.profile.options.INV_AUTOSELL_IGNORE;
	end
	local function _checkIgnored(_item)
		if string.match(_ignorelist:lower(),_item:lower()) then
			cprintf(cli.lightblue,"%s is already in the Autosell ignore list.\n",_item)
			return true;
		else
			_ignorelist = _ignorelist .. "," .. _item;
			cprintf(cli.lightblue,"%s has been added to the Autosell ignore list.\n",_item)
			return true
		end
	end
	
	if type(_toadd) == "table" then
		for i,v in pairs(_toload) do
			if type(_toload[i]) ~= "string" then 
				cprintf(cli.red,"ERROR:  shopIgnore.Add(_toadd) Error, invalid value for _toadd[" .. i .. "]!\nERROR:  String expected, got %s\n",string.upper(type(_toadd)));
				break;
				return false;
			else
				_checkIgnored(_toload[i]);
			end
		end
		settings.profile.options.INV_AUTOSELL_IGNORE = _ignorelist;
		return true;
	end
	
	if type(_toadd) ~= "string" then
		cprintf(cli.red,"ERROR:  shopIgnore.Add(_toadd) Error, invalid value for _toadd!\nERROR:  String expected, got %s\n",string.upper(type(_toadd)));
		return false;
	end
	
	local dummyNumber;
	_toname, dummyNumber = _toadd:gsub("%s","");
	_toname, dummyNumber = _toname:gsub("%,","");
	
	local function _addOre()
		if not shopIgnore.addedOre then
			for i,v in pairs(shopIgnore.CRAFTMATS.ORE) do
				_ignorelist = _ignorelist .. "," .. shopIgnore.CRAFTMATS.ORE[i];
			end
			cprintf(cli.lightblue,"Ores have been added to the Autosell ignore list.\n")
			shopIgnore.addedOre = true;
		end
	end
	local function _addWood()
		if  not shopIgnore.addedWood then
			for i,v in pairs(shopIgnore.CRAFTMATS.WOOD) do
				_ignorelist = _ignorelist .. "," .. shopIgnore.CRAFTMATS.WOOD[i];
			end
			cprintf(cli.lightblue,"Woods have been added to the Autosell ignore list.\n")
			shopIgnore.addedWood = true;
			return true;
		end
		return false;
	end
	local function _addHerb()
		if not shopIgnore.addedHerb then
			for i,v in pairs(shopIgnore.CRAFTMATS.HERB) do
				_ignorelist = _ignorelist .. "," .. shopIgnore.CRAFTMATS.HERB[i];
			end
			cprintf(cli.lightblue,"Herbs have been added to the Autosell ignore list.\n")
			shopIgnore.addedHerb = true;
		end
	end
	local function _addCook()
		if not shopIgnore.addedCook then
			for i,v in pairs(shopIgnore.CRAFTMATS.COOK) do
				_ignorelist = _ignorelist .. "," .. shopIgnore.CRAFTMATS.COOK[i];
			end
			cprintf(cli.lightblue,"Cooking materials have been added to the Autosell ignore list.\n")
			shopIgnore.addedCook = true;
		end
	end

	if _toadd:lower == "all"  and not shopIgnore.addedCraftTable then
		_addOre();
		_addWood();
		_addHerb();
		_addCook();
		shopIgnore.addedCraftTable = true;
	elseif _toadd:lower() == "ore" then
		_addOre();
	elseif _toadd:lower() == "wood" then
		_addWood();
	elseif _toadd:lower() == "herb" then
		_addHerb();
	elseif _toadd:lower() == "cook" then
		_addCook();
	elseif not shopIgnore["added" .. _toname] then 
			_ignorelist = _ignorelist .. "," .. _toadd;
			shopIgnore["added" .. _toadd] = true;
	else
		return true;
	end
	settings.profile.options.INV_AUTOSELL_IGNORE = _ignorelist;
	return true;
end
You can replace the sub tables for ORE, WOOD, HERB, and COOK with your own. I also have an enumerated table I use for my mail functions but with all the pattern matching in the autosell function I'm afraid it will slow the script too much.

But if you want it:

Code: Select all

CRAFTMATS = {
	ORE = {"Zinc Ore", "Zinc Sand", "Zinc Nugget", "Zinc Ingot", 
		"Flame Dust", "Flame Dust Sand", "Flame Dust Nugget", "Flame Dust Ingot", 
		"Tin Ore", "Tin Sand", "Tin Nugget", "Tin Ingot", 
		"Cyanide", "Cyanide Sand", "Cyanide Nugget", "Cyanide Ingot", 
		"Iron Ore", "Iron Sand", "Iron Nugget", "Iron Ingot", 
		"Copper Ore", "Copper Sand", "Copper Nugget", "Copper Ingot", 
		"Rock Crystal", "Rock Crystal Sand", "Rock Crystal Nugget", "Rock Crystal Ingot", 
		"Dark Crystal", "Dark Crystal Sand", "Dark Crystal Nugget", "Dark Crystal Ingot", 
		"Mysticite", "Mysticite Sand", "Mysticite Nugget", "Mysticite Ingot", 
		"Silver Ore", "Silver Sand", "Silver Nugget", "Silver Ingot", 
		"Wizard-Iron Ore", "Wizard-Iron Sand", "Wizard-Iron Nugget", "Wizard-Iron Ingot", 
		"Mithril", "Mithril Sand", "Mithril Nugget", "Mithril Ingot", 
		"Moon Silver Ore", "Moon Silver Sand", "Moon Silver Nugget", "Moon Silver Ingot", 
		"Abyss-Mercury", "Abyss-Mercury Sand", "Abyss-Mercury Nugget", "Abyss-Mercury Ingot", 
		"Frost Crystal", "Frost Crystal Sand", "Frost Crystal Nugget", "Frost Crystal Ingot", 
		"Rune Obsidian Ore", "Rune Obsidian Sand", "Rune Obsidian Nugget", "Rune Obsidian Ingot", 
		"Mica", "Mica Sand", "Mica Nugget", "Mica Ingot"}, -- End MINING
	HERB = {"Mountain Demon Grass","Mountain Demon Grass Bundle","Mountain Demon Grass Sap","Mountain Demon Grass Extract", 
		"Rosemary","Rosemary Bundle","Rosemary Sap","Rosemary Extract", 
		"Beetroot","Beetroot Bundle","Beetroot Sap","Beetroot Extract", 
		"Bison Grass","Bison Grass Bundle","Bison Grass Sap","Bison Grass Extract", 
		"Bitterleaf","Bitterleaf Bundle","Bitterleaf Sap","Bitterleaf Extract", 
		"Moxa","Moxa Bundle","Moxa Sap","Moxa Extract", 
		"Foloin Nut","Foloin Nut Bundle","Foloin Nut Sap","Foloin Nut Extract", 
		"Dusk Orchid","Dusk Orchid Bundle","Dusk Orchid Sap","Dusk Orchid Extract", 
		"Green Thistle","Green Thistle Bundle","Green Thistle Sap","Green Thistle Extract", 
		"Barsaleaf","Barsaleaf Bundle","Barsaleaf Sap","Barsaleaf Extract", 
		"Moon Orchid","Moon Orchid Bundle","Moon Orchid Sap","Moon Orchid Extract", 
		"Straw Mushroom","Straw Mushroom Bundle","Straw Mushroom Sap","Straw Mushroom Extract", 
		"Sinners Palm","Sinners Palm Bundle","Sinners Palm Sap","Sinners Palm Extract", 
		"Dragon Mallow","Dragon Mallow Bundle","Dragon Mallow Sap","Dragon Mallow Extract", 
		"Mirror Sedge","Mirror Sedge Bundle","Mirror Sedge Sap","Mirror Sedge Extract", 
		"Thorn Apple","Thorn Apple Bundle","Thorn Apple Sap","Thorn Apple Extract", 
		"Goblin Grass","Goblin Grass Bundle","Goblin Grass Sap","Goblin Grass Extract"}, -- End HERBALISM
	COOK = {"Pineapple", "Lettuce", "Celery", "Oriental Tea Leaves"}, -- End COOKING
	WOOD = {"Ash Wood", "Ash Timber", "Ash Lumber", "Ash Plank", 
		"Chime Wood", "Chime Wood Timber", "Chime Wood Lumber", "Chime Wood Plank", 
		"Willow Wood", "Willow Timber", "Willow Lumber", "Willow Plank", 
		"Stone Rotan Wood", "Stone Rotan Timber", "Stone Rotan Lumber", "Stone Rotan Plank", 
		"Maple Wood", "Maple Timber", "Maple Lumber", "Maple Plank", 
		"Oak Wood", "Oak Timber", "Oak Lumber", "Oak Plank", 
		"Redwood", "Redwood Timber", "Redwood Lumber", "Redwood Plank", 
		"Pine Wood", "Pine Timber", "Pine Lumber", "Pine Plank", 
		"Dragon Beard Root Wood", "Dragon Beard Root Timber", "Dragon Beard Root Lumber", "Dragon Beard Root Plank", 
		"Holly Wood", "Holly Timber", "Holly Lumber", "Holly Plank", 
		"Yew Wood", "Yew Timber", "Yew Lumber", "Yew Plank", 
		"Sagewood", "Sagewood Timber", "Sagewood Lumber", "Sagewood Plank", 
		"Tarslin Demon Wood", "Tarslin Demon Wood", "Tarslin Demon Wood", "Tarslin Demon Wood", 
		"Dragonlair Wood", "Dragonlair Wood", "Dragonlair Wood", "Dragonlair Wood", 
		"Fairywood", "Fairywood Timber", "Fairywood Lumber", "Fairywood Plank", 
		"Ancient Spirit Oak Wood", "Ancient Spirit Oak Timber", "Ancient Spirit Oak Lumber", "Ancient Spirit Oak Plank", 
		"Aeontree Wood", "Aeontree Timber", "Aeontree Lumber", "Aeontree Plank"} -- End WOODCUTTING
	}
Last edited by MiesterMan on Fri Jul 22, 2011 1:15 pm, edited 4 times in total.

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: shopIgnore.Add

#2 Post by MiesterMan » Fri Jun 17, 2011 7:56 am

V 1.0 - It's new!
V 1.1 -
  • Mispelled Foloin Nut (was Folian Nut) in ignore table, corrected

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest