|
Scripting Environment
Having a capable scripting system is not enough if what's
surrounding it is not adapted to rapid development scenarios.
That's why Messenger Plus! Live was designed with a special
developer's mode. This option makes developing scripts an easier
task while shielding end-users from boring technicalities at the
same time. When debugging options are enabled, developers get
access to a special debug window as well as special advantages
designed to help them get what they want, how they want.
Your main point of entry in the scripting system is the
Preferences panel (you'll need to be signed in to access it). From
the Plus! menu of your contact list,
select Preferences and click on
Scripts in the left section (the
Scripts section is available in the
General tab). This window lists every
script currently installed as well as their running state. Scripts
that are not running are generally either disabled or contain
syntax errors. End-users will generally stick to the "Import"
button when they'll want to add a script to Messenger Plus!. The
Import button loads a script
pack and installs the script automatically based on the
developer's configuration file. The Remove button deletes the whole
directory of the script and places it in the Recycle Bin (just in
case removing the script was a bad idea after all ;).
Before you create a new script, you'll want to check "Enable
debugging options" and exit the Preferences window. If this is the
first time you enable this mode, you'll automatically see the
Script Debugging window (if not, the option to show/hide this
window is accessible from the Plus!
menu of your contact list). The Script Debugging window gives you
access to every script currently running in Messenger. The "Debug"
menu button links to a couple of functions including quick access
to your script's source code. That being said, the main purpose of
this window is definitively to show debugging information traced by
scripts. You'll also see automatic traces for events executed in
your script and error codes with the location in your code where
the error occurred. When coding scripts in Messenger Plus!, this
window will probably be one of your best friends :).
Enabling debugging options also has one more noticeable
advantage. Messenger Plus! comes with its own script editor. This
editor supports syntax coloring, outlining, basic IntelliSense and
many other features designed to help you while you code. It is
probably enough for script developers who want to code their
scripts quickly without starting an external software. However, we
understand that the built-in editor has its limitations and because
so many great JScript editors already exist on the market (like
Visual
Studio), Messenger Plus! lets you use your favorite editor by
monitoring changes done in your ".js" script files. When debugging
option are enabled, if a script file is modified by an external
application, the script is automatically reloaded to apply the
changes. This means that every time you save your script, you
instantly see the changes without having to perform any extra
manipulation. Note however that in order to avoid any possible kind
of confusion, this functionality is disabled while the script
editor window is displayed. Also, remember that this feature is
only intended to be used by developers, this means that you cannot
rely on it for public use of your script (so don't code a feature
that expects code file changes to be intercepted by Messenger
Plus!).
There is also one more thing to remember about restarting your
scripts: it is considered to be a good practice to close every
window your script may be displaying, including message boxes,
before the script is stopped. Because of the way script code is
executed, if a script is stopped in its execution while it is
displaying a modal window (a window that stops the execution of
your script until it's closed), Messenger may completely crash. If
you forget to close a window and crash Messenger as a result of
stopping/restarting your script, don't worry about possible
problems, there isn't any (no need to send an error report
either).
If you're new to the Messenger Plus! Live scripting system, it
is recommended that you stick with the built-in editor for a while.
It will probably help you have a more complete understanding of the
system and you'll see that the built-in editor is not that bad
either ;). Now that you have enabled the debugging option, you're
ready to create your first
script!
See Also
What's a Messenger Plus! Script?,
Your First Script.
|