Create a Custom Logic
-
From the Resource Behavior section of the action bar,
select Manage Custom Logics
.
The following information is displayed in the Manage Logics dialog box: name, type, assigned entities, and context resources. -
From the Manage Logics dialog box, click
to
create a custom logic.
The script editor opens in Authoring mode by default.Note: The interface of the script editor can be different depending on the active mode. -
In the Custom Logic panel, define the characteristics of the
logic parameters.
A parameter has a name and a type (and a value in Run mode).
-
Enter a name. Ensure that each parameter has a unique name.
The name can only be edited in the Authoring mode. The name you enter must comply with the following rules:
- The name must start with a letter.
- Only
[a-z],[A-Z],[0-9]and underscores are allowed. - Do not use
var for if else true false of continue break new.
Warning: You cannot edit this property once the parameter is created. -
Select the appropriate attributes for the parameter from
Input, Output, or both.
These attributes drive the script logic. For more information on the data types available as inputs and outputs, see SemEL Data Types.
Warning: You cannot edit this property once the parameter is created.
-
Enter a name. Ensure that each parameter has a unique name.
-
Select a type from the list.
The parameter type dictates the event that triggers logic execution during simulation.
Warning: You cannot edit this property once the parameter is created. You can browse the Custom Logic APIs Help section from the App Options to see the available functions and methods associated with a data type. To access the App Options panel, from the Tools section of the action bar, select App Options
.Note: You can copy a method from the Members tab and paste it in the script. -
Click Create to validate the parameter with the specified
attributes.
You cannot change the parameters' settings once they have been created.
-
Write the script using the available variables.
As you type, the editor offers an autocomplete feature based on type-related attributes, script parameters, known variables, or keywords.
-
Click to check for syntax and build-time
errors.
For more information on how to resolve the errors, see Troubleshooting.
- Click to save the script and Close to exit the dialog box.
Result: The logic parameter is created and the script is visible in the Script Code.