*/
var hi = 'Hey!'
var on = '1'
function OnEvent_Initialize(MessengerStart)
{
if (on == '0'){
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is curently turned: Off\r\n\r\Turn it on by going to the msgplus icon
');}
else
{
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is curently turned: On');
}
}
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
if (on == '1'){
if (Origin != Messenger.MyName){
if (Message.match(/(^|\s+)(\*)?hello(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?helo(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?ello(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?elo(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hey(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hiya(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hi(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?sup(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hii(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?supp(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)Yo(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hiya(d|s)?(\*)?($|\s+)/i)!=null)
{
}
}
}
function OnEvent_Uninitialize(MessengerExit)
{
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if(Message.substr(0, 15) == '/heyon'){
heyon();
return '';
}
if(Message.substr(0, 15) == '/heyoff'){
heyoff();
return '';
}
if(Message.substr(0, 15) == '/heyonoff'){
onoff();
return '';
}
}
function OnGetScriptMenu(Location)
{
var ScriptMenu = '<ScriptMenu>';
ScriptMenu += '<MenuEntry Id=\'onoff\'>On or Off?</MenuEntry>';
ScriptMenu += '<MenuEntry Id=\'StartStop\'>';
if(on == '0') {
ScriptMenu += 'Turn On Auto Hey';
ScriptMenu += '</MenuEntry>';
}else {
ScriptMenu += 'Turn Off Auto Hey';
ScriptMenu += '</MenuEntry>';
}
ScriptMenu += '<MenuEntry Id=\'about\'>About</MenuEntry>';
ScriptMenu += '</ScriptMenu>';
return ScriptMenu;
}
function OnEvent_MenuClicked(MenuItemId,Location,OriginWnd) {
switch(MenuItemId) {
case 'StartStop':
heyturn();
break;
case 'onoff':
onoff();
break;
case 'about':
msgbox();
break;
}
}
function msgbox() {
var wnd = MsgPlus.CreateWnd('msgbox.xml', 'autoheymsgbox');
wnd.SetControlText(msg);
}
function OnautoheymsgboxEvent_CtrlClicked(PlusWnd,ControlId) {
switch(ControlId) {
case "Ok":
PlusWnd.Close(0);
break;
}
}
function onoff()
{
if (on == '0'){
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is: Off');}
else
{
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is: On');
}
}
function heyon()
{
if (on == '0') {
on = '1'
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is now: On');
}
}
function heyoff()
{
if (on == '1') {
on = '0'
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is now: Off');
}
}
function heyturn()
{
if (on == '0'){
on = '1'
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is now: On');
}
else
{
on = '0'
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is now: Off');
}
}