![]() Script to parse user input - 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 to parse user input (/showthread.php?tid=93134) Script to parse user input by wiseguyxp on 12-06-2009 at 01:22 AM
I am writing a script that will essentially create a new command for messenger. I know that messenger has slash commands. How do I add my script to the list of commands and pass it parameters? RE: Script to parse user input by CookieRevised on 12-06-2009 at 02:06 AM
I very strongly suggest you first read the official documentation. There it is very clearly explained how you do this basic stuff. RE: Script to parse user input by wiseguyxp on 12-06-2009 at 03:22 AM
Yeah, I've been going through the official documentation in more detail since I posted the thread, so I figured out the whole return value thing from the docs and from others' scripts. RE: Script to parse user input by NanaFreak on 12-06-2009 at 12:45 PM
quote:you are also able to define a command in the script itself... most of the major script developers prefer this method (atleast i think they do =p) the way to do it is to return the XML that you would normally place in the scriptinfo.xml when the function is fired... jscript code: hope this helps you out... and i look forward to seeing your script! RE: Script to parse user input by CookieRevised on 12-06-2009 at 04:51 PM
quote:As I said before, the two things ("command not recognized" error and the OnGetScriptCommands() function) don't have anything to do with eachother. OnGetScriptCommands() (or the equivalent in the ScriptInfo.xml which is indeed rarely used by scripters) simply lists your command in the command browser window which pops up when the user types a slash "/" in a conversation window. It does _not_ make the command 'recognizable' by Plus!, it simply adds the command to that list which has the sole purpose of displaying something to the user, nothing more. You get the "command not recognized" error because you didn't tell Plus! that your script did recognize the text as a command. And that is done by returning something in the OnEvent_ChatWndSendMessage() function. If you don't return something, Plus! will think that the command wasn't recognized by any installed and running script and will eventually show that error message after it has parsed that text to all the OnEvent_ChatWndSendMessage() functions in all the installed and running scripts. To see an example of all that, see CookieRevised's reply to Gettin data from "/" commands. PS: I didn't link to that before because (re)searching such things yourself is very vital to learn scripting in Plus!. ![]() RE: Script to parse user input by wiseguyxp on 12-07-2009 at 05:46 AM Oh okay, maybe I got that error in an older version of the script. I didn't know that OnGetScriptCommands() was preferred. I just picked ScriptInfo.xml because I wouldn't have to put all of the xml in quotes (laziness ftw). But, I changed it to be more standardized and it all works fine still. |