Shoutbox

Packing Scripts - 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: Packing Scripts (/showthread.php?tid=69808)

Packing Scripts by pedro_cesar on 12-22-2006 at 02:22 PM

Is it allright to upload a script that will require the user to open it and edit it (Since Nicknames are diferent from ppl to ppl)?????


RE: Packing Scripts by EBFL on 12-22-2006 at 02:25 PM

quote:
Originally posted by pedro_cesar
Is it allright to upload a script that will require the user to open it and edit it (Since Nicknames are diferent from ppl to ppl)?????
Scripting Documentation.
Didnt get that much, so if that isnt what you wanted speak more clearly
RE: Packing Scripts by pedro_cesar on 12-22-2006 at 02:30 PM

I've seen the Scripting Documentation. The thing is I created a script which rotates nicknames as u login, plus it lets u choose either one of'em with a command, but nicknames are different to everyone, so the script will require the user to open it and add his own nicknames which he wants to rotate.


RE: Packing Scripts by NanaFreak on 12-22-2006 at 02:31 PM

just post it 8-)


RE: Packing Scripts by alexp2_ad on 12-22-2006 at 02:33 PM

Well it's OK to do it, but it's a lot less professional, what you want to do is make windows or commands the user could use to enter their preferences, and then save them somewhere (like the registry, or in a txt file).

For example, you make a plus window that has a large text box where the user can enter each nickname they want, seperated by a new line.  You then save that to a file and read it from there every time the script is loaded.


RE: Packing Scripts by pedro_cesar on 12-22-2006 at 02:34 PM

This is my script, I want to upload it as plsc. so ppl can download and import it, so i wanna know if it's ok it has to be edited:

var old_DP = "N/A";
var old_NN = "N/A";
var old_PM = "N/A";
var nck_ckc = "N/A";
var nick0 = "[c=2](.•'\\_ Pêd®o çë$å® _/'•_) Imposible means you haven't FOUND a solution[/c=4]";
var nick1 = "[c=2](.•'\\_ Pêd®o çë$å® _/'•_) Adobe Photoshop CS3 v.10 Must Rock[/c=21]";
var nick2 = "[c=2](.•'\\_ Pêd®o çë$å® _/'•_) Only the Deads have seen the END OF WAR![/c=1]";

///////////////INICIO DE FUNCIONES DE CAMBIO DE NICK Y BACKUPS////////////////////////


function nck_ver () {

    if (Messenger.MyName == nick0) { nck_ckc = 0; }

    if (Messenger.MyName == nick1) { nck_ckc = 1; }
   
    if (Messenger.MyName == nick2) { nck_ckc = 2; }
}


function SwitchNick () {
   
    nck_ver ()
   
    if (nck_ckc == 0) { Messenger.MyName = nick1; }

       
    if (nck_ckc == 1) { Messenger.MyName = nick2; }

   
    if (nck_ckc == 2) { Messenger.MyName = nick0; }
}

function backup () {

    old_DP = Messenger.MyDisplayPicture;
    old_NN = Messenger.MyName;
    old_PM = Messenger.MyPersonalMessage;
}

/////////////FIN DE FUNCIONES DE CAMBIO DE NICK Y BACKUPS///////////////


function OnEvent_Signin(Email) {

    SwitchNick ()
}   

function OnEvent_SigninReady(Email){
   
    backup ()

}

function dp_toast (whois) {
   
    whois = MsgPlus.RemoveFormatCodes(whois);
    whois = "You've become " + whois;
    MsgPlus.DisplayToast ("Script stared", whois)
}

