View Single Post
03-13-18, 06:15 PM   #11
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by WhirlyTV View Post
-- This file is loaded from "ZeldaShop.toc"

local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_UPDATE_RESTING")
f:RegisterEvent("MERCHANT_SHOW")
f:RegisterEvent("MERCHANT_CLOSED")
f:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_UPDATE_RESTING" then
if IsResting() then
PlayMusic("C:\Program Files (x86)\World of Warcraft\Interface\AddOns\ZeldaShop")
else
StopMusic()
end
elseif event == "MERCHANT_SHOW" then
PlayMusic(C:\Program Files (x86)\World of Warcraft\Interface\AddOns\ZeldaShop)
elseif event == "MERCHANT_CLOSED" then
StopMusic()
end
end)

I placed the Zeldashop.mp3 into the Addon folder and set the path to it.
I meant your addon's folder, not Interface\AddOns

+ IIrc, the upper most folder of each addon is their own folders.

So, if you have an addon called ZeldaShop and got a sound file called ZeldaShop.mp3 in that addon folder then it'd be something like this.

Lua Code:
  1. PlayMusic("ZeldaShop.mp3")

Seems, I'm wrong.

Follow semlar's comment

Last edited by Eungavi : 03-13-18 at 06:17 PM.
  Reply With Quote