What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » script command

Pages: (2): « First [ 1 ] 2 » Last »
script command
Author: Message:
lanky3
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. script command
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....)
08-16-2006 10:40 AM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: script command
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 '';
    }
}


This post was edited on 08-16-2006 at 12:18 PM by Felu.
08-16-2006 12:17 PM
Profile E-Mail PM Web Find Quote Report
lanky3
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. RE: script command
thank you
08-16-2006 12:41 PM
Profile E-Mail PM Find Quote Report
lanky3
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. RE: script command
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)
{
}
08-16-2006 07:26 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: script command
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?
08-16-2006 08:21 PM
Profile E-Mail PM Find Quote Report
lanky3
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. RE: script command
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
08-16-2006 08:54 PM
Profile E-Mail PM Find Quote Report
lanky3
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. RE: script command
a last small thing, how to put a sound with toast?
08-18-2006 04:07 PM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: script command
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.


This post was edited on 08-18-2006 at 04:16 PM by Felu.
08-18-2006 04:15 PM
Profile E-Mail PM Web Find Quote Report
lanky3
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. RE: script command
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;
}
08-18-2006 04:54 PM
Profile E-Mail PM Find Quote Report
KnRd_WC
Junior Member
**

Avatar
Florian PAQUET

Posts: 74
Reputation: 1
35 / Male / Flag
Joined: Aug 2006
RE: script command
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

This post was edited on 08-18-2006 at 05:55 PM by KnRd_WC.
08-18-2006 05:54 PM
Profile PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On