What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Again a code that a really need

Pages: (2): « First [ 1 ] 2 » Last »
Again a code that a really need
Author: Message:
Jumpfreakske
Junior Member
**

Avatar
Hardstyle!!!

Posts: 62
Reputation: -7
32 / Male / Flag
Joined: Jan 2007
O.P. Grin  Again a code that a really need
I'm almost ready with my script, but now I want
something like 'OnGetScriptMenu' or something like that:

- I want that I can veiw my script between the list
of other script in the script menu in a chatwindow,
en when you click on my script, then you must see
a submenu with 'Hardstyle' and 'Jumpstyle,
en when you go with your cursor on that,
there must be another submenu like this:

''My Script'' > Jumpstyle >  Liedjes
                                          Albums
                                          Artiesten
                      Hardstyle > Liedjes
                                         Albums
                                         Artiesten

And when they click on Jumpstyle, this must send automaticly: ChatWnd.SendMessage("'ALBUMS'    'LIEDJES'               << [c=4]Typ 'START' om terug naar het hoofdmenu te gaan.[/c]");

And when they click on 'Album' from jumpstyle, this must send automaticly:
ChatWnd.SendMessage("*!Explosive Car Tuning");

And when they click on 'Liedjes' from Jumpstyle, this must send automaticly: ChatWnd.SendMessage("And The Beat Goes On\n*!Beat Off\n*!Big Fat Bass\n*!Binum - Nervous\n*!Binum - The Last Time");

- You don't have to type everything over, maybe just type '...' and I will
put 'Jumpstyle' instead of '...'

- And when they received that message, people can type the words in that message, en they will here some music,

Somebody knows how to do this? *-) :)

And if you need to view my script, I put it in the attachment!;)

.zip File Attachment: Jumpstyle & Hardstyle.zip (5.04 KB)
This file has been downloaded 159 time(s).
01-29-2007 06:20 AM
Profile E-Mail PM Web Find Quote Report
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: Again a code that a really need
All of what you want can be found in the scripting documentation (OnGetScriptMenu, OnEvent_MenuClicked, Script Info File Schema Documentation). I don't want to write the code for you, because it's better if you learn; but here is an example for you:
code:
function OnGetScriptMenu(Location) {
   if (Location == 2) { // Script menu in chat window
      var ScriptMenu = "<ScriptMenu>";
      ScriptMenu += "<SubMenu Label=\"SubMenu 1\">";
      ScriptMenu +=    "<MenuEntry Id=\"MnuFeat1\">Feature 1</MenuEntry>";
      ScriptMenu +=    "<MenuEntry Id=\"MnuFeat2\">Feature 2</MenuEntry>";
      ScriptMenu += "</SubMenu>";
      ScriptMenu += "<SubMenu Label=\"SubMenu 2\">";
      ScriptMenu +=    "<MenuEntry Id=\"MnuFeat3\">Feature 3</MenuEntry>";
      ScriptMenu +=    "<MenuEntry Id=\"MnuFeat4\">Feature 4</MenuEntry>";
      ScriptMenu += "</SubMenu>";
      ScriptMenu += "</ScriptMenu>";
      return ScriptMenu;
   }
}

function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd) {
   if (Location == 2) {
      if (MenuItemId == "MnuFeat1") OriginWnd.SendMessage("Message 1");
      if (MenuItemId == "MnuFeat2") OriginWnd.SendMessage("Message 2");
      if (MenuItemId == "MnuFeat3") OriginWnd.SendMessage("Message 3");
      if (MenuItemId == "MnuFeat4") OriginWnd.SendMessage("Message 4");
   }
}
This will create a script menu in your chat window only with the name of your script. It will have menus something like this:
code:
"Your Script Name" > "SubMenu 1" > "Feature 1"
                                   "Feature 2"
                   > "SubMenu 2" > "Feature 3"
                                   "Feature 4"
When each of the Feature x menus are clicked, it will send a message to the chat window "Message x".

NOTE: You cannot send a message when a submenu is clicked. Plus! scripting only catches when a menu entry is clicked.

Please refer to the above named scripting documentation pages for more info.
01-29-2007 07:10 AM
Profile PM Find Quote Report
Jumpfreakske
Junior Member
**

Avatar
Hardstyle!!!

