Shoutbox

Problems With First Script - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Problems With First Script (/showthread.php?tid=71416)

Problems With First Script by Twiz on 02-05-2007 at 08:24 PM

Hello everybody!
I wrote this script just to try, but it doesn't work! I can call it from my chat window! how can I do?

CODE:

function CambiaStatus(){
    var status, pstatus;
    //find your status
    status=Messenger.MyStatus;
    //if it's not "lunch", it sets to "lunch"
    if(status!=9){
        //should say all you're going
        debug.trace("/all pappa-time, a dopo!!!");
        //sets the status
        Messenger.MyStatus=9;
        pstatus=status;
    }
    //else put "online" as status
    else{
        if(pstatus==0)
            Messenger.MyStatus=3;
        else
            Messenger.Mystatus=pstatus;
        }
}

function OnEvent_ChatWndSendMessage(ChatWnd,Message ){
   
    if(Message=="/pappa")
       
}

function OnGetScriptCommands(){
    var commands = '<ScriptCommands>';
        commands+='<Command>';
        commands+='<Name>pappa</Name>';
        commands+='<Description>Avverte tutti che stai andando a pranzo</Description>';

    return commands;
}

OnEvent_MenuClicked(MenuItemId,Location,OriginWnd){
    CambiaStatus();
}


RE: Problems With First Script by NanaFreak on 02-05-2007 at 08:51 PM

i think this should work for you

NOTE: i have not tested this so please dont get up me if it is wrong ;)

code:
function CambiaStatus();{
    var status = Messenger.MyStatus; //find your status
    var pstatus;
    if(status!=9){ //if it's not "lunch", it sets to "lunch"
        //should say all you're going
        debug.trace("/all pappa-time, a dopo!!!");
        //sets the status
        Messenger.MyStatus = 9;
        pstatus=status;
    }
    //else put "online" as status
    else if(pstatus == 0){
        Messenger.MyStatus = 3;
    else{
        Messenger.Mystatus = pstatus;
    }
}

function OnEvent_ChatWndSendMessage(ChatWnd,Message ){

    if(Message=="/pappa"){
        //do something????
        //maybe  CambiaStatus();??
    }

}

function OnGetScriptCommands(){

    return '<ScriptCommands><Command><Name>pappa</Name><Description>Avverte tutti che stai andando a pranzo</Description></Command></ScriptCommands>';
}

OnEvent_MenuClicked(MenuItemId,Location,OriginWnd){
    CambiaStatus();
}

RE: RE: Problems With First Script by roflmao456 on 02-06-2007 at 01:44 AM

to correct NanaFreak ;)

code:
var pstatus;
function CambiaStatus(curWnd);{
var status = Messenger.MyStatus; //find your status
if(status!=9){ //if it's not "lunch", it sets to "lunch"
//should say all you're going
debug.trace("/all pappa-time, a dopo!!!");
//sets the status
Messenger.MyStatus = 9;
pstatus=status;
curWnd.SendMessage("/all pappa-time, a dopo!!!"); // send message to current chat when typing /pappa
}
//else put "online" as status
else if(pstatus == 0){
Messenger.MyStatus = 3;
else{
Messenger.Mystatus = pstatus;
}
}

function OnEvent_ChatWndSendMessage(ChatWnd,Message){
if(Message=="/pappa"){
CambiaStatus(ChatWnd);
return '';
}
}

function OnGetScriptCommands(){

return '<ScriptCommands><Command><Name>pappa</Name><Description>Avverte tutti che stai andando a pranzo</Description></Command></ScriptCommands>';
}

function OnEvent_MenuClicked(MenuItemId,Location,OriginWnd){
CambiaStatus(OriginWnd);
}



in the red at the bottom: why is a menuclicked called when there is no menu (unless if in scriptinfo.xml)

maybe that should work..