Page 1 of 1

Item Delete

Posted: Mon Dec 17, 2012 1:54 am
by mrtgtr
I used lootomatic but that addon is problem while go to char slection screen or escape to the game, game is crushed and item drop list will not be save.

I want to delete cheap items from 1200 gold ,arrows, Projectiles ,Crafting Runes, Runes with bot.

It didnt work, It didint delete -_-

Code: Select all

            if item:isType("Arrows") then
               item:delete()
            end
            if item:isType("Projectiles") then
               item:delete()
            end
            if ( item:isType("Weapons") or item:isType("Armor") ) and (1200 > item.Worth and 5 > item.Quality)then
               item:delete()
            end
            if item:isType("Runes") then
               item:delete()
            end
     

Re: Item Delete

Posted: Mon Dec 17, 2012 12:38 pm
by lolita
try this

Code: Select all

function CleanBag()
			for i, item in pairs(inventory.BagSlot) do
				if item.SlotNumber >= settings.profile.options.INV_AUTOSELL_FROMSLOT + 60 and
				settings.profile.options.INV_AUTOSELL_TOSLOT + 60 >= item.SlotNumber then
					if item:isType("Arrows") then
						item:delete()
					end
					if item:isType("Projectiles") then
						item:delete()
					end
					if item:isType("Runes") then 
						item:delete()
					end
					if ( item:isType("Weapons") or item:isType("Armor") ) and (1200 > item.Worth and 3 > item.Quality) then
						item:delete()
					end
					if item:isType("Potions") and (46 > item.RequiredLvl and item.RequiredLvl > 10) then
						item:delete()
					end
				end
			end
		end

Re: Item Delete

Posted: Mon Dec 17, 2012 6:31 pm
by mrtgtr
lolita wrote:try this

Code: Select all

function CleanBag()
			for i, item in pairs(inventory.BagSlot) do
				if item.SlotNumber >= settings.profile.options.INV_AUTOSELL_FROMSLOT + 60 and
				settings.profile.options.INV_AUTOSELL_TOSLOT + 60 >= item.SlotNumber then
					if item:isType("Arrows") then
						item:delete()
					end
					if item:isType("Projectiles") then
						item:delete()
					end
					if item:isType("Runes") then 
						item:delete()
					end
					if ( item:isType("Weapons") or item:isType("Armor") ) and (1200 > item.Worth and 3 > item.Quality) then
						item:delete()
					end
					if item:isType("Potions") and (46 > item.RequiredLvl and item.RequiredLvl > 10) then
						item:delete()
					end
				end
			end
		end

I want to delete from slot 7 to slot 30 ?

and it didnt work, I must put something in rom\userfunctions folder ?

Re: Item Delete

Posted: Mon Dec 17, 2012 6:36 pm
by lisa
*Looks for the post I made about starting with the basics*

INV_AUTOSELL_FROMSLOT is in the profile and is the absolute basics of starting to work with this bot, I wish people would listen.

Re: Item Delete

Posted: Thu Dec 20, 2012 10:47 am
by botje
hmm, i like that potion thingy there, i would like to drop all useless potions because i can use better ones.

Code: Select all

if item:isType("Potions") and (player:level + 10 > item.RequiredLvl and item.RequiredLvl > 10) then
     item:delete()
end
would that work?

Re: Item Delete

Posted: Thu Dec 20, 2012 11:43 am
by botje

Code: Select all

elseif item:isType("Potions") and item.RequiredLvl < player.Level - 10 then
				 item:delete()
			end
that works :P

Re: Item Delete

Posted: Thu Dec 20, 2012 1:55 pm
by lolita
cod i posted work's fine for me, on blend and activate runes farm alt's :)

Re: Item Delete

Posted: Thu Dec 20, 2012 1:56 pm
by botje
yes but yours is made with a fixed level, mine is determined by player.level xd

Re: Item Delete

Posted: Thu Dec 20, 2012 1:58 pm
by lolita
ye, tru, that's better :lol: , think im gona use it too :P

Re: Item Delete

Posted: Thu Dec 20, 2012 1:59 pm
by botje
i included it in my cleanbag function too, its nifty code ^^

great for alts :P

Re: Item Delete

Posted: Thu Dec 20, 2012 5:49 pm
by lisa
yep it is very handy code, looks familiar too ;)

Re: Item Delete

Posted: Mon Dec 24, 2012 8:33 am
by lolita
how to make table of items for delete and use it from function.
something like this?

Code: Select all

local DeleteItem = {
	[111222]	= true,
	[112211]	= false,
	[221122]	= true,
	[121212]	= true,
	[212121]	= false,
	[221111]	= true,
	}
