Thread Tools Display Modes
03-13-18, 07:36 AM   #1
WhirlyTV
A Murloc Raider
Join Date: Mar 2018
Posts: 6
Legend of Zelda Sound Addon

First time post here guys, I had a cool idea for an addon. If the Legend of Zelda shop music played whenever you entered into an inn or opened up to sell things to a vendor. I'm not a programmer but I suspect there might be away to do it with the inn. Creating an event of some sort that triggers the sound whenever your character goes into a rested state. As for vendoring items not sure. But if someone could possibly create this I would be extremely grateful and appreciative.
  Reply With Quote
03-13-18, 07:41 AM   #2
WhirlyTV
A Murloc Raider
Join Date: Mar 2018
Posts: 6
Legend of Zelda shop music

https://youtu.be/VLAekpsclQY Reference to the Legend of Zelda Shop Music. This would be amazing please so,Rome make my dream come true!!!!
  Reply With Quote
03-13-18, 08:02 AM   #3
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
The code involved is relatively easy. However, there are distribution issues with hosting copyrighted media. You would have to provide your own music or find it yourself.
  Reply With Quote
03-13-18, 12:18 PM   #4
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Also, as far as I'm aware, there isn't an easy/straightforward way to tell whether you are in an inn or not, unless you want the shop music to constantly play while you are anywhere in a major city.

You get a ZONE_CHANGED event firing whenever you enter a new area, at which point you can check sub-zone text, but many inns don't have a separate sub-zone text in cities, so you can't differentiate inns from other parts of the city that way.

I guess you'd have to get exact coordinate mappings for all inns within cities, and play the inn music only while you are inside those coordinates. For non-city inns, IsResting would probably be accurate enough.
  Reply With Quote
03-13-18, 02:37 PM   #5
WhirlyTV
A Murloc Raider
Join Date: Mar 2018
Posts: 6
Originally Posted by Kanegasi View Post
The code involved is relatively easy. However, there are distribution issues with hosting copyrighted media. You would have to provide your own music or find it yourself.
I found a copyright free version here http://static.zreomusic.com/music/05...me/10_Shop.mp3 it's a reorchastrated version. http://www.zreomusic.com/listen The main website.
Originally Posted by Ammako View Post
Also, as far as I'm aware, there isn't an easy/straightforward way to tell whether you are in an inn or not, unless you want the shop music to constantly play while you are anywhere in a major city.

You get a ZONE_CHANGED event firing whenever you enter a new area, at which point you can check sub-zone text, but many inns don't have a separate sub-zone text in cities, so you can't differentiate inns from other parts of the city that way.

I guess you'd have to get exact coordinate mappings for all inns within cities, and play the inn music only while you are inside those coordinates. For non-city inns, IsResting would probably be accurate enough.
I was wondering if there was a way to tell when you're characters experience bar turns rested. If not I can find all the coordinates of the inns and post them.
  Reply With Quote
