Options
Make thresholds and lists configurable, and read them in conditions and messages.
Options make one rule reusable with different values. Declare each in options, with a type, a default and a description:
"options": {
"min": { "type": "number", "default": 25, "description": "Lowest allowed scale, in percent." },
"includeAudio": { "type": "boolean", "default": true, "description": "Also check audio clips." },
"allow": { "type": "string[]", "default": ["AE.ADBE Crop"], "description": "Match names allowed to repeat." }
}| Type | Holds |
|---|---|
number | a number |
string | a string |
boolean | true or false |
number[] | a list of numbers |
string[] | a list of strings |
json | any JSON value, read by computed scopes only |
The default must have the declared type. Change an option's value by editing the rule (see Custom rules).
Reading an option
An option is the field options.<name>. Use it as a value in a condition, as a placeholder in a message, or in data:
{
"condition": { "field": "clip.scale", "operator": "lessThan", "value": { "field": "options.min" } },
"message": "Clip \"{clip.name}\" is scaled to {clip.scale} %, below {options.min} %."
}List options
A list option is the value of in or notIn, and nothing else:
{ "field": "effect.matchName", "operator": "notIn", "value": { "field": "options.allow" } }A switch for part of a rule
A boolean option that turns a part of the rule on or off is an alternative in the condition. The built-in Tiny clips rule checks audio clips only when includeAudio is on:
{
"any": [
{ "field": "clip.trackType", "operator": "equals", "value": "video" },
{ "field": "options.includeAudio", "operator": "equals", "value": true }
]
}Add it to the check's all with the other conditions.