My guild uses OpenDKP and I wanted to write a Lua to automatically upload loot for auction on raids.
The way the automatic update works uses a small app that monitors an EQ log file for any items named in a specified chat channel and updates the DKP site with those items it "sees".
I wrote a Lua to run through the shared advloot list and put each item name into the chat channel. It "works" and is easier than other options.
My only initial issue was that it would sometimes miss items - and this appeared to be because the chat channel couldn't keep up (or I hit some anti-spam filter?). I have since "solved" the issue by adding a delay of 2 seconds after the post to the chat channel (bolded in the code snippet below).
My question is this - is there a more elegant way of checking that the chat channel has got the message before moving on to the next item? I'm still learning Lua so would be keen to hear any better solutions! Thanks!
Code snippet:
The way the automatic update works uses a small app that monitors an EQ log file for any items named in a specified chat channel and updates the DKP site with those items it "sees".
I wrote a Lua to run through the shared advloot list and put each item name into the chat channel. It "works" and is easier than other options.
My only initial issue was that it would sometimes miss items - and this appeared to be because the chat channel couldn't keep up (or I hit some anti-spam filter?). I have since "solved" the issue by adding a delay of 2 seconds after the post to the chat channel (bolded in the code snippet below).
My question is this - is there a more elegant way of checking that the chat channel has got the message before moving on to the next item? I'm still learning Lua so would be keen to hear any better solutions! Thanks!
Code snippet:
Code:
print('\ay*** Attempting to load loot ***')
for i = 1, mq.TLO.AdvLoot.SCount() do
lootitem = tostring(mq.TLO.AdvLoot.SList(i).Name())
-- If the item is not an ornament, load it up
if not string.match(lootitem, "Ornament") then
itemsloaded = itemsloaded + 1
mq.cmdf('/1 %s', lootitem)
printf('\at- %s', lootitem)
mq.delay(2000)
end
mq.delay(200)
end
printf('\ay*** %d items loaded - ending lua ***', itemsloaded)

