any is an internal flag in ZZT-OOP. When called, it scans the entire board for matching entities, and evaluates to true if at least one instance is found. any can detect anything with a ZZT-OOP name, and a color argument can be specified as well. If an invalid object kind is provided, any will throw a Bad object kind error.
- any does not look beneath statted entities, so it's possible for it to miss things that are under objects, such as fake walls.
This object changes its char graphic whenever there is at least one (bright) red gem on-screen.
@object #cycle 1 :loop #if any red gem char 2 #if not any red gem char 1 /i#loop
Note that any scans the entire board, so overusing it can be computationally intensive. Putting the
/i in the code makes it so the object executes the loop only once per cycle, which helps avoid redundant any checks from wasting processing power.