Not at home at the moment therefore I cannot test this to verify it works however with regards to this:
quote:
Originally posted by Dr Nick
As far as I know, I have no function OnEvent_MenuClicked...
I am still getting that annoying message pop up when I try to send the command
You do have a function called OnEvent_MenuClicked and it is being called you just have an error in the OnEvent_ChatWndSendMessage function.
js code:
var originalPSM;
var idleSeconds;
var isIdle;
var isBusy;
var PSMnumber;
var seconds = 60;
function OnEvent_Initialize(MessengerStart){
idleSeconds = 0;
isIdle = false;
isBusy = false;
MsgPlus.AddTimer('rotate', seconds * 1000);
}
function updateMessage() {
if(PSMnumber==1) {
originalPSM = "Growing old is mandatory, growing up is optional";
PSMnumber=2;
} else {
originalPSM = "There are only two ways to live your life. One is as though nothing is a miracle. The other is as if everything is.";
PSMnumber=1;
}
Messenger.MyPersonalMessage = originalPSM;
}
function OnEvent_MyStatusChange(NewStatus){
if( NewStatus == 7 || NewStatus == 6 )
{
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! 0hrs:0mins:0secs";
MsgPlus.AddTimer( "incIdle", 1000 );
MsgPlus.AddTimer( "updateDisplay", 6000 );
isIdle = true;
isBusy = false;
} else if(NewStatus == 4) {
Messenger.MyPersonalMessage = "Text me! I'm in a full screen app and mssngr alerts are off! :)";
isBusy = true;
isIdle = false;
idleSeconds = 0;
}
else
{
isIdle = false;
isBusy = false;
idleSeconds = 0;
updateMessage();
MsgPlus.AddTimer('rotate', seconds * 1000);
}
}
function OnEvent_Timer(sTimerId){
if( isIdle == false && isBusy == false)
{
updateMessage();
MsgPlus.AddTimer('rotate', seconds * 1000);
return 0;
}
else if( sTimerId == "incIdle" )
{
if(isIdle==true) {
idleSeconds ++;
MsgPlus.AddTimer( "incIdle", 1000 );
}
}
else if( sTimerId == "updateDisplay" )
{
if(isIdle==true) {
var cIdleSeconds = idleSeconds;
var idleHours = 0;
var idleMinutes = 0;
while( cIdleSeconds > 59 )
{
cIdleSeconds -= 60;
idleMinutes ++;
}
while( idleMinutes > 59 )
{
idleMinutes -= 60;
idleHours ++;
}
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! "+idleHours+"hrs:"+idleMinutes+"mins:"+cIdleSeconds+"secs";
MsgPlus.AddTimer( "updateDisplay", 6000 );
}
}
}
function OnGetScriptCommands(){
var oCommand = new Commands();
with (oCommand) {
AddCommand('pmrotate', 'Rotate your Personal Message'); }
return oCommand.ExportCommands();
}
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {
var _command = RegExp.$1.toLowerCase();
var _param = RegExp.$2;
switch (_command) {
>>> case 'pmrotate':<<<
updateMessage();
break;
}
}
}
function OnGetScriptMenu(nLocation){
var oMenu = new ScriptMenu();
>>> oMenu.AddItem('/pmrotate', 'Roate your Personal Message');<<<
return oMenu.ExportMenu();
}
function OnEvent_MenuClicked(sMenuId, nLocation, oChatWnd){
OnEvent_ChatWndSendMessage(oChatWnd, sMenuId);
}
The highlighted stuff is what I changed.