What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Help - /commands!

Help - /commands!
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Help - /commands!
Well, the easiest way to do it would be to check if the first character of "parameter" is a slash, using:
Javascript code:
setnoteMesCmd = (parameter.charAt(0) === "/");

However, this is far from perfect, as Plus! allows commands to be escaped by doubling the slash and you should check that the command itself doesn't contain invalid characters. Therefore, the "best" way to do this is by using regular expressions! :D
Javascript code:
setnoteMesCmd = (/^\/[^\s\/]+\s*[\s\S]*$/.test(parameter));

Basically, this is the same regular expression as you use in your command parser, the only difference is that it doesn't capture anything.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-02-2009 03:30 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Help - /commands! - by whiz on 02-01-2009 at 12:38 PM
RE: Help - /commands! - by matty on 02-01-2009 at 05:53 PM
RE: Help - /commands! - by whiz on 02-02-2009 at 10:59 AM
RE: Help - /commands! - by Matti on 02-02-2009 at 03:30 PM
RE: Help - /commands! [NEW QUESTION!] - by Jesus on 02-07-2009 at 01:15 PM
RE: Help - /commands! - by whiz on 02-15-2009 at 11:45 AM


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