MiceOnABeam Product Documentation

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

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. To open the editor select Edit User LSL Actions from the Tools main menu.

 

 

There are four elements by which you define your custom LSL Action. Each of these are represented in it's own grid within the LSL Actions Editor. The basic format is that each of the LSL Actions contains one or more Parameters which define the properties of the action and one or more Code Lines which contain the LSL code to which the action specification will be mapped when the LSL script is generated for the model.

Each parameter can optionally specify a set of Parameter Choices which represent the possible values for the parameter that will be presented to the user during configuration of the action. The Code Lines (and Code attributes covered below) typically reference one or more of the LSL Action's parameters which are then fully expanded (resolved) during code generation. These elements together with their attributes are described below:

  • LSL Actions:

    • Name: The name to be used as the LSL Action menu item name.

    • Category: The category under which this LSL Action menu item will be displayed.

    • Comment: A description of what the LSL Action does. This text will be shown in the top pane of the LSL Action Configuration Wizard for the action. The first line of the description will serve as the pop-up help for the LSL Action menu item.

    • Code: The LSL code that the action will be mapped to with all references to other parameters of the LSL Action expanded. Use %% as a prefix before any parameter name to reference the expanded value of that parameter. If there is only one LSL statement for this action, then it can be inserted here and the Code Lines section left empty.

    • LSL Reference: You can supply a URL link here to link to a web page for further information related to your action. MiceOnABeam uses this field for the built-in LSL Actions to link to the LSL Portal documentation to provide further details on the LSL functions that will be used to generate the action.

  • Parameters:

    • Name: The name for the parameter.

    • DataType:  Select the LSL datatype of the parameter from the drop-down list. Parameters whose Code field LSL statement does not return a value, must have their type set to nothing (blank).

    • Comment: The comment entered here will be used as the prompt for the parameter in the LSL Action Configuration Wizard.

    • Default: The LSL code for the default value of the parameter. The parameter will be initialized (and reset) to this value (if left blank by the user) in the LSL Action Configuration Wizard. The LSL code entered here should evaluate to the LSL type entered above.

    • Code: The LSL code that the parameter will be mapped to with all references to other parameters of the LSL Action expanded. Use %%Value to refer to the value for the parameter entered by the user during configuration of the action. Use %% as a prefix before any parameter name to reference the expanded value of that parameter. Code entered here will override any choices defined for the parameter. If left blank, the expanded value for the parameter is the value entered by the user during configuration. For LSL code statements that do not return a value, the corresponding parameter DataType field must be set to nothing (blank).

    • Conn(ector): If choices are provided for the parameter, selecting a choice connector will allow more than one choice to be selected. The selected choices will be joined together using the specified connector. If the datatype for the parameter is a list, the choice(s) will be enclosed in list brackets [...].

  • Parameter Choices:

    • Name: The name for the choice.

    • Comment: The comment entered here will serve as the pop-up help for the choice menu item.

    • Code: The LSL code that the choice will be mapped to with all references to other parameters of the LSL Action expanded. Use %% as a prefix before any parameter name to reference the expanded value of that parameter. If left blank, the expanded value for the choice is the choice name itself.

If the corresponding parameter type is specified as an LSL list, then the Code value can be of any type and will be automatically enclosed within the list brackets [ and ], unless the value specified is already enclosed in list brackets.

  • Code Lines:

    • Code: The LSL code that the action will be mapped to with all references to other parameters of the LSL Action expanded. Use %% as a prefix before any parameter name to reference the expanded value of that parameter .

    • Comment: The comment describing what the line of code does. It will be appended to the line during code generation.

Clicking the Save button will save your changes and create an XML file in your My Documents\MiceOnABeam folder. Clicking OK will do the same and close the User Actions Editor as well.

The LSL Actions that you created will be loaded in automatically every time MiceOnABeam is started. Alternatively you can select Reload LSL Actions from the Tools main menu to reload all built-in as well as user-created LSL actions.
 

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.

  • As the parameters of an LSL Action may reference each other, transitive self-references must be avoided when defining the action! MiceOnABeam will detect such occurrences and flag them during code generation.

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

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