Give

From Wiki of ZZT
Revision as of 02:05, 8 February 2021 by RT-55J (talk | contribs) (Yes, I verified the #give thing [command] thing in ZZT itself and in the source. You really can be :tooRich)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 is usually the name of a label to jump to, but can also be any other ZZT-OOP operation if desired.

@GemsForHealth

  1. end
touch
  1. take gems 10 tooPoor
  2. give health 50
  3. end
tooPoor

You're to poor to buy health!

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

Bugs and Quirks

[TODO: Verify and explain these]

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