Signup Now
Results 1 to 5 of 5

Thread: Valuable Items

  1. #1
    Free User Sajean's Avatar
    Join Date
    Feb 2014
    Posts
    386
    Reputation
    26
    Rep Power
    21

    Valuable Items

    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
    Last edited by Sajean; 11-12-2014 at 04:11 PM.

  2. #2
    Moderator Raphael's Avatar
    Join Date
    Dec 2013
    Location
    raphseller.com
    Posts
    2,441
    Reputation
    309
    Rep Power
    28
    Please use REGEX_LOOT instead of 'Loot of a?n? (.+): (.+)'.
    This ensures your code is forward compatible.

  3. #3
    Free User Sajean's Avatar
    Join Date
    Feb 2014
    Posts
    386
    Reputation
    26
    Rep Power
    21
    Quote Originally Posted by Raphael View Post
    Please use REGEX_LOOT instead of 'Loot of a?n? (.+): (.+)'.
    This ensures your code is forward compatible.
    Nice to know .

  4. #4
    Free User Borges's Avatar
    Join Date
    Feb 2014
    Location
    Brazil
    Posts
    1,469
    Reputation
    205
    Rep Power
    25
    @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
    Last edited by Borges; 11-12-2014 at 05:04 PM.
    Helped you? REP+

  5. #5
    Free User Sajean's Avatar
    Join Date
    Feb 2014
    Posts
    386
    Reputation
    26
    Rep Power
    21
    Quote Originally Posted by borges View Post
    @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

    depotaction('maindpbp', 'lootbp', {'rv', 'raredpbp', 's', 'stackdpbp'}
    Last edited by Sajean; 11-12-2014 at 05:12 PM.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •