Hey, i need two scripts:
- When i looting items like "Royal Helmet and "Shard" my bot play alarm.
- When my character stand 40 sec walker.goto label "stay"
Printable View
Hey, i need two scripts:
- When i looting items like "Royal Helmet and "Shard" my bot play alarm.
- When my character stand 40 sec walker.goto label "stay"
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 :D Been working all day with tables might aswell do this :D
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
Anyways, I'd do both like:Code:items = {
["royal helmet"] = 1,
["shard"] = 10
}
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)
I don't see why you're involving some arbitrary count in the loot checker. I'd use a LootMessageProxy to alarm when it drops instead. Can't code from this device though.
Why you guys doin it by counting items?
Just use LootProxy to receive message of item needed.
Also Jontor come my thread and answer + teach me to code.
EDIT:
I see im synchronized with shadowart :D
Thing is that @Elizabeth mentioned 'shard' as an item to play an alert. but I assume it's not like you want to hear this annoying alarm everytime you loot a 2k gold worth item
Thx for efforts, but this is not work :(
I write about script loot - alert.
The script plays a sound every 10 seconds non stop, even when i dont looted.
No, i changed this scary alarm for other xd
I want, that script play alarm always when i droped "shard" or "royal helmet"
This is possible?
@Elizabeth
This one should alert on every item drop
Code:local items = {"royal helmet", "shard"}
LootMessageProxy.OnReceive("", function(proxy, message)
if (table.find(items, string.lower(message)) then
alert()
end
end)