local messages = {
{ 0, "Würfeln für: %s" },
{ 0, "Würfeln endet in 30 Sekunden." },
{ 0, "------------------------------" },
{ 15, "Würfeln endet in 15 Sekunden." },
{ 30, "------------------------------" },
{ 30, "Würfeln auf %s beendet." }
}
local function TimerCallback(self)
SendChatMessage(self.message, self.channel)
end
local function OnClick(self, button)
if button == "RightButton" and IsInRaid() and IsShiftKeyDown() then
local itemLink = GetLootSlotLink(self.slot)
local itemName = GetItemInfo(itemLink)
for i = 1, #messages do
local delay, message, channel = messages[i][1], messages[i][2], messages[i][3] or "RAID"
message = format(message, itemLink)
if delay == 0 then
SendChatMessage(message, channel)
else
local j, add = 1, 0
while messages[i-j][1] == delay do
add = add + 0.025
j = j + 1
end
local timer = C_Timer.NewTimer(delay + add, TimerCallback)
timer.message = message
timer.channel = channel
end
end
local dbm = SlashCmdList["DEADLYBOSSMODS"]
if dbm then
dbm("broadcast timer 30 Würfeln: " .. itemName)
end
local bw = SlashCmdList["BIGWIGSRAIDBAR"]
if bw then
bw("30 Würfeln: " .. itemName)
end
end
end
for i = 1, 4 do
local lootButton = _G["LootButton"..i]
lootButton:HookScript("OnClick", OnClick)
end
First of all thanks for the great effort of rewriting my code completely towards a solution :)
I've spend some time to read through the script and stumbled across some errors. The first (really minor) one were some missing commas at the phrase-array but that was nothing hard to fix. The other one took some investigation but I wasn't able to figure out the problem.
if button == "RightButton" and IsInRaid() and IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then
is not completely working as intended. I've checked the documentation on these functions and - after I didn't found any for it - removed the latter one, as the only thing it seemed to do was to force me to have the chat input box open for the script to run. IsModifiedClick("CHATLINK") however is still breaking the script in sort of not letting the if-clause pass. When I simply remove it, shift-rightclicking an Item in the loot window starts the script as intended, while only rightclicking also starts the script but at the same time puts the item in my inventory (or at least asks me if I want to do so when it's an epic item).
And a rather minor "bug" or more a sort of odd behaviour: The last two messages are triggering in wrong order, the very last one triggers first and the one before is written into chat after it. Just delaying the last one by 1 second obviously fixes it, but maybe someone can quickly see if its an error on blizzards end of the line or something in the script that I couldn't see.
local frame = CreateFrame("FRAME", "RayLoot");
frame:RegisterEvent("CHAT_MSG_RAID_WARNING");
local function eventHandler(self, event, text)
for itemLink in text:gmatch("|%x+|Hitem:.-|h.-|h|r") do
SendChatMessage("Würfeln für: " .. itemLink ,"RAID")
SendChatMessage("Würfeln endet in 30 Sekunden." ,"RAID")
SendChatMessage("------------------------------","RAID")
itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType,
itemStackCount, itemEquipLoc, itemTexture, itemSellPrice =
GetItemInfo(itemLink)
SlashCmdList["DEADLYBOSSMODS"]("broadcast timer 30 Würfeln: " .. itemName)
RayLoot__wait(15, SendChatMessage, itemLink, "RAID")
RayLoot__wait(15, SendChatMessage, "Würfeln endet in 15 Sekunden.", "RAID")
RayLoot__wait(30, SendChatMessage, "------------------------------", "RAID")
RayLoot__wait(30, SendChatMessage, "Würfeln auf " .. itemLink .. " beendet.", "RAID")
end
end
frame:SetScript("OnEvent", eventHandler);
I basically want to transform this function to trigger on shift-clicking a specific item in the loot window rather than on an item being postet in the /rw channel
Hey. I'm admittedly pretty new to LUA-Coding. Trying to implement a function to automatically post an item to the chat on shift-clicking, then start a timer of X seconds and after that post something else in the chat. The thing is, that I honestly have no idea on how to hook to the shift-click function on an item and get the ID of the item. Any Idea?
0
To recap, the full code is now:
0
I've spend some time to read through the script and stumbled across some errors. The first (really minor) one were some missing commas at the phrase-array but that was nothing hard to fix. The other one took some investigation but I wasn't able to figure out the problem.
is not completely working as intended. I've checked the documentation on these functions and - after I didn't found any for it - removed the latter one, as the only thing it seemed to do was to force me to have the chat input box open for the script to run. IsModifiedClick("CHATLINK") however is still breaking the script in sort of not letting the if-clause pass. When I simply remove it, shift-rightclicking an Item in the loot window starts the script as intended, while only rightclicking also starts the script but at the same time puts the item in my inventory (or at least asks me if I want to do so when it's an epic item).
And a rather minor "bug" or more a sort of odd behaviour: The last two messages are triggering in wrong order, the very last one triggers first and the one before is written into chat after it. Just delaying the last one by 1 second obviously fixes it, but maybe someone can quickly see if its an error on blizzards end of the line or something in the script that I couldn't see.
0
The current function is as followed:
I basically want to transform this function to trigger on shift-clicking a specific item in the loot window rather than on an item being postet in the /rw channel
0