Soandso2
Well-known member
- Joined
- Mar 13, 2023
- RedCents
- 937¢
Alright, at the risk of being banned for spamming the forum with questions, I must ask why my Lua spams me.
I guess it doesnt really matter, really, but it annoys me. I think I know why this happens, but in case my theory is wrong, or I am implementing my code incorrectly, I am asking this here. Also, I have kind of been asking this question before, but as part of larger questions and it seems to go unnoticed.
By the way, I have had the same issue in macroscript before I started with Lua.
1) me is a shortened version of mq.TLO.Me (and similar with spell)
2) utils.haveBuff and utils.goodToGo are utility functions (the first simplifies checking if you have a buff or not, and the second one is borrowed from LeRogue)
When the following runs in combat, why do I often see 2 or 3 messages (with the same timestamp) that the clicky was used?
Now, I wrote above that I had a theory myself and this is it. There is a lag between server-client or a delay between EverQuest and MacroQuest. When the command to use the item comes, it takes some time for the client to react and the script runs so fast that it manages to think "oh, lets do this because it seems to be a-ok". Is this assumption correct? I have even added a delay after the useitem command to counter this, but it does not help. Or is my code somehow broken? If so, how to remedy this?
I guess it doesnt really matter, really, but it annoys me. I think I know why this happens, but in case my theory is wrong, or I am implementing my code incorrectly, I am asking this here. Also, I have kind of been asking this question before, but as part of larger questions and it seems to go unnoticed.
By the way, I have had the same issue in macroscript before I started with Lua.
1) me is a shortened version of mq.TLO.Me (and similar with spell)
2) utils.haveBuff and utils.goodToGo are utility functions (the first simplifies checking if you have a buff or not, and the second one is borrowed from LeRogue)
Lua:
local function useClicky(clickyName)
if findItem(clickyName).ID() > 0 and findItem(clickyName).TimerReady() == 0 then
mq.cmdf('/useitem "%s"',clickyName)
printf("[%s] \amClicky:: %s",os.date('%H:%M:%S'),clickyName)
if findItem(clickyName).CastTime() > 0 then
mq.delay(findItem(clickyName).CastTime() + 300)
end
else
printf("[%s] \amClicky:: Could not use %s",os.date('%H:%M:%S'),clickyName)
end
end
while true do
if me.Combat() then
if spell("Blessing of Unity").Stacks() and not utils.haveBuff("Blessing of Unity") and findItem("Miniature Horn of Unity").TimerReady() == 0 and me.Casting.ID() == nil and utils.goodToGo() then
useClicky("Miniature Horn of Unity")
end
end
end
When the following runs in combat, why do I often see 2 or 3 messages (with the same timestamp) that the clicky was used?
Now, I wrote above that I had a theory myself and this is it. There is a lag between server-client or a delay between EverQuest and MacroQuest. When the command to use the item comes, it takes some time for the client to react and the script runs so fast that it manages to think "oh, lets do this because it seems to be a-ok". Is this assumption correct? I have even added a delay after the useitem command to counter this, but it does not help. Or is my code somehow broken? If so, how to remedy this?



Thanks for everyone's assistance, advice and patience. 