The List includes block allows you to check if a specific element (text, number or boolean) is present in a given list, or if an option is part of the selection of a Single select or Multiple select variable (see Selection variables (single and multiple)).
This block is particularly useful for conditional checks, such as the presence of an object in an inventory or a value in a data collection.
๐ฅ Inputs
- list (List of Values, Single select or Multiple select): The list, or the selection variable, in which to search for the element.
- value (Text, Number, Boolean or Option): The element to search for in the list (its type depends on the content of the list). With a selection variable, the point offers the options of the variable: choose the one to test.
๐ค Outputs
- value (Boolean): Returns True if the element is present in the list, False otherwise. This output can be connected to a conditional block (If/Else) to trigger actions accordingly.
๐ก Example of use
Scenario: Checking an item in the player's inventory
- The player has an Items list containing ["Key", "Potion", "Sword"].
- The game must check if the player has the Key to open a door.
- The List contains block is configured with list = Objects and value = "Key".
- The value output returns True, indicating that the Key is indeed in the inventory.
- A Condition block uses this result to authorize the opening of the door.
โ๏ธ Technical Details
-
Behavior: This block does not modify the flow of the scenario but evaluates a condition. It has no stream input or output (in/out), only data input/output.
-
Type management: The type of the value entry automatically adapts to the content of the list (eg: Text for a list of strings, Number for a list of numeric values).
-
Selection variables: the output is True if the option chosen in value is part of the selection (the only option kept for a Single select, one of the checked options for a Multiple select). Handy to drive a Condition block from a Multiple choice block. This block does not accept a Date variable. Selection variables are available from Creator version 6.1.
Documented version: v2