View Single Post
04/09/14, 04:31 PM   #1
Blythe
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1
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...

Last edited by Blythe : 04/09/14 at 06:23 PM.
  Reply With Quote