Give: Difference between revisions

From Wiki of ZZT
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 16: Line 16:
* Z (''Super ZZT'' only)
* 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|label]] to jump to, as in the following example:
If the '''#give''' or '''#take''' would result in the counter having a value less than 0 or greater than 32767, then the result of the 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|label]] to jump to, as in the following example:


  <nowiki>@GemsForHealth
  <nowiki>@GemsForHealth

Revision as of 02:15, 8 February 2021

#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 #give or #take would result in the counter having a value less than 0 or greater than 32767, then the result of the 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.