Dear friends, i came here to show to yours my persistent for don't lost valuable items when don't have cap.
This persistent works like that.
Items = Here you will put the items that you want to take if no have cap. IgnoredItems = Here you will put the items that you want to throw away if no have cap.
This Configuration is for 'Giant Spider' and 'Mutated Bat'.
Note: With this persistent you can loot all itens increasing profit, and don't be afraid if no have cap to take the valuable items.
An little bit of the code i take from an user in this forum, i don't remember who but Credits for him.
Don't know if is @Leonardo or @Raphael.
--Anti-LostItems By Sajean
init start
local lootBp = 'blue backpack'
Items = {'batwing hat','spider silk','platinum amulet','lightning headband','mercenary sword','knight legs','knight armor','black shield'}
IgnoredItems = {'battle shield','plate legs','steel helmet','two handed sword','plate armor','obsidian lance'}
init end
auto(100)
foreach newmessage m do
if m.type == MSG_INFO then
local Monster, Loot = m.content:match(REGEX_LOOT)
if Monster and (Loot ~= 'nothing') then
Monster = Monster:gsub('the ', '', 1)
for _, Item in ipairs(Items) do
if Loot:find(Item) then
if($cap < iteminfo(Item).weight)then
setsetting('Looting/Enabled', 'no')
pausewalking(2000)
while $cap < iteminfo(Item).weight do
wait(800,1000)
if($cap >= iteminfo(Item).weight)then
break
else
for _, IgnoredItem in ipairs(IgnoredItems) do
if($cap >= iteminfo(Item).weight)then
break
else
moveitems(IgnoredItem,ground($posx,$posy,$posz),lootBp)
end
end
end
end
setsetting('Looting/Enabled', 'yes')
pausewalking(0)
end
if(not $looting)then
setsetting('Looting/Enabled', 'yes')
end
end
end
end
end
end
11-12-2014, 03:46 PM
Raphael
Please use REGEX_LOOT instead of 'Loot of a?n? (.+): (.+)'.
This ensures your code is forward compatible.
11-12-2014, 04:12 PM
Sajean
Quote:
Originally Posted by Raphael
Please use REGEX_LOOT instead of 'Loot of a?n? (.+): (.+)'.
This ensures your code is forward compatible.
Nice to know :).
11-12-2014, 05:01 PM
Borges
@Sajean, nice code, but to not get as manual writing all items, why you don't use categories?
local items= 'abc'
local ignore= 'c'
foreach lootingitem m items do
foreach lootingitem m ignore do
the code will be smaller and configured only in looting section.
just a idea. good job
11-12-2014, 05:07 PM
Sajean
Quote:
Originally Posted by borges
@Sajean, nice code, but to not get as manual writing all items, why you don't use categories?
local category = 'ab'
foreach lootingitem m category do
the code will be smaller and configured only in looting section.
just a idea. good job
I had thought about it more this way you will need to have three categories for items.
So will have to change its function of deposit, putting this category the most.
Like that.
Category r = rare itens but not valuable
Category s = stack itens
Category v = rare itens and valuable itens