type AdvancedConditionGroup = {
logic: string // "and" or "or"
conditions: AdvancedConditionItem[]
}
type AdvancedConditionItem = {
type: string // "comparison" or "group"
left?: string // comparison only
operator?: string // comparison only: any if_statement condition, e.g. "equals (=)" or "contains (case insensitive)"
right?: string // comparison only
group?: AdvancedConditionGroup // group only
}
Advanced Conditional
ConditionLogic
Run different blocks based on grouped comparisons.
- Condition block: the blocks placed inside it only run when the condition is met.
Inputs
ConditionsRequired
Conditions
Set up in the editor. The JSON format is under advanced documentation below.
If True
Blocks to run when the conditions evaluate to true.
Holds blocks
If False
Blocks to run when the conditions evaluate to false.
Holds blocks
Outputs
Result
Whether the conditions evaluated to true or false.
Example: true
Build a bot using blocks like Advanced Conditional
Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.
Advanced Documentation
This documentation can be useful when using code mode. View as Markdown
ID:
advanced_conditional- Condition block: write
if advanced_conditional(Args{...}) { ... }, or use it as a"true"/"false"value. See conditions.
Inputs
| Field | InventScript name | Value |
|---|---|---|
| Conditions | conditions | JSON text |
| If True | if_true | blocks: func() { ... } |
| If False | if_false | blocks: func() { ... } |
conditions format: JSON text of type AdvancedConditionGroup. Fields marked ? are optional.Outputs
| Field | InventScript name | Value |
|---|---|---|
| Result | result | e.g. "true" |
Example InventScript
if "a" == "a" {
send_text_message(Args{channel_id: trigger.channel_id, message_content: "Yes"})
}
More logic blocks
LoopRun the nested blocks a fixed number of times.While LoopRepeat blocks while a condition is true.If StatementCompare two values and run different blocks based on the result.Conditional ValueCompare two values and output one of two values based on the result.FolderOrganize blocks into a folder. Creates a variable scope.BreakStop the current loop and continue with the blocks after it.ContinueSkip the rest of this loop iteration and move to the next one.Exit FlowStop the entire flow immediately. No further blocks will run.Call Custom BlockCall a custom block and use its returned outputs.ReturnReturn outputs from the current custom block and stop executing it.