function ClearBag()
	local empties = inventory:itemTotalCount(0)
	if 10 > empties then
		item:delete(DeleteItem)
	end
end

Re: Item Delete

Posted: Mon Dec 24, 2012 8:56 am
by botje
lol... i was doing the exact same thing... xd

wanted to make a sort of database with items users can add to always delete.

Code: Select all

for k, v in ipairs(forcedrop) do
				if v == item.Name then
					item:delete();
				end
			end
would this work?

Re: Item Delete

Posted: Mon Dec 24, 2012 6:26 pm
by botje

Code: Select all

-- custom database for user added items to trow out
	forcedrop = {
		"Unknown Gift",
		"Lost Gift",
		"Sled Fragment",
	}

for k, v in ipairs(forcedrop) do
				if v == item.Name then
					printf("Deleting Item:  "..item.Name.."\n");
					item:delete();
				end
			end
this code works ^^

Re: Item Delete

Posted: Wed Dec 26, 2012 6:36 am
by lolita
botje wrote:

Code: Select all

-- custom database for user added items to trow out
	forcedrop = {
		"Unknown Gift",
		"Lost Gift",
		"Sled Fragment",
	}

for k, v in ipairs(forcedrop) do
				if v == item.Name then
					printf("Deleting Item:  "..item.Name.."\n");
					item:delete();
				end
			end
this code works ^^
hm, idk how work for you :?: , but it give me an error

Code: Select all

attempt to index global 'item' (a nil value)

Re: Item Delete

Posted: Wed Dec 26, 2012 6:47 am
by botje

Code: Select all

-- sell prize = value which drops all below it
-- rarity = / 0 = white / 1 = green / 2 = blue / 3 = purple / 4 = orange / 5 = gold
-- drop true/false = if allready learned recipes should be dropped
function CleanBag(sellprize, rarity, drop, logg)
	inventory:update();
	
	-- custom database for user added items to trow out
	forcedrop = {
		"Unknown Gift",
		"Lost Gift",
		"Sled Fragment",
	}
	
	if sellprize == nil then sellprize = 750 end;
	if rarity == nil then rarity = 1 end;
	if drop == nil then drop = false end;
	if logg == nil then logg = true end;
	
	for i, item in pairs(inventory.BagSlot) do
		if item.SlotNumber >= settings.profile.options.INV_AUTOSELL_FROMSLOT + 60 and
		settings.profile.options.INV_AUTOSELL_TOSLOT + 60 >= item.SlotNumber then
		
			for k, v in ipairs(forcedrop) do
				if v == item.Name then
					printf("Deleting Item:  "..item.Name.."\n");
					item:delete();
				end
			end
			
			if (item:isType("Weapons") or item:isType("Armor")) and sellprize > item.Worth and item.Quality < rarity then
				printf("Deleting Item:  "..item.Name.."\n");
				if logg == true then
					logInfo("CleanBag", "" ..player.Name.. ": Deleted: " ..item.Name.. "." , true)
				end
				item:delete();
			elseif item:isType("Recipes") then
				if RoMScript("GetCraftItemInfo("..item.Id..")") == nil and item.Quality < rarity then -- Don't have it
					printf("Learning recipe:  "..item.Name.."\n");
					if logg == true then
						logInfo("LearnRecipe", "" ..player.Name.. ": Learning recipe:  " ..item.Name.. "." , true);
					end
					item:use();
					yrest(5000);
				else
					if drop == true and item.Quality < rarity then
						printf("Deleting Recipe:  "..item.Name.."\n");
						if logg == true then
							logInfo("LearnRecipe", "" ..player.Name.. ": Deleting recipe:  " ..item.Name.. "." , true);
						end
						item:delete();
					end
				end
			elseif item:isType("Monster Cards") then
				if not haveCard(item.Id) then
					printf("Using card:  "..item.Name.."\n");
					if logg == true then
						logInfo("UseCard", "" ..player.Name.. ": Using card:  " ..item.Name.. "." , true);
					end
					item:use();
					yrest(5000);
				end
			elseif item:isType("Potions") and item.RequiredLvl < player.Level - 10 then
				 item:delete()
			elseif item:isType("Runes") then
				item:delete()
            end
		end
	end
end

Re: Item Delete

Posted: Wed Dec 26, 2012 7:04 am
by lolita
lol, i forget to add

Code: Select all

for i, item in pairs(inventory.BagSlot) do
thx botje it work now lika charm

Re: Item Delete

Posted: Wed Dec 26, 2012 7:09 am
by botje
no problem :)