1. #1

    Personal Resource and playsoundfile

    Greetings, I need help.

    I am trying to make an addon that does 2 things. I have tried every combination I can find within other addons that do anything remotely similar, and as far as I can telll, I will accidentally type out all of Hamlet before I get this thing to work.

    1. I want PlaySoundFile("Interface\\Addons\\AuraSounds\\Ding4.ogg") to happen when I get an error telling me that I don't have enough (focus, mana, pain, runes, chi, whatever), ideally with a cooldown between plays (like 1-2 seconds between new dings).
    --as far as I can tell, the errors are ERR_OUT_OF_FOCUS, ERR_OUT_OF_RAGE, ERR_OUT_OF_ENERGY, ERR_OUT_OF_RUNES, ERR_OUT_OF_RUNIC_POWER, etc.
    --but the sound isn't playing regardless of the error I type in (tried ability on ERR_ABILITY_COOLDOWN, invalid target, even CHAT_MSG_WHISPER) the sound file will not play.
    --TMW can do this. It is possible. But when I hide the interface, all TMW auras stop. I like what TMW does for my rotation HUD (and that I can have a pulse sound that repeats as long as I have a certain buff--WA can't do that), and I don't want to run both WA and TMW.


    2. I my current power level (i.e. 40 focus) to display on the personal nameplate (ClassNameplateManaBarFrame), and am not getting that to work either.

    By now looking at different addons is just decreasing what little sense I was starting to make of them in the first place.

    I don't want any ingame customization--I can edit font sizes, and the chosen sound file from the .lua file itself.


    Here's the most recent thing I've tried. I took it from an addon that plays a sound whenever I receive a chat message. It doesn't matter what event=="apparently_meaningless" says, the sound will not play.

    local EventFrame = CreateFrame("Frame")

    EventFrame:RegisterEvent("UI_ERROR_MESSAGE")
    EventFrame:SetScript("OnEvent", function(self,event,...)
    --Recognize when a UI_ErrorMessage happens
    PlaySoundFile("Interface\\AddOns\\Crematorius_ChatSounds\\sheep.mp3")
    end)

    This will play a sound when ANY error happens. Changing it to ERR_OUT_OF_FOCUS doesn't work. I used EventTraceReloaded, and there's no actual error for Out of Focus. It's UI_Error_Message, with the first argument being 329, and the 2nd being "out of focus." I don't know how to use those, and I haven't seen anyone else use such things.
    Last edited by veltheranger; 2018-02-17 at 11:31 PM.

  2. #2
    ERR_OUT_OF_FOCUS is not an event. It is a global varriable containing the localized error message.

    Code:
    EventFrame:SetScript("OnEvent", function(self,event,messageType,message)
        --Recognize when a UI_ErrorMessage happens
        if message == ERR_OUT_OF_FOCUS then
            PlaySoundFile("Interface\\AddOns\\Crematorius_ChatSounds\\sheep.mp3")
        end
    end)

  3. #3
    That worked! Thank you so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •