
Originally Posted by
krille09
lua code:
items = {
{item = "royal helmet", count = 1},
{item = "shard", count = 10}
}
Module.New("loot alerter", function(mod)
for item, count in pairs(items) do
if (Self.ItemCount(items.item) >= items.count) then
alert()
mod:Delay(5000)
end
end
end)
Not tested

Been working all day with tables might aswell do this

Your 'for item, count in pairs(items) do' actually returns the index and table, so you'd need another loop or changing the table layout to something like this
Code:
items = {
["royal helmet"] = 1,
["shard"] = 10
}
Anyways, I'd do both like:
Code:
-- alarmDelay is in seconds
local loot = {
{name = "royal helmet", count = 1, alarmDelay = 10},
{name = "shard", count = 10, alarmDelay = 60}
}
Module.New("countLoot", function(mod)
for i = 1, #loot do
if (Self.ItemCount(loot[i].name) >= loot[i].count) then
alert()
mod:Delay(loot[i].alarmDelay * 1000)
end
end
end)
local positions = {}
Module.New("posChecker", function(mod)
table.insert(positions, {pos = Self.Position(), time = os.time()})
local _pos = Self.Position()
for i = 1, #positions do
if (os.difftime(os.time(), positions[i].time) >= 45) then
if (positions[i].pos.x == _pos.x and positions[i].pos.y == _pos.y and positions[i].pos.z == _pos.z) then
alert()
Walker.Goto("stay")
positions = {}
break
else
table.remove(positions, i)
break
end
end
end
mod:Delay(5000)
end)