|
|
|
When you select an Variable setting and open the advanced options panel at the bottom, you will get an editor panel like this:
- Enabled
- Determines if this variable is enabled or disabled.
- Name
- This is the name of the variable. To access the value stored in the variable within a script, you would use @name.
- Value
- This is the value of the variable. This editor can change depending upon the variable "Type" as described below.
- Text / XML / Compiled Code
- Selecting the Compiled Code tab will show the low-level code generated by this variable (for inline functions). This is for internal testing purposes and is not documented further. Selecting the XML tab will allow you to edit the raw XML data used for copy/paste and import/export.
- Type
- This is the variable type, discussed in more detail below.
- Default
- This is the default value for the variable. If the Use Default option is checked, then the variable is initialized to this default value when the session is loaded (or when the #RESET command is used).
- Use Default
- Determines if the Default value overwrites the current value when the session is loaded.
- Params
- The list of Named Arguments for user-defined functions. As with Aliases, this is a list of argument names, separated by commas. The $ at the beginning of each argument name is optional.
- Notes
- Used to store comments with the variable. You might use this to remind yourself what the variable is used for.
Variable Types
Normally, CMUD variables are set to "AutoType", which allows CMUD to automatically convert between numbers and strings as needed by your scripts. However, in some cases you might wish to explicitly set the type of the variable. Also, some variables, such as string lists and database variables, will be set to the proper type when created by various scripting commands, such as #ADDITEM or #ADDKEY.
Here is a description of each variable type:
- AutoType
- The default type of a variable. Such a variable will be automatically converted to a string or number as needed by your script
- Integer
- Variable is always treated as an Integer value
- String (expanded)
- Variable is treated as a string value, and any variable references or function calls within the string are expanded
- String (literal)
- Variable is treated as a string value, and any special characters such as @ or % are treated as literal characters and are not expanded.
- String list
- Variable is treated as a string list, and the string list editor is displayed:
The + button can be used to insert an item into the list, and the - button can be used to delete an item from the list. To add an item to the end of the list, just click on the last blank item and start typing. To change the order of items in the list, drag/drop the number to the left of the item name to the new position that you wish.
- Database record
- Variable is treated as a database variable, and the database editor is displayed:
The + button can be used to insert a new Key/Value pair, and the - button can be used to delete a Key/Value pair. To add a new Key/Value pair to the end of the variable, just click on the last blank item and start typing. To change the order of items in the list, drag/drop the number to the left of the Key field to the new position that you want.
- Array
- Variable is a COM array type. Currently, arrays cannot be edited directly in the settings editor
- Float
- Variable is treated as a floating-point value.
- COM object
- Variable is a reference to a COM object. COM objects cannot be edited directly in the settings editor.
|
|