Skip to content

BLOCKS ACTION

BLOODWIING edited this page Aug 13, 2021 · 1 revision

List of ACTION Blocks

ACTION Blocks are runnable. They do some form of action and even though yield a value, can't be used as value blocks.


QUICK NAVIGATION


RETURN

RETURN Block

Sends a value down the chain of blocks.

value

ALLOWED TYPES: Any VALUE
Required

The return value of the block.

EXAMPLE

{
  "type": "RETURN",
  "value": 10.5
}

IF

IF Block

Solves the condition and runs one of the two set action blocks (or runs none at all if the condition is false and the else parameter is not set).

condition

ALLOWED TYPES: Any CONDITION
Required

The condition it needs to solve.

then

ALLOWED TYPES: Any ACTION
Required

The action block that is ran when the condition is true.

else

ALLOWED TYPES: Any ACTION

The action block that is ran when the condition is false. This parameter is optional - omitting this causes it to be null by default, which the IF block just skips then.

EXAMPLE

{
  "type": "IF",
  "condition": {
    "type": "NOT",
    "input": false
  },
  "then": {
    "type": "RETURN",
    "value": "Yes"
  },
  "else": {
    "type": "RUN",
    "name": "external"
  }
}

RUN

RUN Block

Runs an AMG!Function. Yields the value that was gotten from the function's RETURN block.

name

ALLOWED TYPES: String
Required

The name of the function to run.

parameters

ALLOWED TYPES: Dictionary[ Key: String, Value: Any VALUE ]

The parameters, which to use to run the function. This needs to be a dictionary, each key is the key of the parameter that's registered on the function's head, while every value is the actual value that will be attached for that key.

What value type to use for what key depends on the function's headers.

EXAMPLE

{
  "type": "RUN",
  "name": "colorize",
  "parameters": {
    "user_color": {
      "type": "PARAMETER",
      "name": "color"
    }
  }
}