Table of Contents

ZZT Enhancer's ZZT-OOP enhancements

This article is a stub. You can help by reverse-engineering things.

General principles

Variables

TODO (potential names: lastmx, lastmy, songpos, songrow, songvol, enhancer, playerx, playery, playerdist)

String IDs

ID String
7 Torches:
8 Gems:
11 T
25 Torch

TODO: Complete list.

Commands

n, s, e, w, ne, sw, se, nw

Move while preserving background color.

TODO

tn, ts, te, tw, tne, tsw, tse, tnw

TODO

activate

Takes two arguments.

add

Syntax: add “variable” x

Adds x to “variable”.

addcstat

Syntax: addcstat ypos color char name “variable”

Adds a stat to the sidebar, at Y position ypos, with an icon color, char, name name, tracking variable “variable”.

allocscreen

Syntax: allocscreen number_of_screens

Allocate number_of_screens screens, addressable from 0 to number_of_screens - 1.

becomeb

Syntax: becomeb element color.

Becomes a statless element of color color.

becomeo

Syntax: becomeo element_id color ??? ??? ???

Becomes a statted element with the specified parameters.

bgfade

Takes four arguments.

blinkmode

Takes one argument.

border

Takes one argument.

changeb

Syntax: changeb from_element from_color to_element to_color.

Changes all instances of a given element ID and color to the other element ID and color. ? may be used as a wildcard in from_color. Faster than ZZT #change.

TODO: Can ? be used elsewhere?

charedit

Takes three arguments.

charid

Syntax: charid element_id char_id

Changes the rendering character for element_id to char_id.

TODO: Does this work on elements with custom rendering logic? (Text, objects, etc.)

chstr

Syntax: chstr string_id contents

Replaces the string with ID string_id with contents.

color, colour

Syntax: color x

Sets the color value of the tile to x.

colorxy, colourxy

Takes three arguments.

cropscreen

Syntax: cropscreen screen_index x1 y1 width height x2 y2

TODO

defaultpal

Takes no arguments.

delete

Syntax: delete “variable”

Deletes the variable “variable”.

deletecstat

Seemingly not implemented as of Enhancer 0.3b. TODO: Verify

Syntax: deletecstat ypos

Removes the custom stat at ypos.

dieitem

Syntax: dieitem

Destroys the object and moves stat 0 - the player - to its location.

divide

Syntax: divide “variable” x

Divides “variable” by x.

dualfont

Takes no arguments.

dup

Takes three or four arguments.

enhance

Syntax: enhance [16-byte lower-case hex value]

TODO

Takes one argument.

eraseplayer

Takes no arguments.

extern

Takes between one and eight arguments.

externc

Takes between one and eight arguments.

freescreen

Syntax: freescreen.

Deallocate all allocated screens. The opposite of allocscreen.

freewav

Takes one argument.

global

Takes no arguments.

goto

Takes one argument.

if

Operators:

ifat

Syntax: ifat x y element color command.

If, at location x, y, there is an element element of color color, execute command.

ifbup

Takes two arguments.

ifoat

Takes six arguments.

ifoup

Takes four arguments.

jump

Takes two arguments.

keyvar

Takes two arguments.

keyvard

Takes one argument.

loadfont

Takes two arguments.

loadfontres

Takes two arguments.

loadpal

Takes one argument.

loadpalres

Takes one argument.

loadscreen

Takes one argument.

loadscreenres

Syntax: loadscreenres screen_index resource_index

Loads screen from resource resource_index to slot screen_index.

loadwav

Takes two arguments.

loadwavres

Takes two arguments.

lockplayer

Takes one argument.

mainfont

Takes one argument.

mod

Takes two arguments.

mousepoll

Takes one argument.

moveplayer

Syntax: moveplayer x y

Moves the player to location x, y.

moveplayerhere

Takes no arguments.

multiply

TODO: Is mul also valid?

Syntax: multiply “variable” x

Multiplies “variable” by x.

playerchar

Syntax: playerchar char_id.

Sets the player character to char_id.

playercharn, playerchars, playerchare, playercharw

Takes one argument.

playercol

Syntax: playercol color.

Sets the player color to color (0 - 255).

playsong

Syntax: playsong filename.

Plays the song filename.

playsongres

Syntax: playsongres resource_index.

Playes the song at asset index resource_index.

playwav

Takes five arguments.

putblock

Syntax: putblock x y element color.

Place a statless element of color color at position x, y.

putcolor, putcolour

Takes three arguments.

putmes

Takes three arguments.

putobj

Syntax: putobj x y element_id color ??? ??? ???

Place a statted element with the specified parameters at location x, y.

putobjup

Syntax: putobjup element_id color ??? ??? ???

TODO

putsave

Takes five arguments.

puttext

Syntax: puttext x y color text

Puts the “text” string in color color location x, y.

putval

Takes four arguments.

random

Takes two arugments.

rel

Takes the following types of arguments: player, self, or <x> <y>.

Makes future “x, y” location arguments be calculated relative to the provided target.

restorescreen

Syntax: restorescreen screen_index x y.

Restores the screen slot screen_index to (x, y).

rgb

Syntax: rgb id r g b

Set the color id to color values r, g, b (range 0-63).

savescreen

Syntax: savescreen screen_index x1 y1 x2 y2.

Saves the screen area from (x1, y1) to (x2, y2) to the screen slot screen_index.

scrollchar

Takes four arguments.

secfont

Takes one argument.

set

Syntax: set “variable” x

Sets the variable “variable” to the value x.

setcoli

Syntax: setcoli c x

Sets the intensity of color c to x (0 - 100).

setmusicvol

Syntax: setmusicvol x

Sets the music volume to x (0 - 100).

setpali

Syntax: setpali x

Sets the global palette intensity to x (0 - 100).

setsongpos

Takes one argument.

singlefont

Takes no arguments.

showpal

Takes no arguments.

statvar

Takes two arguments.

stopsong

Stops the currently playing song.

subtract

Syntax: subtract “variable” x

Subtracts x from “variable”.

teleport

Takes four arguments.

uneraseplayer

Takes two arguments.

unlockplayer

Takes no arguments.

varstat

Takes two arguments.

walk

Syntax: walk x y

Sets the walking direction to x, y. For instance, walk -1 -1 will cause the object to walk north-west.

walkxy

Takes four arguments.