MsXLabs

MsXLabs (https://www.msxlabs.org/forum/)
-   Soru-Cevap (https://www.msxlabs.org/forum/soru-cevap/)
-   -   Script Sorunumu nasıl çözerim? (https://www.msxlabs.org/forum/soru-cevap/230658-script-sorunumu-nasil-cozerim.html)

ozan_77 3 Şubat 2009 22:43

/usay scriptinde bildigiminz gibi /usay <mesaj> yazinca sanki karsindaki adam yolluyormus gibi oluyor..
Ama yanliz, bunda yazi stili ayni olmuyor senin kendi yazi stilin gidiyor..:*(

Acaba kodlamasini bilen birisi onuda ekleyebilir mi ?

Kod burda ;

Kod:

STATE_INACTIVE = 0;
STATE_RUNNING = 1;
STATE_FINISHING = 2;

CHANGE_NAME_LATENCY = 1000;

var cur_state = STATE_INACTIVE;
var original_name;
var contact_name;
var message_to_send;
var chat_window;
var retry_count;
var dll_name;



function OnGetScriptCommands()
{
    var commands = '<ScriptCommands>';
        commands+='<Command>';
            commands+='<Name>usay</Name>';
            commands+='<Description>Impresonate as the contact you are talking with</Description>';
            commands+='<Parameters/>';
        commands+='</Command>';
    commands+='</ScriptCommands>';
    return commands;
}


function OnEvent_Initialize( MessengerStart )
{
    Debug.Trace("INIT");
    dll_name = MsgPlus.ScriptFilesPath;
    dll_name += "\\USay.dll";
    Interop.Call( dll_name, "USay_Init" );
}

function OnEvent_Uninitialize( MessengerExit )
{
    Interop.FreeDll( dll_name );
}

function ShowHelp()
{
    var helpstr;
    helpstr =    "In normal chat, Use:\n\r"
                + "    /usay <message>\n\r"
                + "\n\r"
                + "In group chat, Use:\n\r"
                + "    /usay <contact email> <message>\n\r"
                + "        - or -\n\r"
                + "    /usay <contact name> <message>\n\r"
                + "        - or -\n\r"
                + "    /usay <contact number> <message>\n\r"
                + "\n\r"
                + "You can also:\n\r"
                + "  Get a numerical list of contacts:\n\r"
                + "    /usay /list\n\r"
                + "  Show about screen:\n\r"
                + "    /usay /about\n\r"
                + "  Show help:\n\r"
                + "    /usay /help\n\r"
                + "        - or solely -\n\r"
                + "    /usay";
    Interop.Call( "User32.dll", "MessageBoxW", 0, helpstr, "USay - Help", 0 );
}

function ShowContacts( Contacts )
{
    var helpstring = '';
    //iterate through all contacts and create a list
    var i = new Enumerator( Contacts );
    var j = 0;
    while( !i.atEnd() )
    {
        var Contact = i.item();
        helpstring += j;
        helpstring += " - ";
        helpstring += Contact.Name;
        helpstring += " ( "
        helpstring += Contact.Email;
        helpstring += " )\n\r";
        j++;
        i.moveNext();
    }
    Interop.Call("User32.dll", "MessageBoxW", 0, helpstring, "USay - List", 0);

}

function CheckArgs( Arg, ChatWnd )
{
    var forceexit = false;
    if( Arg == null ) Arg = "/help";
       
    switch( Arg.toLowerCase() )
    {
        case "/help":
            ShowHelp();
            forceexit = true;
            break;
        case "/about":
            Interop.Call( dll_name, "USay_About" );
            forceexit = true;
            break;
        case "/list":
            ShowContacts( ChatWnd.Contacts );
            forceexit = true;
            break;
   
        default:
    }
    return forceexit;
}

function IsNumeric( str )
{
    var legal = "0123456789";
    var c;
    for ( i = 0; i < str.length; i++ )
    {
        c = str.charAt( i );
        if ( legal.indexOf( c ) == -1 )
        {
            return false;
        }
    }
    return true;
}


function GetContactEmail( Arg, Contacts )
{
    var i;
    //1st priority = email
    i = new Enumerator( Contacts );
    while( !i.atEnd() )
    {
        var Contact = i.item();
        if( Contact.Email == Arg )
        {
            return Contact.Email;
        }
        i.moveNext();
    }
    //2nd priority = name
    i.moveFirst();
    while( !i.atEnd() )
    {
        var Contact = i.item();
        if( Contact.Name == Arg )
        {
            return Contact.Email;
        }
        i.moveNext();
    }
    //3rd priority = number
    if( IsNumeric( Arg ) )
    {
        i.moveFirst();
        for( j=0; j<Arg; j++ )
        {
            if( i.atEnd() )
            { 
                return null;
            }
            i.moveNext();
        }
        return i.item().Email;
    }
    //no such contact
    return null;
}

function OnEvent_ChatWndSendMessage( ChatWnd, Message )
{
    chat_window = ChatWnd;
    Command = Message.split(' ');
   
    var j=0;
    var abort = false;
   
    switch ( Command[j].toLowerCase() )
    {       
        case "/usay":
            j++;
            //if no text or system arg, just go do nothing
            if( CheckArgs( Command[j], ChatWnd ) )
            {
                Message = '';
                return Message;
            }
            var i = new Enumerator( ChatWnd.Contacts );
            var thedude;
            switch( ChatWnd.Contacts.Count )
            {
                case 1:
                    thedude = i.item();
                    break;
                //we dont really get here in real life
                case 0:
                    //talking to myself again?
                    helpstring = "It seems like nobody wants to talk to you\n\rAre you talking to yourself again?";
                    Interop.Call("User32.dll", "MessageBoxW", 0, helpstring, "USay - Error", 0);
                    abort = true;
                    break;
                default:
                    //gangbang mode
                    var contact_email = GetContactEmail( Command[j], ChatWnd.Contacts );
                    if( contact_email == null )
                    {
                        //wtf?
                        helpstring = "Contact not found! type '/usay /help' for help, '/usay /list' for contact list";
                        Interop.Call("User32.dll", "MessageBoxW", 0, helpstring, "USay - Error", 0);
                        //make an exception :)
                        abort = true;
                    }
                    else
                    {
                        thedude = i.item();
                        while( !i.atEnd() && i.item().Email != contact_email )
                        {
                            i.moveNext();
                        }
                        j++;
                    }
            }
            // i got the contact, now go ahead
            if( !abort )
            {
                Debug.Trace( "USING: " + contact_email );

                //might do something with the contact fonr in the future
                //like using it in MY window
                contact_font = Interop.Call2( dll_name, "USay_SuggestContactFont", thedude.Email );

                //go on craete the new message
                message_to_send = '';
                while( Command[j] != null )
                {
                    message_to_send += Command[j];
                    j++                   
                    if( Command[j] != null ) message_to_send += ' ';
                }
                //get start the magic
                original_name = Messenger.MyName;
                contact_name = thedude.Name;
                cur_state = STATE_RUNNING;
                if( original_name == contact_name )
                {
                    contact_name += ' ';
                }
                Messenger.MyName = contact_name;
                Debug.Trace("CONTACT NAME SET");
            }
            Message = '';
            break;
        default:
    }
    return Message;
}

function OnEvent_MyNameChange( NewName )
{
    switch( cur_state )
    {
        case STATE_RUNNING:
            if( NewName == contact_name )
            {
                cur_state = STATE_FINISHING;
                retry_count = 3
                MsgPlus.AddTimer( 'sendmessage', CHANGE_NAME_LATENCY );
            }
            break;
        case STATE_FINISHING:
            if( NewName == original_name )
            {
                cur_state = STATE_INACTIVE;
                Debug.Trace( "NAME RESTORED" );
                MsgPlus.CancelTimer( 'restorename' );
            }
            break;
        case STATE_INACTIVE:
            //for some odd reason i get my contact name set again
            if( NewName == contact_name )
            {
                Messenger.MyName = original_name;
                MsgPlus.AddTimer( 'restorename', 500 );
            }
            break;
    }
}


function OnEvent_Timer( TimerId )
{
    switch( TimerId )
    {
        case 'restorename':
              Messenger.MyName = original_name;
              //do this until my name REALLY changes
              if( Messenger.MyName != original_name )
              {
                MsgPlus.AddTimer( 'restorename', 500 );
            }
            break;
        case 'sendmessage':
            chat_window.SendMessage( message_to_send );
            MsgPlus.AddTimer( 'restorename', 500 );
            break;
        default:
    }
}



uchiha itachi 4 Şubat 2009 00:29

Messenger Plus! Live - Script - USay

bunu kullanın

düzenleme : size indirme adresini verdiğim script in kaynak kodları sanırım. şimdi kodları incelediğimde üzerinde herhangi bir kullanıcı detayıyla ilgili bir şey yok ama dikkat ederseniz bir cok veriyi user32.dll dosyasından çekiyor onun için kendi kişisel ayarlanırınz gözükecektir.


Rower 4 Şubat 2009 00:41

yazı stili değişmiyor alternatif discovery de bulunan !imitate komutu ile aynı şeyi yapabilirsiniz


ozan_77 4 Şubat 2009 16:52

Messenger Plus! Live - Script - USay


bu scripti silemiyorum nasl silicem ?

Kodlarini falan sildim ama olmadi yine ..

simdiden yardim icin tesekkürler, iyi forumlar

Ozan.


Misafir 18 Eylül 2009 14:10

ben de scriptten kurtulamıyorum sildim ama olmuyo yardım edin lütfen.



Saat: 11:33

©2005 - 2026, MsXLabs - MaviKaranlık