Subject Watcher Script
From Jin
The Subject Watcher script allows you to be notified (via sound or text) when a certain phrase appears in someone's tell on the server.
- Script Type
- BeanShell.
- Event Type
- Chat
- Event Subtype
- You will certainly want "Channel Tell" here and probably "Personal Tell" as well. Add any of the other ones if you want.
- Code for audio notification
import java.util.regex.Pattern;
String subject = "girls";
String soundFile = "C:\\tmp\\sound.wav";
Pattern pattern =
Pattern.compile(".*\\b"+subject+"\\b.*", Pattern.CASE_INSENSITIVE);
if (pattern.matcher(message).matches())
playSound(soundFile);
- Code for textual notification (in the console)
import java.util.regex.Pattern;
String subject = "boys";
Pattern pattern =
Pattern.compile(".*\\b"+subject+"\\b.*", Pattern.CASE_INSENSITIVE);
if (pattern.matcher(message).matches())
appendLine("\""+subject+"\" is being discussed");
In both pieces of code, replace the subject's value for your own phrase. In the first example, also replace the value of the sound file to some file on your disk.
