Give

From Wiki of ZZT
Revision as of 02:13, 8 February 2021 by RT-55J (talk | contribs)
Jump to navigation Jump to search

#give and #take are ZZT-OOP commands for adding and subtracting to counters.

The syntax for the commands is:

#give <counter> <amount> [<command>] #take <counter> <amount> [<command>]

The following counters can be modified with #give and #take:

  • Health
  • Ammo
  • Gems
  • Torches (ZZT only)
  • Score
  • Time
  • Z (Super ZZT only)

If the result of the command would result in the counter having a value less than 0 or greater than 32767, then the result of the #give or #take operation is not stored, and the command is executed instead (if present). The command can be any ZZT-OOP command, but is usually the name of a label to jump to, as in the following example:

@GemsForHealth
#end
:touch
#take gems 10 tooPoor
#give health 50
#end
:tooPoor
You're to poor to buy health!

The command argument is rarely used with #give, though it is available to use if necessary.

Bugs and Quirks

[TODO: Verify and explain these]

  • The time counter is weird.
  • Visual glitches can occur when taking sufficiently large values.