Tiny JavaScript for Chatzilla, I need a bit of help with a small notification script |
![]() ![]() |
Tiny JavaScript for Chatzilla, I need a bit of help with a small notification script |
Sep 21 2008, 06:43 PM
Post
#1
|
|
|
Atomican Master |
Hi, I'm just trying to write a notification script for Chatzilla, that will play a sound when someone enters a certain phrase.
Basicall, I want Chatzilla to play a .wav sound file if someone enters the phrase: "Hello" *wildcard* "Bob" So the sound would play if someone says: "Hello my name is bob", but wouldn't play on "Hi, I'm bob" or "Hello, I'm Mike". The only problem is that I've never worked with JavaScript. I found some code that does basically what I want, I just need to modify it a little. It appears to be notifying based on events rather than on matching text, so I'm not really sure. CODE plugin.id = "message-notify"; plugin.init = function _init(glob) { plugin.major = 1; plugin.minor = 0; plugin.version = plugin.major + "." + plugin.minor + " ( 8 Jun 2007)"; plugin.description = "Notifies the user on any messages to a channel. " + "By James Ross <silver@warwickcompsoc.co.uk>."; plugin.prefary.push(["sound", "beep", ""]); plugin.prefary.push(["attention", true, ""]); return "OK"; } plugin.enable = function _enable() { client.eventPump.addHook([{ set: "channel", type: "privmsg"}, { set: "channel", type: "action"}, { set: "channel", type: "notice"}, { set: "channel", type: "join"}, { set: "channel", type: "part"}, { set: "channel", type: "quit"}, { set: "channel", type: "kick"}], plugin.onMessage, plugin.id + "-channel-hook"); return true; } plugin.disable = function _disable() { client.eventPump.removeHookByName(plugin.id + "-channel-hook"); return true; } plugin.onMessage = function _onMessage(e) { try { if (plugin.prefs["sound"] && !window.isFocused) playSounds(plugin.prefs["sound"]); if (plugin.prefs["attention"] && !window.isFocused) window.getAttention(); } catch(ex) { showErrorDlg(ex); } } And apparently I can play a sound like so.... CODE function PlaySound(){
window.location = "D:\Apps\SeaMonkey\connect.wav" } |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 19th June 2013 - 11:22 AM |