View Full Version : Loot = Sound
Elizabeth
03-29-2016, 01:17 AM
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"
kamilqq
03-29-2016, 01:29 AM
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"
i could do it tomorrow if noone will help you :)
Elizabeth
03-29-2016, 02:48 AM
i could do it tomorrow if noone will help you :)
Ok, i wait :)
krille09
03-29-2016, 03:12 AM
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
Jontor
03-29-2016, 09:42 AM
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
items = {
["royal helmet"] = 1,
["shard"] = 10
}
Anyways, I'd do both like:
-- 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)
shadowart
03-29-2016, 09:47 AM
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.
kamilqq
03-29-2016, 09:48 AM
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
Jontor
03-29-2016, 09:58 AM
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
Elizabeth
03-30-2016, 11:02 PM
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
items = {
["royal helmet"] = 1,
["shard"] = 10
}
Anyways, I'd do both like:
-- 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)
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.
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
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?
Jontor
03-31-2016, 04:55 AM
Elizabeth
This one should alert on every item drop
local items = {"royal helmet", "shard"}
LootMessageProxy.OnReceive("", function(proxy, message)
if (table.find(items, string.lower(message)) then
alert()
end
end)
Elizabeth
04-02-2016, 08:11 PM
Elizabeth
This one should alert on every item drop
local items = {"royal helmet", "shard"}
LootMessageProxy.OnReceive("", function(proxy, message)
if (table.find(items, string.lower(message)) then
alert()
end
end)
22:08 XenoScript Error:
Error: ')' expected near 'then'
This is an error with user-input and should not be reported as a bug with XenoBot.
What wrong with this script?:
if (table.find(items, string.lower(message)) then
Elvang
04-02-2016, 08:23 PM
22:08 XenoScript Error:
Error: ')' expected near 'then'
This is an error with user-input and should not be reported as a bug with XenoBot.
What wrong with this script?:
if (table.find(items, string.lower(message)) then
Count the brackets, there is three opening brackets and only two closing brackets.
kamilqq
04-02-2016, 09:40 PM
22:08 XenoScript Error:
Error: ')' expected near 'then'
This is an error with user-input and should not be reported as a bug with XenoBot.
What wrong with this script?:
if (table.find(items, string.lower(message)) then
Reading errors is really important and really not that hard. :D The error message is telling you exacly what is going on.
Elizabeth
04-02-2016, 11:08 PM
kamilqq Elvang
I tries and don't work...
Sheradial
04-02-2016, 11:23 PM
kamilqq Elvang
I tries and don't work...
local items = {"royal helmet", "shard"}
LootMessageProxy.OnReceive("", function(proxy, message))
if (table.find(items, string.lower(message))) then
alert()
end
end)
Elizabeth
04-02-2016, 11:46 PM
local items = {"royal helmet", "shard"}
LootMessageProxy.OnReceive("", function(proxy, message))
if (table.find(items, string.lower(message))) then
alert()
end
end)
Ok, now added, but script still dont work. I just looting Royal Helmet, but sound didnt open ;s
krille09
04-03-2016, 12:24 AM
Are you playing OT ?
Jontor
04-03-2016, 08:27 PM
Elizabeth
I fked up, try this one
local items = {"royal helmet", "shard"}
LootMessageProxy.OnReceive("", function(proxy, message))
for i = 1, #items do
if (string.find(string.lower(message), string.lower(items[i]))) then
alert()
end
end
end)
Elizabeth
04-05-2016, 01:17 AM
Elizabeth
I fked up, try this one
local items = {"royal helmet", "shard"}
LootMessageProxy.OnReceive("", function(proxy, message))
for i = 1, #items do
if (string.find(string.lower(message), string.lower(items[i]))) then
alert()
end
end
end)
Finally work!
Thank U my master :P.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.