Give: Difference between revisions

From Wiki of ZZT
Jump to navigation Jump to search
(Yes, I verified the #give thing [command] thing in ZZT itself and in the source. You really can be :tooRich)
 
(fixed the code box)
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 is usually the name of a [[Label|label]] to jump to, but can also be any other ZZT-OOP operation if desired.
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 can be any ZZT-OOP command, but is usually the name of a [[Label|label]] to jump to as in the following example:


<code>
<nowiki>@GemsForHealth
@GemsForHealth<br>
#end
#end<br>
:touch
:touch<br>
#take gems 10 tooPoor
#take gems 10 tooPoor<br>
#give health 50
#give health 50<br>
#end
#end<br>
:tooPoor
:tooPoor<br>
You're to poor to buy health!</nowiki>
You're to poor to buy health!
</code>


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


== Bugs and Quirks ==
==Bugs and Quirks==


[TODO: Verify and explain these]
[TODO: Verify and explain these]


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


{{ZZT-OOP navbox}}
{{ZZT-OOP navbox}}

Revision as of 02:09, 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 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 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.