Any: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{DISPLAYTITLE:any}} '''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...") |
No edit summary |
||
Line 3: | Line 3: | ||
'''any''' does not look beneath statted entities, so it's possible for it to miss things that are under objects, such as fake walls. | '''any''' does not look beneath statted entities, so it's possible for it to miss things that are under objects, such as fake walls. | ||
== Usage Example == | == Usage Example == | ||
Line 17: | Line 16: | ||
/i#loop | /i#loop | ||
</pre> | </pre> | ||
Note that '''any''' scans the entire board, so overusing it can be computationally intensive. Putting the <code>/i</code> 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. | |||
{{ZZT-OOP navbox}} | {{ZZT-OOP navbox}} |
Revision as of 04:49, 8 February 2021
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.
any does not look beneath statted entities, so it's possible for it to miss things that are under objects, such as fake walls.
Usage Example
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.
ZZT-OOP | |
---|---|
Prefixes |
|
Messages | |
Directions | |
Flags | |
Commands |