Shoutbox

script command - 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: script command (/showthread.php?tid=65002)

script command by lanky3 on 08-16-2006 at 10:40 AM

hello everyone I have just launched me in the scripting and I has to create an command, somebody can does not arrive give it to me?

( I am french and I not speak english very well....)


RE: script command by Felu on 08-16-2006 at 12:17 PM

Put this code in your js file.

code:
function OnGetScriptCommands ()
{
commands  = "<ScriptCommands>";
commands +=     "<Command>";
commands +=         "<Name>Command 1</Name>"; //Dont put a "/"before the command
commands +=         "<Description>Description for command 1</Description>";
commands +=     "</Command>";
commands +=     "<Command>";
commands +=         "<Name>Command 2</Name>";
commands +=         "<Description>Description for command 2</Description>";
commands +=     "</Command>";
commands +=     "<Command>";
commands +=         "<Name>Command 3</Name>";
commands +=         "<Description>Description for command 3</Description>";
commands +=     "</Command>";
commands += "</ScriptCommands>";
return commands;
}


And to trigger a function when a command is used use -
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  if(Message.substr(0, 9) == '/command1')   { //"/" will be used here.
    Dosomething();
    return '';
    }
}


RE: script command by lanky3 on 08-16-2006 at 12:41 PM

thank you


RE: script command by lanky3 on 08-16-2006 at 07:26 PM

I am really sorry I still have a small problem, there is a fault in my script but I do not find or… thank you in advance:


//      vous etes une star et personne autour de vous ne s'en rends compte ?
//           vous avez le cafard et vous avez besoin de compliment ?
//       vous souhaitez avoir l'impression que tout le monde vous respecte ?
//                             master est fait pour vous !!!!!!   

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var tab=new Array("tu es le meilleur !!!!", "gloire a toi !!!", "t'es une star !!!", "t'es tro un boss !!!","tu est le maitre incontesté !!!");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var a = "master";
var b = " prenom";

function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_ChatWndSendMessage(ChatWnd,Message)


   if(Message=="master")


{
   MsgPlus.DisplayToast(a,tab[Math.floor(Math.random() * tab.length)] + b);
   MsgPlus.DisplayToast(a,tab[Math.floor(Math.random() * tab.length)] );
   MsgPlus.DisplayToast(a,tab[Math.floor(Math.random() * tab.length)] );
}
     notify("tu es le maitre");
     
     return '';
}

function OnGetScriptCommands ()
{
commands = "<ScriptCommands>";
commands += "<Command>";
commands += "<Name>master</Name>";
commands += "<Description>commande maitre</Description>";
commands += "</Command>";
commands += "</ScriptCommands>";
return commands;
}


function OnEvent_Uninitialize(MessengerExit)
{
}


RE: script command by matty on 08-16-2006 at 08:21 PM

code:
//      vous etes une star et personne autour de vous ne s'en rends compte ?
//           vous avez le cafard et vous avez besoin de compliment ?
//       vous souhaitez avoir l'impression que tout le monde vous respecte ?
//                             master est fait pour vous !!!!!!   

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var tab=new Array("tu es le meilleur !!!!", "gloire a toi !!!", "t'es une star !!!", "t'es tro un boss !!!","tu est le maitre incontesté !!!");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var a = "master";
var b = " prenom";

function OnEvent_ChatWndSendMessage(ChatWnd, Message) { 
    if(Message=="master") {
        MsgPlus.DisplayToast(a,tab[Math.floor(Math.random() * tab.length)] + b);
        MsgPlus.DisplayToast(a,tab[Math.floor(Math.random() * tab.length)] );
        MsgPlus.DisplayToast(a,tab[Math.floor(Math.random() * tab.length)] );
    }
    notify("tu es le maitre");
    return '';
}

function OnGetScriptCommands () {
    var commands = "<ScriptCommands>";
    commands += "    <Command>";
    commands += "        <Name>master</Name>";
    commands += "        <Description>commande maitre</Description>";
    commands += "    </Command>";
    commands += "</ScriptCommands>";
    return commands;
}

Why is the bolded line not defined? Are you trying to open an alert box like using alert() in javascript?
RE: script command by lanky3 on 08-16-2006 at 08:54 PM

and well I do not know too I begin in the scripting and I do not understand all yet thank you nevertheless for your answer


RE: script command by lanky3 on 08-18-2006 at 04:07 PM

a last small thing, how to put a sound with toast?


RE: script command by Felu on 08-18-2006 at 04:15 PM