Posts: 62
Reputation: -7
32 / Male / Flag
Joined: Jan 2007
O.P. RE: Again a code that a really need
Thanks!!
But when I want to make another submenu on Liedjes or Albums,
can't you click then anymore on Albums to send a message?
do you have to click on the lower submenu to send a message,
or can it send a message when you click on Albums or Liedjes

Liedjes = Songs
01-29-2007 07:50 PM
Profile E-Mail PM Web Find Quote Report
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: Again a code that a really need
quote:
Originally posted by phalanxii
NOTE: You cannot send a message when a submenu is clicked. Plus! scripting only catches when a menu entry is clicked.
In order to send a message when you click a menu, you need to know the menu's ID. In my example code, these are all "MnuFeatx". Submenu's however do not have a menu ID, only a label.

Therefore: No, if you make Liedjes or Albums into a submenu, you will not be able to click on them to send a message. You will not even be able to click on a submenu within Liedjes or Albums. You can only click on menu entries (ie. Feature 1, Feature 2, Feature 3 and Feature 4).
01-29-2007 11:16 PM
Profile PM Find Quote Report
Jumpfreakske
Junior Member
**

Avatar
Hardstyle!!!

Posts: 62
Reputation: -7
32 / Male / Flag
Joined: Jan 2007
O.P. RE: Again a code that a really need
Thanks ;)


Oke, it works, But I have a case where their are 6 sounds:
So when you typ a word, it wil send 6 sounds with delays.

But what if the person wants to stop those sounds after 3 or 4, or when he want to here something else.
because now he has to close the chatwindow to stop the sounds from playing, so I need something like this:

if message === QUIT
then do following thing:  stop sounds!

can anyone make this for me?

This post was edited on 01-30-2007 at 05:21 AM by Jumpfreakske.
01-30-2007 05:19 AM
Profile E-Mail PM Web Find Quote Report
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: Again a code that a really need
Use MsgPlus.CancelTimer(TimerId) to cancel your delay timers. Because the timers are cancelled, OnEvent_Timer() won't be called, so the next sound will not play.

There are multiple ways of doing this. One way is to cancel the whole list of timers ("Delay1", "Delay2", etc...). Another way is to keep track of the current timer and cancel that one only. Either way works, although the first way is not as good.

This is the first way (I'm assuming you have 5 delay timers and you're using Felu's code from the other thread):
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
    if(Message == "QUIT") for(var i = 1; i < 6; i++) for(var j = 0; j < ChatWnds.length; j++) MsgPlus.CancelTimer("Delay" + i + j);
}
Haven't tried it with Felu's code, but it should work.
01-30-2007 05:39 AM
Profile PM Find Quote Report
Jumpfreakske
Junior Member
**

Avatar
Hardstyle!!!

Posts: 62
Reputation: -7
32 / Male / Flag
Joined: Jan 2007
O.P. RE: Again a code that a really need
Is There a place to put this? or just at the end?
01-30-2007 05:40 AM
Profile E-Mail PM Web Find Quote Report
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: Again a code that a really need
Yes, put it at the end unless you already have an OnEvent_ChatWndReceiveMessage(), which will be the case if you use Felu's code.

In this case, you will insert it into Felu's function:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
    if(Message == "Razzia") {
        ChatWnd.SendMessage("/sound Dj Zany - Razzia");
        ChatWnds[ChatWnds.length-1] = ChatWnd;
        MsgPlus.AddTimer("Delay1"+[ChatWnds.length-1], 12000);
    }
    if(Message == "QUIT") for(var i = 1; i < 6; i++) for(var j = 0; j < ChatWnds.length; j++) MsgPlus.CancelTimer("Delay" + i + j);
}
01-30-2007 05:43 AM
Profile PM Find Quote Report
Jumpfreakske
Junior Member
**

Avatar
Hardstyle!!!

Posts: 62
Reputation: -7
32 / Male / Flag
Joined: Jan 2007
O.P. RE: Again a code that a really need
You put this now after teh first sound, but don't I have to put this after the sixth sound? or doesnt't it matter?
01-30-2007 05:44 AM
Profile E-Mail PM Web Find Quote Report
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: Again a code that a really need
The only reason why you have to put it there is because you can't have two functions of the same name in the script. OnEvent_ChatWndReceiveMessage() is simply a function that is called when you receive a message. In your script, if you receive "Razzia" the sounds will start playing. If you receive "QUIT" the sounds will stop playing. That's basically how it works, you don't need to copy it after each sound.
01-30-2007 05:47 AM
Profile PM 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