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

FieldInventScript nameValue
ConditionsconditionsJSON text
If Trueif_trueblocks: func() { ... }
If Falseif_falseblocks: func() { ... }
conditions format: JSON text of type AdvancedConditionGroup. Fields marked ? are optional.
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
}

Outputs

FieldInventScript nameValue
Resultresulte.g. "true"

Example InventScript

if "a" == "a" {
	send_text_message(Args{channel_id: trigger.channel_id, message_content: "Yes"})
}

More logic blocks