Skip to content

Conditional Elements

Konicai edited this page Oct 31, 2022 · 1 revision

Currently there are two optional elements that can be conditionally shown to the player:

  • Buttons in simple forms
  • Components of custom forms

The following config keys can be added to the entries of the above elements. They are not required and by default the elements will always be shown to the player.

Default values:

  • should-show: empty
  • strip-formatting: false
  • mode: AND
# A list of placeholders that return some form of true or false. They determine whether or not the element is shown.
should-show:
  - A placeholder
  - Another
  ...

# Strip text formatting that uses the section character (§) from the parsed text in should-show
# For example, you may need this if a placeholder returns a coloured true or false.
strip-formatting: <boolean>

# AND - All placeholders must parse to some form of true
# OR - At least one placeholder must parse to some form of true
mode: <AND or OR>

The results of parsing should-show are all converted to lowercase before being coerced to true or false. After that, the following values can be coerced to true or false.

true: true, yes, on
false: false, no, off

Example

should-show: "%jobsr_user_isin_Constructor%"
strip-formatting: true

The placeholder is initially parsed to §False because the player is not in the Constructor job. strip-formatting is enabled, so the result is converted to False. This is then converted to lowercase, which matches false. In this example, there was only one placeholder which returned false, so the element is not shown to the player.