Condition

This page was last updated for version v1.2.0

Format

conditional (condition) ? execute-if-condition-is-true : execute-if-condition-is-false

Examples

  1. conditional (timer>=20) ? variable timer=0 : variable timer+=1

    Set the timer to 0 when the timer is greater than or equal to 20

    Add 1 to the timer when the timer is less than 20

  2. conditional (reverse==1 && x>90) ? variable reverse=0 : none

    Set reverse to 0 when reverse is equal to 1 and x is greater than 90

    Otherwise, do nothing

  3. conditional ((reverse==1 && x>90) || (reverse!=1 && x<0)) ? preset play-sound : none

    Play sound when (the reverse is equal to 1 and x is greater than 90) or (the reverse is not equal to 1 and x is less than 0)

    Otherwise, do nothing

You must put the conditions between ()

You cannot put a condition inside a condition but you can define a preset for that:

  • Create a preset in presets.yml (see Presets)

  • In your condition, put the preset into the correct place

Example

presets.yml

reverse: "conditional (stepY>60) ? variable reverse=0 : none"

effects.yml

..
scripts:
  - "conditional (reverse==1) ? preset reverse : none"
..

You can add mathematical equations in conditions:

  • Put the variables inside {} to enable equations

Example

- "conditional ({TIMER}%20==0) ? preset reset-things : return"

Last updated