What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Scripting - help with commands (Was: HELP!)

Pages: (2): « First « 1 [ 2 ] Last »
Scripting - help with commands (Was: HELP!)
Author: Message:
Ashylay
Junior Member
**

Intermediate Scripter

Posts: 70
Reputation: 1
– / Male / –
Joined: Mar 2007
O.P. RE: Scripting - help with commands (Was: HELP!)
Thanks Mattike, exactly what I wanted.
04-01-2007 01:35 PM
Profile E-Mail PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
RE: Scripting - help with commands (Was: HELP!)
quote:
Originally posted by Mattike
quote:
Originally posted by TheGuruSupremacy
quote:
Originally posted by Mattike

The advantage here is that it works for more than one word!

Also with split function works for more than one word
But not when you have "/command" in your actual message, read edited post.

I'm soo slow at editing...

It's improbably that "/command" is in message however
You are right split is not the best way to parse command...However
you can also do this:

code:
function OnGetScriptCommands(){
var commands = "<ScriptCommands>";
        commands += "  <Command>"
        commands += "    <Name>command</Name>"
        commands += "    <Description>TheGuruSupremacy</Description>"
        commands += "  </Command>"
        commands += "</ScriptCommands>"
return commands;}
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if (Message.substring(0,8)=="/command"){
var url="http://www.yoursite.com/index.php?variable=" + Message.substring(8,Message.lenght)
Interop.Call("shell32","ShellExecuteW",0,"open",url,null,null,1)
MsgPlus.DisplayToast("Example",Message.substring(8,Message.lenght))
return "";}}


quote:
Originally posted by Mattike

Therefore, it's more common to use regular expressions. They're harder to understand and learn, but they avoid a lot of problems you can have when using such split() calls.


Yes it's true but is not necessary using regular expressions to parse a command..

This post was edited on 04-01-2007 at 02:00 PM by TheGuruSupremacy.
04-01-2007 01:52 PM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: Scripting - help with commands (Was: HELP!)
It might not be necessary to use regular expressions, but it sure is nicer.  Have a look at CookieRevised's reply to [Release] Exit WLM for some really good examples. ;)
[Image: markee.png]
04-01-2007 03:47 PM
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