Sitcomify = {} Sitcomify.Laugh = function() randomIndex = random(0,9); PlaySoundFile("Interface\\AddOns\\Sitcomify\\laughtracks\\Audience Laughing-0" .. randomIndex .. ".wav", "MASTER"); end local eventFrame = CreateFrame("frame", "SitcomifyMainframe"); eventFrame:RegisterEvent("PLAYER_DEAD"); eventFrame:RegisterEvent("ENCOUNTER_END"); eventFrame:RegisterEvent("LFG_PROPOSAL_FAILED"); eventFrame:RegisterEvent("LOSS_OF_CONTROL_ADDED"); eventFrame:SetScript("OnEvent", function(self, e, ...) --> Laugh if the player dies if (e == "PLAYER_DEAD") then Sitcomify.Laugh(); --> Laugh if the players group wipes elseif (e == "ENCOUNTER_END") then encounterSuccessful = select(5, ...); if (encounterSuccessful == 0) then Sitcomify.Laugh(); end --> Laugh if someone doesn't accept the LFR/LFG invite elseif (e == "LFG_PROPOSAL_FAILED") then Sitcomify.Laugh(); --> Laugh if the player gets stunned elseif (e == "LOSS_OF_CONTROL_ADDED") then Sitcomify.Laugh(); end end); SLASH_SITCOMIFY1 = "/laughtrack" SLASH_SITCOMIFY2 = "/lt" SlashCmdList["SITCOMIFY"] = function(msg) Sitcomify.Laugh(); end