Anyone up to building an mod that would produce an audio notification when someone posted in the in game chat? I can get tunnel vision when playing and a notification would be a big help.
I miss more than just urgent game-related messages from my team mates though. If I had half a clue about programming, I'd do it myself. But I don't, so I have to ask.
So kind of like this? Severely untested of course, just to get an idea. It's supposed to play a sound when a chat message is added. I haven't actually tested to see if it works on receiving chat, but it works on sending.
Thanks! I looked at the .js files to try to get an idea of what is going on. I also looked at the .js files for "Who Deleted That" and "Sound Effects for Chat Message" since they both interacted to chat. But to no avail - I just couldn't grasp what was going on. What little programming experience I have is from cobbling together Visual Basic macros for MS Excel at work. At any rate, I bought 'Beginning Programming with Java For Dummies ' today to see if it would help me make sense of what's going on.
Yeah, it's a bit tricky. PA uses a JavaScript library called Knockout which has the nice feature that it automatically reacts to changes of what is called observables. The chat messages are stored in the observableArray "chatLog" and by calling "subscribe" on it, I can get notified of changes and execute a function (see here). In that function I call api.audio.playSound, which is a function defined by PA and also used for the UI sounds. The only way to figure out all of that is to look at the JavaScript files to come with PA and there are quite a lot of those. I think those other two mods are server mods if I remember correctly. By the way, Java is not the same as JavaScript. They're quite different languages.
Heh, I never really understood why they are named so similarly. It's really confusing! Anyway, I'll get this mod in a publishable state. And I'll probably make an example mod out of it too while I'm at it.
I took a look at his "Sound Effects for Chat Messages" mod and I think I got a general sense of what was going on but I need to learn some JavaScript before I can discuss it with a degree of intelligence. Searching for the right 'Dummies' book on that now.
My mod is really badly programmed It also plays sounds through the coherent ui. they seem to be much quieter than sounds played through the engine with audio.playSound
As far as I know audio.playSound only plays sounds that already come with PA. It's not possible to load other sounds like your mod does. At least, I think it can't. I haven't actually tested it.
Yeah, that's the reason that I can't use playSound. Surely there's an in-game noise that could be used as a notification sound though.
I'd pick: Code: api.audio.playSound('/SE/UI/UI_camera_anchor_saved'); @lulamae Let us know if you need more help.
So I turned this mod into an example mod to show how UI modding is done: https://wiki.palobby.com/wiki/Example_Mod_Chat_Alert Is that clear enough?
Wow! I just took a quick look and you put a lot of work into that. I'm still in the early stages of the JavaScript books I bought but I'll be spending some quality time on your page. Thanks!