03-13-18, 04:48 PM   #6
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by WhirlyTV View Post
I was wondering if there was a way to tell when you're characters experience bar turns rested. If not I can find all the coordinates of the inns and post them.
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("PLAYER_UPDATE_RESTING")
  3. f:SetScript("OnEvent", function(self, event, ...)
  4.     if IsResting() then
  5.         -- You are now resting. Play some music!
  6.         -- PlayMusic
  7.     else
  8.         -- You are no longer resting. Turn off the music :(
  9.         -- StopMusic
  10.     end
  11. end)

You might want to use PlayMusic and StopMusic function, but cannot 100% guarantee.
  Reply With Quote
03-13-18, 05:02 PM   #7
WhirlyTV
A Murloc Raider
Join Date: Mar 2018
Posts: 6
Originally Posted by Eungavi View Post
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("PLAYER_UPDATE_RESTING")
  3. f:SetScript("OnEvent", function(self, event, ...)
  4.     if IsResting() then
  5.         -- You are now resting. Play some music!
  6.         -- PlayMusic
  7.     else
  8.         -- You are no longer resting. Turn off the music :(
  9.         -- StopMusic
  10.     end
  11. end)

You might want to use PlayMusic and StopMusic function, but cannot 100% guarantee.
Thank you so much for the help, I really appreciate it. I'm not a competent programmer unfortunately so I have no idea where to begin to make this happen. Is there also a way to tell when your character opens up a vendor? I'm currently watching youtube tutorials to try and learn how to create this.
  Reply With Quote
03-13-18, 05:44 PM   #8
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by WhirlyTV View Post
Thank you so much for the help, I really appreciate it. I'm not a competent programmer unfortunately so I have no idea where to begin to make this happen. Is there also a way to tell when your character opens up a vendor? I'm currently watching youtube tutorials to try and learn how to create this.
https://addon.bool.no/

This site would help you creating an addon.

Type in your addon's name into AddOn folder name field.
(Let's say PlayZeldaMusic)

Copy and paste the following code into lua file field
(This version will also play/stop music on vendor)
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("PLAYER_UPDATE_RESTING")
  3. f:RegisterEvent("MERCHANT_SHOW")
  4. f:RegisterEvent("MERCHANT_CLOSED")
  5. f:SetScript("OnEvent", function(self, event, ...)
  6.     if event == "PLAYER_UPDATE_RESTING" then
  7.         if IsResting() then
  8.             PlayMusic("path to your music")
  9.         else
  10.             StopMusic()
  11.         end
  12.     elseif event == "MERCHANT_SHOW" then
  13.         PlayMusic("path to your music")
  14.     elseif event == "MERCHANT_CLOSED" then
  15.         StopMusic()
  16.     end
  17. end)

Press Create my AddOn and give me my files! button.

You will get a zip file which contains two files called PlayZeldaMusic.toc and code.lua

Un-zip it, place your sound file into that folder then open code.lua and change "path to your music" to your own.
  Reply With Quote
03-13-18, 06:06 PM   #9
WhirlyTV
A Murloc Raider
Join Date: Mar 2018
Posts: 6
Originally Posted by Eungavi View Post
https://addon.bool.no/

This site would help you creating an addon.

Type in your addon's name into AddOn folder name field.
(Let's say PlayZeldaMusic)

Copy and paste the following code into lua file field
(This version will also play/stop music on vendor)
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("PLAYER_UPDATE_RESTING")
  3. f:RegisterEvent("MERCHANT_SHOW")
  4. f:RegisterEvent("MERCHANT_CLOSED")
  5. f:SetScript("OnEvent", function(self, event, ...)
  6.     if event == "PLAYER_UPDATE_RESTING" then
  7.         if IsResting() then
  8.             PlayMusic("path to your music")
  9.         else
  10.             StopMusic()
  11.         end
  12.     elseif event == "MERCHANT_SHOW" then
  13.         PlayMusic("path to your music")
  14.     elseif event == "MERCHANT_CLOSED" then
  15.         StopMusic()
  16.     end
  17. end)

Press Create my AddOn and give me my files! button.

You will get a zip file which contains two files called PlayZeldaMusic.toc and code.lua

Un-zip it, place your sound file into that folder then open code.lua and change "path to your music" to your own.
Thanks so much for the prompt replies I really do appreciate you taking the time to try and help me. I've tried exactly what you said and it doesn't seem to be working. This is currently what I have written in cod.lua


-- 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.
  Reply With Quote
03-13-18, 06:13 PM   #10
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
The path for PlayMusic is "interface/addons/ZeldaShop/YourSoundFile.mp3" (with forward slashes and the quotes) and assuming your addon is named "ZeldaShop".

You also need to entirely exit and restart the game to load any new files into it.
  Reply With Quote
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
03-13-18, 06:32 PM   #12
WhirlyTV
A Murloc Raider
Join Date: Mar 2018
Posts: 6
Originally Posted by semlar View Post
The path for PlayMusic is "interface/addons/ZeldaShop/YourSoundFile.mp3" (with forward slashes and the quotes) and assuming your addon is named "ZeldaShop".

You also need to entirely exit and restart the game to load any new files into it.
Originally Posted by Eungavi View Post
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
IT WORKS! THANK YOU GUYS SO MUCH! I APPRECIATE ALL THE HELP OMG!!! When you open up a vendor the music begins to play and stops as soon as you close it! )))
  Reply With Quote
03-13-18, 07:36 PM   #13
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Originally Posted by Eungavi View Post
Originally Posted by WhirlyTV View Post
I was wondering if there was a way to tell when you're characters experience bar turns rested. If not I can find all the coordinates of the inns and post them.
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("PLAYER_UPDATE_RESTING")
  3. f:SetScript("OnEvent", function(self, event, ...)
  4.     if IsResting() then
  5.         -- You are now resting. Play some music!
  6.         -- PlayMusic
  7.     else
  8.         -- You are no longer resting. Turn off the music :(
  9.         -- StopMusic
  10.     end
  11. end)

You might want to use PlayMusic and StopMusic function, but cannot 100% guarantee.
Originally Posted by Ammako View Post
Also, as far as I'm aware, there isn't an easy/straightforward way to tell whether you are in an inn or not, unless you want the shop music to constantly play while you are anywhere in a major city.
Major cities put your character at rest, aka you will have shop music playing all the time while in cities.
  Reply With Quote
03-14-18, 12:20 PM   #14
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Originally Posted by Ammako View Post
Major cities put your character at rest, aka you will have shop music playing all the time while in cities.
Lua Code:
  1. IsIndoors()
__________________
  Reply With Quote
03-14-18, 01:03 PM   #15
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Originally Posted by MunkDev View Post
Lua Code:
  1. IsIndoors()
1- Cities have other buildings that aren't inns, too.
2- Rested state only updates when you enter or leave the city (a.k.a. PLAYER_UPDATE_RESTING only fires then.)

Checking for IsIndoors(), the script will see you aren't indoors once you enter the city and stop there. The music won't play while inside inns that are within cities.
If you were inside a building while the script runs (tping back from an instance, or if the event fires at login), then it'll see you're indoors, and play the music constantly even after leaving.

If there is an event that tells when you go indoors/outdoors, that would make it activate in buildings that aren't inns, so that's not reliable either.

Last edited by Ammako : 03-14-18 at 01:05 PM.
  Reply With Quote
03-14-18, 04:56 PM   #16
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
I never said it would be used in conjunction with the event, just that the function to determine whether you're inside a building exists.
There are other things you can use, like the minimap zoom update event, whatever it's called.
__________________
  Reply With Quote
03-14-18, 05:25 PM   #17
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Yes, but unless there's a way to differentiate between the interior of inns (the inn-teriors) from he interiors of other buildings, it wouldn't quite be enough for what OP wants to do. It'd just make the music play whenever they go indoors anywhere in a city.

I'd be interested in knowing if there is a reliable way of doing this without just whitelisting certain coordinate ranges, still. One could possibly rely on the user mousing over the sign over the entrance of an inn and reading tooltip text to recognize inns, or mousing over the innkeeper, but that's clunky and prone to errors. Not ideal.

Alternatively, I guess one could choose to just disable it for main city inns but that seems like a shame, because it's a cool idea.

(Also I guess a coordinates-based solution would need to be coupled with extra detection to make sure it doesn't trigger on flying over inn.)

Last edited by Ammako : 03-14-18 at 05:29 PM.
  Reply With Quote
03-15-18, 12:07 PM   #18
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 179
Originally Posted by Ammako View Post
the inn-teriors
That one is new for me. Lol
__________________
Better to fail then never have tried at all.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Legend of Zelda Sound Addon

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off