A few plugin scripts

This pages describes a few plugin scripts shipping with the MvtPlayer. As usual they are full perm, and provided both in the hope of usefulness as is and as examples to write your own scripts.

The distinction between "plugin" scripts and "controller" is not strict of course, it all depends on their general purpose, as a same script can act both as controller (starting and stopping a sequence) and as a plugin script (to perform other actions).

More scripts can be added to this page in the future, depending on customer inquiries, feel free to contact me about it.

MVTPPlugin_ChatListen

Purpose

The Plugin_ChatListen script is designed to perform rather simple (but useful) tasks by reacting to "plugin action" or "plugin wait" steps in the sequence.

Reaction to Plugin-action steps

When a plugin action step is activated, the Plugin_ChatListen checks if the argument has the format "cmd:parameter" (without quotes). If it does not (i.e. if the argument does not contain a colon or if the "cmd" part is unknown), then it ignores the message (it may be intended for another plugin, after all).

Depending on the value of the "cmd" part, it takes an action. The supported actions are listed below. Commands are case-insensitive but of course you must pay attention to spurious spaces or other characters!

Of course modifying the script to add other commands is rather easy if you have the knowledge, and you can always contact me about it. Just make sure to do so in a well-identified copy of the script since the original might evolve with newer versions of the MvtPlayer system.

Saying, whispering, shouting

  • say:message - say the message in public chat (can be heard within 20 meters).

  • whisper:message - whisper the message in public chat (can be heard within 10 meters).

  • shout:message - shout the message in public chat (can be heard within 100 meters).

Applying a theme

Themes are managed by our other product Theme-O-Matic you can read about on the dedicated website. It will allow a very versatile way of altering your object's appearance: textures, size, local positions and rotations of prims, light, flexibility and an number of other properties.

  • theme:name - apply a specific theme designated by its name.

  • ptheme:preloader_id - apply a preloaded theme. The argument is the (numeric) preloader id holding the theme to apply.

Animesh

Two actions related to animesh animations were added in v2.1. They of course require that the moving object itself is an animesh and contains the required animation inventory items.

  • animstart:name - start the animation "name"

  • animstop:name - stop the animation "name".

Other actions

One last action exists in version 2.1 of the script. It is very easy to add more by modifying the pluginaction() function if you have some basic scripting ability.

  • unsit: - unsit any sitting avatar. Note that although no argument is supported the colon must still be there. This action may be useful for a transportation system, for example.

Reaction to Plugin-Wait steps

The MVTPlugin_ChatListen script has a configurable feature where it can "react" to plugin-wait steps in the sequence. If such a step happens, the script will listen on a specified private channel for a given keyword (or maybe just anything). If it does hear what it wants then it sends the message to the MvtPlayer that will enable the sequence to resume.

You can customize the channel number and the expected keyword by altering the following lines in the script (there are a few comments to help you there, too). And of course since the script is full perm you always have the option to modify it to suit your exact needs if you have the knowledge, or have someone do it for you.

integer pluginwait_channel=78;
string pluginwait_msg="go";

MVTPlugin_RotatePrim

This plugin was written on request from a customer who used the MvtPlayer to navigate a boat out of the sim's border: with an invisible root prim holding the MvtPlayer system and a linked prim being the boat, this rather cool effect was possible. However, since MvtPlayer moves the whole object, it was not possible to use it to rotate only the boat (child) prim.

The solution was to have a plugin script do the rotation only for the child prim, and this is possible thanks to one or several plugin wait steps: on receiving the message the plugin (smoothly) rotates the designated prim and sends the "wake" signal afterwards. Again this script can be easily adapted to other situations and is provided mainly for inspiration and educational purpose.

Only one setting exists in the current version of the plugin:

list commands=[
"rotate1","boat",<0.0,0.0,1.0>,180.0,10,1.0,
"rotate2","boat",<0.0,0.0,-1.0>,180.0,20,1.5 // no comma after last element
];

This list is organized in strides of 6 elements:

  1. the command name (in double quotes), equal to the argument of the plugin wait step used when creating the sequence (pay attention to the spelling and spaces!);

  2. the prim name (in double quotes) (pay attention to spelling and spaces, again);

  3. the (local) axis around which the rotation will be performed, in <x,y,z> format. For example use <0.0,0.0,1.0> to specify a rotation around the Z (vertical) axis;

  4. the desired total rotation for the prim in degrees: 180.0 for a U-turn, 90.0 or 270.0 for a right angle, etc.;

  5. the number of steps for the rotation: 1 for an immediate rotation, more for a smoother (and possibly laggier) effect;

  6. the total duration for the rotation, expressed in seconds.

In the example above, the script will react to the plugin-wait command rotate1 by rotating the prim named boat around the Z axis by 180 degrees in 10 steps and 1.0 second. It will also react to the command rotate2 by rotating the prim named boat around the Z axis by 180 degrees in the opposite direction (because the axis vector was reversed) in 20 steps and 1.5 second.

And of course you can extend the list for other commands, as long as they respect this specification.