Set: Difference between revisions
(still needs a code example and probably some cleanup) |
(added example. put in mid-explanation to avoid giving impression the example pertained to using cheat prompt.) |
||
Line 6: | Line 6: | ||
The presence of a flag can be detected using the [[if|#if]] command. | The presence of a flag can be detected using the [[if|#if]] command. | ||
For example: | |||
<pre>#set flag | |||
#if flag /e | |||
#if not flag /w | |||
</pre> | |||
The object in this scenario will move east, but will not move west. | |||
Using the <code>?</code> cheat prompt, the player can type <code>+flag</code> or <code>-flag</code> to set and clear flags. | Using the <code>?</code> cheat prompt, the player can type <code>+flag</code> or <code>-flag</code> to set and clear flags. |
Revision as of 06:39, 12 February 2021
The ZZT-OOP commands #set and #clear are used to set and clear flags from the world's flag list. Flags are strings limited to 20 characters in length, and only 10 flags can be set at a time. Internally, flags are converted into uppercase when set.
When using #set flag
, ZZT checks to see if the flag has already been set. If it has been set already, then it does not set the flag again. If the flag has not been already set, then the flag is set in the first open flag slot. If no flag slot is open, then the last flag is overwritten.
The #clear flag
command removes the flag from the flag list, replacing it with an empty string. Given how small the flag limit is, but sure to #clear flags when you are done with them. (If the flag list has been modified in an eternal editor to have multiple flags with the same name, then the last flag with the name will be removed.)
The presence of a flag can be detected using the #if command.
For example:
#set flag #if flag /e #if not flag /w
The object in this scenario will move east, but will not move west.
Using the ?
cheat prompt, the player can type +flag
or -flag
to set and clear flags.
Super ZZT
In Super ZZT the flag limit has been increased to 16. Additionally, a flag prefixed with the letter "Z" can serve as the name for the Stones of Power counter. (Note that Super ZZT expects the initial "Z" to be uppercase, so keep that in mind if you choose to use an external editor to have the name of the Stones counter be mixed-case.)
ZZT-OOP | |
---|---|
Prefixes |
|
Messages | |
Directions | |
Flags | |
Commands |