function OnEvent_ChatWndSendMessage (ChatWnd, Message) {

       
    if (Message == "/clone") {

        var e = new Enumerator(ChatWnd.Contacts);
        var Cnt = e.item();

        Messenger.MyName = Cnt.Name;
        Messenger.MyDisplayPicture = Cnt.DisplayPicture;
        Messenger.MyPersonalMessage = Cnt.PersonalMessage;
   
        dp_toast (Cnt.Email)
   
    return '';
   
    }

    if (Message == "/unclone") {
   
        Messenger.MyName = old_NN;
        Messenger.MyDisplayPicture = old_DP;
        Messenger.MyPersonalMessage = old_PM;

       
        dp_toast ("Yourself")
   
    return '';
    }
   
    if (Message == "/swnick") {
   
        SwitchNick ()
       
    return '';
    }
   
    if (Message == "/backup") {
   
        backup ()
       
    return '';
    }
   
    if (Message == "/nick0") {
   
        Messenger.MyName = nick0;
       
    return '';
    }

    if (Message == "/nick1") {
   
        Messenger.MyName = nick1;
       
    return '';
    }

    if (Message == "/nick2") {
   
        Messenger.MyName = nick2;
       
    return '';
    }

}

function OnGetScriptCommands() {
    var ScriptCommands = '<ScriptCommands>';
        ScriptCommands    +=     '<Command>';
        ScriptCommands    +=         '<Name>clone</Name>';
        ScriptCommands    +=         '<Description>Clones Active CntWnd</Description>';
        ScriptCommands    +=     '</Command>';
        ScriptCommands    +=     '<Command>';
        ScriptCommands    +=         '<Name>unclone</Name>';
        ScriptCommands    +=         '<Description>Roll back the cloning</Description>';
        ScriptCommands    +=     '</Command>';
        ScriptCommands    +=     '<Command>';
        ScriptCommands    +=         '<Name>swnick</Name>';
        ScriptCommands    +=         '<Description>Switches the current nick</Description>';
        ScriptCommands    +=     '</Command>';
        ScriptCommands    +=     '<Command>';
        ScriptCommands    +=         '<Name>backup</Name>';
        ScriptCommands    +=         '<Description>Stores Your Info so you can roll back</Description>';
        ScriptCommands    +=     '</Command>';
        ScriptCommands    +=     '<Command>';
        ScriptCommands    +=         '<Name>nick0</Name>';
        ScriptCommands    +=         '<Description>Changes the nick to the number 1</Description>';
        ScriptCommands    +=     '</Command>';
        ScriptCommands    +=     '<Command>';
        ScriptCommands    +=         '<Name>nick1</Name>';
        ScriptCommands    +=         '<Description>Changes the nick to the number 2</Description>';
        ScriptCommands    +=     '</Command>';
        ScriptCommands    +=     '<Command>';
        ScriptCommands    +=         '<Name>nick2</Name>';
        ScriptCommands    +=         '<Description>Changes the nick to the number 3</Description>';
        ScriptCommands    +=     '</Command>';
        ScriptCommands    += '</ScriptCommands>';

    return ScriptCommands;
}


RE: Packing Scripts by Felu on 12-22-2006 at 02:34 PM

quote:
Originally posted by pedro_cesar
Is it allright to upload a script that will require the user to open it and edit it (Since Nicknames are diferent from ppl to ppl)?????
Yea its fine to upload such scripts [Image: msn_happy.gif].

But keep in mind that there are better scripts which do the same.
RE: Packing Scripts by pedro_cesar on 12-22-2006 at 02:49 PM

thanks alex that's what I wanted to know, but yet I am noob so I don't know how to create windows or manage external txt files, I have the script documentation but is a little hard since english is not my "default" (is that even ok?) language. Can someone point me in the right direction. Some tutorial or (more) detailed documentation about windows and external files??


RE: Packing Scripts by Menthix on 12-22-2006 at 07:31 PM

quote:
Originally posted by pedro_cesar
Is it allright to upload a script that will require the user to open it and edit it
You can upload it on the forum here and on other places, sure... but it most likely wont be accepted to the scripts DB when you submit it there.
RE: Packing Scripts by pedro_cesar on 12-23-2006 at 01:52 PM

Are function as feof, fget*, etc available in JavaScript?


RE: Packing Scripts by Matti on 12-23-2006 at 02:41 PM

quote:
Originally posted by pedro_cesar
Are function as feof, fget*, etc available in JavaScript?
No. Those are PHP functions and they don't exist as standard JScript functions. To access files, you'll have to use the FileSystemObject or use API calls. You can take a look at the code snippet on the MPScripts.net site and use those functions to read from or write to text files. :)

Note: the functions in the snippet use a variable called 'fsObj', this can be declared in global like this:
code:
var fsObj = new ActiveXObject("Scripting.FileSystemObject")
but it's recommend you declare it per function to keep the memory usage low. This means, that instead of using:
code:
// Reads the full contents of a text file to a variable
function ReadFile (file) {
  var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 1);
  var contents = fileObj.ReadAll();
  fileObj.Close();
  return contents;
}
you use
code:
// Reads the full contents of a text file to a variable
function ReadFile (file) {
  var fsObj = new ActiveXObject("Scripting.FileSystemObject");
  var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 1);
  var contents = fileObj.ReadAll();
  fileObj.Close();
  return contents;
}
and so on for the other functions. ;)
RE: RE: Packing Scripts by CookieRevised on 12-23-2006 at 02:48 PM

Besides that this script can be optimized extremely and that you used many things and methods which aren't needed (though, it works, so if this is your first script then (y)):

  1. code:
    ScriptCommands += '<Name>nick1</Name>';
    ScriptCommands += '<Description>Changes the nick to the number 2</Description>';

    From the user's point of view this isn't logical. If he enters a command with a number (eg: 1) he expects that this command performs action 1, not action 2.

  2. /nick2 is an existing command from Messenger Plus!. Your script breaks this functionality. Do not do that....

    In fact you don't need all those commands /nick0, /nick1, /nick2, etc if you would use parameters.

RE: Packing Scripts by pedro_cesar on 12-23-2006 at 04:41 PM

I saw the parameter in the Script Documentation I just didn't get it, can u give me an example?

And by the what u say about nick1 switching to to nick2, that's just a mistake, besides, all nick-related code was originally though to me, I wanted to upload the name, pm, and dp cloning part to the DB but there's one almost the same. I'm trying to modify it a bit, so hopefully I'll be accepted next time.


RE: Packing Scripts by pedro_cesar on 12-31-2006 at 06:47 PM

Wich code do u say ain't needed, I'm trying to make my script as easy as possible, I'd also like to know how can I add a contact's Display Picture (or my own) to a Display Toast??


RE: Packing Scripts by CookieRevised on 12-31-2006 at 07:36 PM

here is the same script, but this time properly idented and with the proper methods.

All the bugs you have in the original, still remains in this one. I didn't change anything to the actual code (other than replacing /nick0, /nick1 and /nick2 because they interfear with Plus!'s /nick2 command).

The script contains a lot of things which might go wrong or things which aren't taken in account (eg: multi contact conversations, user changing the nick to something else manually, user using a parameter after commands, the backup doesn't work in all cases, etc, etc, etc).


RE: Packing Scripts by pedro_cesar on 12-31-2006 at 09:30 PM

I still wanna know how to add someone's Display Picture to a Display Toast.


RE: Packing Scripts by CookieRevised on 01-01-2007 at 01:45 AM

quote:
Originally posted by pedro_cesar
I still wanna know how to add someone's Display Picture to a Display Toast.
you can't...

If you want to show a toast with a display picture you're going to need to create the toast totally yourself, thus using an interface window, including the slide effect, and handling yourself where the toast should be displayed (it isn't always displayed in the bottom right corner). Furthermore, the toast will not stack upon others, etc...
RE: Packing Scripts by pedro_cesar on 01-01-2007 at 01:24 PM

I'll just forget about that (for now, while I'm still a noob). How can I program my msgplus to automatically send a message to a contact as soon as he logs in?


RE: Packing Scripts by rajvora on 01-01-2007 at 02:42 PM

quote:
Originally posted by pedro_cesar
I'll just forget about that (for now, while I'm still a noob). How can I program my msgplus to automatically send a message to a contact as soon as he logs in?

This script does exactly what u want
Come Back

Packing Scripts by pedro_cesar on 01-06-2007 at 01:43 PM

I downloaded the script, I want one simpler that I can understand though, 'cuz I got nothing of that one, I basically want to know how to send a specific text automatically. I also want to know how to use the Messenger.MyStatus and the Contact.Status functions.