quote:
Originally posted by lanky3
a last small thing, how to put a sound with toast?
Did you read the Scripting Documentation? Its all given there [Image: msn_happy.gif].

Anyways here's it [Image: msn_wink.gif].
quote:
Originally posted by Scripting Documentation

<pre>[boolean] DisplayToast(
    [string] Title,
    [string] Message,
    [string,optional] SoundFile,
    [string,optional] Callback,
    [var,optional] CallbackParam

Title
[string] Title displayed on top of the toast. If an empty string is sent in this parameter, "Messenger Plus! Live" is used.
Message
[string] Message displayed in the toast. Carriage returns can be used to force line breaks. A maximum of 4 lines can be displayed in the toast created by this function. Format codes are not parsed in this parameter and must be filtered out with RemoveFormatCodes.
SoundFile
[string,optional] Path to the sound file that will be played when the toast is shown on screen. The path is relative to the script's directory by default, to override this behavior, prefix the path with "\". Example: "\C:\directory\sound.mp3". If the parameter is missing or the string is empty, no sound is played.
Callback
[string,optional] Name of the function in your script that will be called if the toast is clicked by the user. If the parameter is missing or the string is empty, the toast won't be clickable. For more information, see ToastCallbackTemplate.
CallbackParam
[var,optional] Parameter of variable type (can be a number, a string, an object, ...). This value will be sent as parameter of the function specified in Callback when the toast is clicked. It can be omitted if not needed.


RE: script command by lanky3 on 08-18-2006 at 04:54 PM

thank you for your answer, I already read documentation, but I do not arrive has to place this in a script :



function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    if(Message== '/toast'){
        MsgPlus.DisplayToast("","Hello")
        return '';
    }
}



function OnGetScriptCommands (){
    var commands = "<ScriptCommands>";
    commands += "    <Command>";
    commands += "        <Name>toast</Name>";
    commands += "        <Description>...</Description>";
    commands += "    </Command>";
    commands += "</ScriptCommands>";
    return commands;
}


RE: script command by KnRd_WC on 08-18-2006 at 05:54 PM

Salut lanky3 ! :)

Tu trouves enfin quelqu'un de français ici.... ;)

Je viens de jeter un coup d'oeil à ton script... et ce que tu as posté semble correct...

Si j'ai bien compris le principe de ton script, c'est pour se la péter un peu hein ??? :D

Je me suis permis de modifier légermement ton script pour qu'il soit utilisable, après, tu en fait ce que tu veux....

code:
//      vous etes une star et personne autour de vous ne s'en rends compte ?
//           vous avez le cafard et vous avez besoin de compliment ?
//       vous souhaitez avoir l'impression que tout le monde vous respecte ?
//                             master est fait pour vous !!!!!! 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var tab=new Array("Tu es le meilleur, ", "Gloire a toi, ", "T'es une star, ", "T'es trop un boss, ","Tu est le maitre incontesté, ");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var a = "Master";
var b = "KnRd_WC :)";

function OnEvent_Initialize(MessengerStart) {
}

function OnEvent_ChatWndSendMessage(ChatWnd,Message) { 
   if(Message=="/master") {
       MsgPlus.DisplayToast(a,tab[Math.floor(Math.random()*tab.length)]+ b + " !!");
       Message=""; //Bien évidemment, on ne veut pas envoyer '/master'...
   }
   return Message; //Il faut retourner le message si il ne correspond pas à la commande !!!!
}

function OnGetScriptCommands () {
    commands = "<ScriptCommands>";
    commands +=     "<Command>";
    commands +=         "<Name>master</Name>";
    commands +=         "<Description>commande maitre</Description>";
    commands +=     "</Command>";
    commands += "</ScriptCommands>";
    return commands;
}


function OnEvent_Uninitialize(MessengerExit)
{
}


Ah aussi, j'ai vu que tu utilisais 'notify'... A la place, y'a MsgPlus.DisplayToast qui est parfait, mais si tu veux vraiment un message d'alerte, tu peux utiliser ca :

code:
Interop.Call("User32.dll", "MessageBoxW", Fenetre, Message, Titre,Parametre);

//Fenetre : tu peux mettre 0 si tu comprend pas...
//Parametre : la, il faut s'y connaitre.....
//48 = exclamation
//16 = erreur
//64 = information.........


Voila, j'espère t'avoir aidé...;)
Bonne soirée
RE: script command by lanky3 on 08-18-2006 at 07:06 PM

