Advertisement
Fike

Untitled

Mar 19th, 2011
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // SysInfo 1.0 by Fike.
  2. // This script could be a useful example to developers. Some lines are commented in case you're here to learn :)
  3. // Twitter = @_DrunkFox_.
  4. // Thanks to matty for helping me on my way to being an awesome scripter like him :)
  5.  
  6. function OnGetScriptCommands() { // The lines below define the different commands available, so that when you do "/" in a chat window, it will show you exactly what the commands do. Self-explainatory.
  7.     var commands = '<ScriptCommands>';
  8.         commands+='<Command>';
  9.             commands+='<Name>syshelp</Name>'; // Don't put a / before the command here, this will be done automatically. Same goes for commands below.
  10.             commands+='<Description>Lists commands in SystemInfo.</Description>';
  11.             commands+='<Parameters/>';
  12.         commands+='</Command>';
  13.         commands+='<Command>';
  14.             commands+='<Name>sysinfo</Name>';
  15.             commands+='<Description>Opens a window with information about WLM and Plus! Live.</Description>';
  16.             commands+='<Parameters/>';
  17.         commands+='</Command>';
  18.         commands+='<Command>';
  19.             commands+='<Name>wlmver</Name>';
  20.             commands+='<Description>Send a message to whoever you are chatting with with the version of WLM you are currently using.</Description>';
  21.             commands+='<Parameters/>';
  22.         commands+='</Command>';
  23.     commands+='</ScriptCommands>';
  24.     Debug.Trace("Commands initialised") // Sends a message to the debug window if open.
  25.     return commands; // Refreshes command list.
  26. }
  27.  
  28. function OnEvent_Initialize(MessengerStart) {
  29.     MsgPlus.DisplayToast("SystemInfo", "Welcome to SysInfo! Do /syshelp in a chat window for commands!"); // These lines make an alert/toast when Messenger is started.
  30. }
  31.  
  32. // Lines below show the script what to do when a command is issued in the chat window.
  33. // If you're having multiple commands, you must put an "else if" after the "} ", otherwise it will trigger an error message in the debug window.
  34. // return ""; tells WLM that no message needs to be sent to the contact.
  35.  
  36. function OnEvent_ChatWndSendMessage(pChatWnd, sMessage) {
  37.     if (sMessage.toLowerCase() == "/syshelp") {
  38.         MsgPlus.CreateWnd("SysHelp.xml", "SysHelp"); // Tells Plus! that it should open a window using the XML file and the window ID.
  39.         return "";
  40.     } else if (sMessage.toLowerCase() == "/wlmver") {
  41.         return (Messenger.Version.toFixed(1)+'.0'+Messenger.VersionBuild); // Line tells thatwhen /wlmver is done, to send a message with the current version of WLM to the contact you're talking to.
  42.     } else if (sMessage.toLowerCase() == "/sysinfo") {
  43.         var oSysHelpWnd = MsgPlus.CreateWnd("SysInfo.xml", "SysInfo");
  44.         oSysHelpWnd.SetControlText("WlmVer", Messenger.Version.toFixed(1)+'.0'+Messenger.VersionBuild); // This line and the one above it are required if you wish to post something to a control in a window from the script when open.
  45.         oSysHelpWnd.SetControlText("PlusVer", Messenger.Version.toFixed(1)+'.0'+Messenger.VersionBuild);
  46.         return "";
  47.     }
  48. }
  49.  
  50. function OnWndTestEvent_CtrlClicked(Wnd, ControlId)
  51. {
  52.     if (ControlId == "BtnClose")
  53.         Wnd.Close(1);
  54.     if (ControlId == "BtnMoreInfo")
  55.         MsgPlus.CreateWnd ("SysInfo.xml", "SysInfo");
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement