WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Legend of Zelda Sound Addon (https://www.wowinterface.com/forums/showthread.php?t=56094)

WhirlyTV 03-13-18 07:36 AM

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.

WhirlyTV 03-13-18 07:41 AM

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!!!!

Kanegasi 03-13-18 08:02 AM

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.

Ammako 03-13-18 12:18 PM

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.

WhirlyTV 03-13-18 02:37 PM

Quote:

Originally Posted by Kanegasi (Post 327187)
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.
Quote:

Originally Posted by Ammako (Post 327193)
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.

Eungavi 03-13-18 04:48 PM

Quote:

Originally Posted by WhirlyTV (Post 327202)
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.

WhirlyTV 03-13-18 05:02 PM

Quote:

Originally Posted by Eungavi (Post 327203)
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.

Eungavi 03-13-18 05:44 PM

Quote:

Originally Posted by WhirlyTV (Post 327204)
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.

WhirlyTV 03-13-18 06:06 PM

Quote:

Originally Posted by Eungavi (Post 327205)
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.

semlar 03-13-18 06:13 PM

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.

Eungavi 03-13-18 06:15 PM

Quote:

Originally Posted by WhirlyTV (Post 327207)
-- 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 :p

+ 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 :p

WhirlyTV 03-13-18 06:32 PM

Quote:

Originally Posted by semlar (Post 327208)
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.

Quote:

Originally Posted by Eungavi (Post 327209)
I meant your addon's folder, not Interface\AddOns :p

+ 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 :p

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! :))))

Ammako 03-13-18 07:36 PM

Quote:

Originally Posted by Eungavi (Post 327203)
Quote:

Originally Posted by WhirlyTV (Post 327202)
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.

Quote:

Originally Posted by Ammako (Post 327193)
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.

MunkDev 03-14-18 12:20 PM

Quote:

Originally Posted by Ammako (Post 327211)
Major cities put your character at rest, aka you will have shop music playing all the time while in cities.

Lua Code:
  1. IsIndoors()

Ammako 03-14-18 01:03 PM

Quote:

Originally Posted by MunkDev (Post 327244)
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.

MunkDev 03-14-18 04:56 PM

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.

Ammako 03-14-18 05:25 PM

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 :p 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.)

Yukyuk 03-15-18 12:07 PM

Quote:

Originally Posted by Ammako (Post 327251)
the inn-teriors

That one is new for me. Lol


All times are GMT -6. The time now is 04:17 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI