Posts: 5
Threads: 3
Joined: Oct 2022
Reputation:
0
Im trying to make a script to use Loot Seller (its a item) in a list of itens (loot).
The items are inside the corpses, but it wouldn't be a problem to move them to the backpack if necessary.
I tried this but it didn't work
local Loot_Seller = 23722 -- Loot Seller id.
local Itens = { 'Viking Helmet','Sword','Mace','Brass Helmet','Brass Shield' }
local containers = getcontainers()
for _, cont in ipairs(containers) do
for __, item in ipairs(cont.items) do
if item.name == Itens then
useitemonitem(Loot_Seller, item.index, cont.index)
wait(500, 800)
return
end
end
end
Posts: 1
Threads: 0
Joined: Sep 2021
Reputation:
0
Posts: 2,545
Threads: 423
Joined: Jul 2018
Reputation:
68
07-26-2023, 11:00 PM
(This post was last modified: 07-27-2023, 02:39 AM by Arkilys.)
local Loot_Seller = 23722 -- Loot Seller id.
local Items = { 'Viking Helmet','Sword','Mace','Brass Helmet','Brass Shield' }
if connected() then
local containers = getcontainers()
for _, cont in ipairs(containers) do
for __, item in ipairs(cont.items) do
if table.find(Items, item.name) ~= nil then
useitemonitem(Loot_Seller, item.id, cont.index)
wait(500, 800)
return
end
end
end
end
The solution is ideal for common items, but not good for custom items, because may not know its name. So i've applied changes to make it work with item names and ids. So you can add item names and ids to Items table. I recommend to use Ids, because it will never be wrong.
local Loot_Seller = 23722 -- Loot Seller id.
local Items = { 'Viking Helmet','Sword','Mace','Brass Helmet','Brass Shield' }
if connected() then
table.id(Items)
local containers = getcontainers()
for _, cont in ipairs(containers) do
for __, item in ipairs(cont.items) do
if table.find(Items, item.id) ~= nil then
useitemonitem(Loot_Seller, item.id, cont.index)
wait(500, 800)
return
end
end
end
end
Posts: 5
Threads: 3
Joined: Oct 2022
Reputation:
0
|Only Registered members can see download links. | Click here to buy subscription or here to register.
22:48:23 - LUA Script -> Persistent01: 12: unexpected symbol near '.'
Probably on useitemonitem(Loot_Seller, item.id, .index, cont.index)
Posts: 2,545
Threads: 423
Joined: Jul 2018
Reputation:
68
Posts: 4
Threads: 0
Joined: Jul 2022
Reputation:
0
LUA Script -> Console: 11: unexpected symbol near '.'
getting this trying to run this scrtipt
Posts: 2,545
Threads: 423
Joined: Jul 2018
Reputation:
68
|Only Registered members can see download links. | Click here to buy subscription or here to register.which one mate? there are 2 scripts. it's likely that you ran a script that murilodombeck quoted, not from my post.
Posts: 4
Threads: 0
Joined: Jul 2022
Reputation:
0
|Only Registered members can see download links. | Click here to buy subscription or here to register.
I dont get the error message anymore but the script doesn't do anything when I run it
Posts: 2
Threads: 0
Joined: Jul 2023
Reputation:
0
08-06-2023, 05:43 PM
(This post was last modified: 08-06-2023, 05:43 PM by Kuken123456.)
works perfectly for me, only issue is 2 problems. if the interval is too high then the bot will open bags and script wont have time to use the seller on the item, on the other hand if its too low then the bot will accidentally pick up bags while trying to loot gp/sell the item. any suggestion on proper interval? thanks for the script! great service as always Arkilys!
Posts: 2,545
Threads: 423
Joined: Jul 2018
Reputation:
68
08-07-2023, 03:24 AM
(This post was last modified: 08-07-2023, 03:25 AM by Arkilys.)
Honestly, i think the only safe way is to let Bot loot the items then use loot seller. I will think about the idea of adding an option on Looter to use item on loot on Action field, so Looter options will be enough for you needs.
You can use the same script, but adding another validation islooting()... So the script will only sell items when Bot is not currently looting.
Replace:
with
if connected() and islooting() == false then
Example:
local Loot_Seller = 23722 -- Loot Seller id.
local Items = { 'Viking Helmet','Sword','Mace','Brass Helmet','Brass Shield' }
if connected() and islooting() == false then
local containers = getcontainers()
for _, cont in ipairs(containers) do
for __, item in ipairs(cont.items) do
if table.find(Items, item.name) ~= nil then
useitemonitem(Loot_Seller, item.id, cont.index)
wait(500, 800)
return
end
end
end
end
|