MiceOnABeam Product Documentation

Modified: 4/21/2013 4:17 PM
Recently changed articles You can subscribe to this wiki article using an RSS feed reader.

LSL Actions

One of the benefits in using MiceOnABeam is that by visually specifying your script's high-level logic, you don't have to manually enter in as much LSL code. This is particularly important if you are new to LSL scripting and aren't very familiar with computer programming.

With a focus on new scripters and an effort to further reduce the amount of LSL code that you must figure out and enter into your model, MiceOnABeam provides the LSL Actions feature.

An LSL Action represents a simple or complex operation that can be performed in your virtual world. It can be as simple as setting the color of an object or as complex as performing a set of rotation calculations and calling the required LSL functions to move and rotate an object or it's parts.

MiceOnABeam provides a comprehensive set of built-in LSL Actions and more will be provided in upcoming releases. The following sections show how you can select, configure and insert an LSL Action into a code segment in your model.

Selecting & Configuring an LSL Action

From within state Entry & Exit Actions, Transition Actions as well State Functions, a menu list of the built-in LSL Actions can be accessed by right-clicking to bring up the context menu and selecting the Insert Action menu item.

This will pop-up a sub-menu showing the various categories of LSL Actions. Selecting a category will display the LSL Actions that are available. Moving the cursor over each action will display it's pop-up description. Simply click on the desired LSL action in the menu to select it.

 

 

The LSL Action Configuration Wizard is then opened up where you can specify the properties of the action, customizing it for your particular use. The top pane provides a description of the action together with any information that you need to properly use it. In particular take note of any temporary variables that will declared when the code is generated for the action. (See below: Accessing Data Provided by the LSl Action).

Default values for the properties are initially shown. Change any values as needed by following the instructions for each property.

 

 

Where the value for a property is meant to be limited to one (or more) of a set of choices, right-click for a pop-up list from which to select the choice(s).

Select the OK button to save your changes.

An #action compiler directive will then be inserted into the code. This will be mapped to the appropriate set of LSL code statements when the LSL script is generated for your MiceOnABeam model.

 

 

Note that the default behavior is to include the complete LSL Action description within the code alongside the action directive. The option Insert First Line Only of Description is available in the Components & LSL Actions tab of the Options menu, which when enabled, will only include the first line of the action description within the LSL code alongside the action directive.

Accessing Data Provided by the LSL Action

Every #action directive is enclosed within it's own code block, {...}. In some cases an LSL Action may provide some data that you may need, e.g., ListenToSomeone returns the handle to the listen that is created. This data is saved into a temporary variable. In such case you will have to access the variable from within this code block and process it there, or alternatively assign it's value to a state or global variable for further processing at a later point in your model. Note that if this temporary variable is not re-saved, then a warning will be issued when saving your code in the Property Editor, indicating that the temporary variable has been initialized but never used.

In the following example, the listen is created upon entering the state and cancelled upon receiving the listen event and leaving the state.

 

 

Editing an LSL Action

Once an action directive has been inserted into your code, you can easily modify it's properties.

First ensure that the cursor has been placed on the line containing the #action directive. Then right-click and select Edit Action from the context menu. The LSL Action Configuration Wizard will re-open for the action where you can make your changes.

 

 

 

 

 

 

 

Viewing or Customizing the Generated Code for an LSL Action

You can view the code that will be generated for the LSL Action without having to generate the complete script for the model. This can provide you with additional insight into how the action works and can be helpful in learning LSL.

First ensure that the cursor has been placed on the line containing the #action directive. Then right-click and select Show Action Code from the context menu.

 

 

 

 

 

 

 

You also have the option of inserting the generated code for the action directly inline and thereby replacing the #action directive. You have the advantage then of being able to customize the code further, but note you will no longer be able to use the LSL Action Configuration Wizard to edit the action.

To insert the generated code into the code editor, select Show Action Code as described above and then select the Insert button.

You will be presented with a confirmation dialog. Select Yes to proceed.

 

 

Creating Your Own Custom LSL Action

You can also create and edit your own custom LSL Actions and access them from within MiceOnABeam alongside the built-in ones!  A special LSL Actions Editor is used for this. See Creating Your Own Custom LSL Action for further details.

Note: The LSL Actions Editor and importation of custom LSL Actions are only available with the Professional version of MiceOnABeam.

 

Notes

  • For flexibility, during configuration a user can always override the provided choices and enter in their own LSL code. This capability is controlled by option, and is set true by default.

 

Tags:
Home: MiceOnABeam Product Documentation Copyright © 2010-2018 MiceOnABeam Software