merci de ton aide, j'avais ossi fait un nouveau script:

/ vous etes une star et personne autour de vous ne s'en rends compte ?
// vous avez le cafard et vous avez besoin de compliment ?
// vous souhaitez avoir l'impression que tout le monde vous respecte ?
// master est fait pour vous !!!!!!

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var tab=new Array("tu es le meilleur !!!!", "gloire a toi !!!", "t'es une star !!!", "t'es tro un boss !!!","tu est le maitre incontesté !!!");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var a = "bonjour Kévin";
var b = "oui maitre"
var c = "tu es le maitre"
var d = " Kévin";
var e = "bienvenue"
var f = "aurevoir"

function OnEvent_Signin(Email)
{
    if(Email == "NOM@hotmail.com")
    {
        var Message = "bonjour " + Messenger.MyName + "!";
        Message = MsgPlus.RemoveFormatCodes(Message);
        MsgPlus.DisplayToast(e,"" + Message);
    }
}

function OnEvent_Signout(Email)
{
    if(Email == "Nom@hotmail.com")
    {
        var Message = "aurevoir " + Messenger.MyName + "!" + " et à bientot...";
        Message = MsgPlus.RemoveFormatCodes(Message);
        MsgPlus.DisplayToast(f,"" + Message);
    }
}



function OnEvent_ChatWndSendMessage(ChatWnd, Message){ 
    if(Message== '/master') {
        MsgPlus.DisplayToast(a,tab[Math.floor(Math.random() * tab.length)] + d);
        MsgPlus.DisplayToast(b,tab[Math.floor(Math.random() * tab.length)]);
        MsgPlus.DisplayToast(c,tab[Math.floor(Math.random() * tab.length)]);

      return '';
    }

}

function OnGetScriptCommands () {
    var commands = "<ScriptCommands>";
    commands += "    <Command>";
    commands += "        <Name>master</Name>";
    commands += "        <Description>commande maitre</Description>";
    commands += "    </Command>";
    commands += "</ScriptCommands>";
    return commands;
}


RE: script command by lanky3 on 08-18-2006 at 07:09 PM

par contre saurais tu rajouter un son lorsque les toast sont afficher ?


RE: script command by KnRd_WC on 08-18-2006 at 07:29 PM

Lol, tu t'appelerais pas Kévin par hasard ?? :D

Pour ajouter un son a un Toast :

code:
Titre = ""
Message = ""
Son = "\\C:\\monfichierson.wav"
MsgPlus.DisplayToast(Titre,Message,Son);


;)
RE: script command by lanky3 on 08-20-2006 at 10:38 AM

ouiiiiiin , ji arrive pas !


function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    if(Message== '/toast'){
        Titre=""
        Message="ceci est un toast :)"
        Son="\C:\Program Files\MSN
Messenger\online.wma"
        MsgPlus.DisplayToast(Titre,Message,Son)
        return '';
    }
}





function OnGetScriptCommands (){
    var commands = "<ScriptCommands>";
    commands += "    <Command>";
    commands += "        <Name>toast</Name>";
    commands += "        <Description>...</Description>";
    commands += "    </Command>";
    commands += "</ScriptCommands>";
    return commands;
}


RE: RE: script command by mickael9 on 08-20-2006 at 11:19 AM

quote:
Originally posted by lanky3
ouiiiiiin , ji arrive pas !


function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    if(Message== '/toast'){
        Titre=""
        Message="ceci est un toast :)"
        Son="\C:\Program Files\MSN
Messenger\online.wma"
        MsgPlus.DisplayToast(Titre,Message,Son)
        return '';
    }
}





function OnGetScriptCommands (){
    var commands = "<ScriptCommands>";
    commands += "    <Command>";
    commands += "        <Name>toast</Name>";
    commands += "        <Description>...</Description>";
    commands += "    </Command>";
    commands += "</ScriptCommands>";
    return commands;
}

Les sons WMA ne sont pas supportés par MsgPlus! Live, tu dois les convertir en mp3 par exemple

WMA sounds are not supported by MsgPlus! Live, you have to convert them to mp3 for example

And you must provide an english translation

code:
Son="C:\\Program Files\\MSN Messenger\\online.wma"; // correct syntax (but this will not work : wma)

PS: lol ton script :P

Edit : http://shoutbox.menthix.net/showthread.php?tid=64...d=710418#pid710418
RE: script command by lanky3 on 08-20-2006 at 11:29 AM

merci bocoup !!!!