ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   First addon, not sure why it doesn't work (chat alert sounds) (https://www.esoui.com/forums/showthread.php?t=738)

Blythe 04/09/14 04:31 PM

First addon, not sure why it doesn't work (chat alert sounds)
 
I know that this is bare minimum functionality at the moment, just trying to see if I can create something simple at first. The goal is to play a sound when a friend says something in chat.

You'll see I have a message in the chat window, just for testing purposes. The test message works, but the sound doesn't play (and I've tried different sounds). What am I conceptually missing?

Code:

ChatAlert = {}

function ChatAlert.init(eventCode, addOnName)
    if addOnName ~= "ChatAlert" then
        return
    end
    d("ChatAlert loaded")
    ZO_ChatSystem_AddEventHandler(EVENT_CHAT_MESSAGE_CHANNEL, ChatAlert.handleChat)
end

function ChatAlert.handleChat(messageType, fromName, text)
    if IsFriend(fromName) then
        PlaySound(SOUNDS.VOLUME_DING_VO)
        d("Messag received")
    end
end

EVENT_MANAGER:RegisterForEvent("ChatAlert", EVENT_ADD_ON_LOADED, ChatAlert.init)

Edit: nevermind, figured it out. VOLUME_DING_VO apparently is not actually an audible sound...


All times are GMT -6. The time now is 10:06 AM.

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