From 38a07a4ca584e2cccc2c2814c35266ba33d692c8 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 19 Aug 2012 20:00:10 +0400 Subject: Export the tile finder function to lua, and improve mouse event reporting. --- Lua API.html | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'Lua API.html') diff --git a/Lua API.html b/Lua API.html index ebb8a14d..610202ce 100644 --- a/Lua API.html +++ b/Lua API.html @@ -1398,24 +1398,28 @@ be feasibly used in the core context.

  • dfhack.screen.getMousePos()

    Returns x,y of the tile the mouse is over.

  • +
  • dfhack.screen.inGraphicsMode()

    +

    Checks if [GRAPHICS:YES] was specified in init.

    +
  • dfhack.screen.paintTile(pen,x,y[,char,tile])

    Paints a tile using given parameters. Pen is a table with following possible fields:

    ch
    -

    Provides the ordinary tile character. Can be overridden with the char function parameter.

    +

    Provides the ordinary tile character, as either a 1-character string or a number. +Can be overridden with the char function parameter.

    fg
    -

    Foreground color for the ordinary tile. Defaults to 7.

    +

    Foreground color for the ordinary tile. Defaults to COLOR_GREY (7).

    bg
    -

    Background color for the ordinary tile. Defaults to 0.

    +

    Background color for the ordinary tile. Defaults to COLOR_BLACK (0).

    bold
    -

    Bright/bold text flag. If nil, computed based on (fg & 8); fg is reset to 7 bits. +

    Bright/bold text flag. If nil, computed based on (fg & 8); fg is masked to 3 bits. Otherwise should be true/false.

    tile
    -

    Graphical tile id. Ignored unless [GRAPHICS:YES] in init.txt.

    +

    Graphical tile id. Ignored unless [GRAPHICS:YES] was in init.txt.

    tile_color = true

    Specifies that the tile should be shaded with fg/bg.

    @@ -1435,6 +1439,12 @@ in sequence to override the ch field of pen.Fills the rectangle specified by the coordinates with the given pen. Returns true if painting at least one character succeeded.

  • +
  • dfhack.screen.findGraphicsTile(pagename,x,y)

    +

    Finds a tile from a graphics set (i.e. the raws used for creatures), +if in graphics mode and loaded.

    +

    Returns: tile, tile_grayscale, or nil if not found. +The values can then be used for the tile field of pen structures.

    +
  • dfhack.screen.clear()

    Fills the screen with blank background.

  • @@ -1488,6 +1498,15 @@ In order to make a see-through dialog, call self._n If any keys are pressed, the keys argument is a table mapping them to true. Note that this refers to logical keybingings computed from real keys via options; if multiple interpretations exist, the table will contain multiple keys.

    +

    The table also may contain special keys:

    +
    +
    _STRING
    +

    Maps to an integer in range 0-255. Duplicates a separate "STRING_A???" code for convenience.

    +
    +
    _MOUSE_L, _MOUSE_R
    +

    If the left or right mouse button is pressed.

    +
    +

    If this method is omitted, the screen is dismissed on receival of the LEAVESCREEN key.

    -- cgit v1.2.1