Selector: Filter objects by variable

SelectorNo. 9262

Synopsis

Filters the object selection by an object variable: choose, for example, “Highest value” and the amount. Objects without the variable are dropped, and ties are settled by a fixed order. Useful to find the piece with the most points or the most used tile.

Step by step

Find the object with the most points

Boxes you need

  1. TriggerTrigger: Say something
  2. SelectorSelector: Filter objects by variable
  3. SelectorSelector: Selected objects
  4. EffectEffect: Give variable
  5. EffectEffect: Offset object position
  1. Configure an “Object variable” named “points”, with a value. Prepare two objects A and B with free destinations to their right.
  2. Create two setup stacks: “Says something” = “five” → “Give variable points”, initial value 5; “Says something” = “ten” → “Give variable points”, initial value 10. Manually select A in the first and B in the second. Say both words. Do not overwrite values.
  3. In the test stack, combine “Says something” = “move”, “Picked objects” (choose A and B), “Filter objects by variable” and “Move object by offset”. In the filter, choose “points”, “Highest value” and fixed quantity 1.
  4. In “Move object by offset”, use “Objects from selector”, X to the right by 1 tile, Y by 0 and delay 0. Save every box and say “move”. Keep each destination tile free.

Result: B moves because it has 10 points; A is excluded.

Settings

Settings window of “Selector: Filter objects by variable”
This box's window in the game (Spanish client).

Notes

  • The filter excludes targets without the variable. Ties are resolved by identifier.
  • Filter boxes always run after the selectors, regardless of height.
  • Selector: Filter users by variable drops anyone without the variable even if there's room left. Ties are broken by id.

Related