Inventory Window

version 6 by Jon Ingold

  • Home page
  • Beginning



  • Documentation

    This extension is a corollary to Flexible Windows, which is a system designed to allow the author to open and close multiple windows throughout the course of the game. This extension provides an Inventory window (in fact, a side window which could be used for any text purposes, but by default displays the inventory), and the necessary functionality for including a graphical panel as well, by using Emily Short's Simple Graphical Window.

    An inventory window is created automatically by including the extension. Its look can be specified using three properties of the inventory-window g-window object:

        The scale method of the inventory-window... either g-proportional or g-fixed-size
        The measurement of the inventory-window... either a proportion (%) of the main window, or a width/depth in characters
        The minimum size of the inventory-window... a minimum width/depth the window will never go below (regardless of proportional size)

    By default a window is proportional at 40% with minimum size 15.

    Further properties available:
        
        The position of the inventory-window... g-above, g-left, g-below, g-right. Defines where the window is placed.
        The back-colour of the inventory-window... From the table included in the extension: values such as g-green.

    A window can be made bordered, by declaring

        The inventory-window is a bordered g-window.
        The border-colour of the inventory-window... A colour, as above
        The border-measure of the inventory-window... A depth, in pixels

    Defining the graphical window follows the same lines as Simple Graphical Window, despite the overlap between the two, and setting the above properties for the graphics-window will have no effect (they will be overwritten), unless the use option

        Using Flexible Window-style definitions

    is declared.

    Controlling the graphical output is exactly the same as with the original Simple Graphical Window extension.

    ----

    Neither window will open automatically. To place the inventory-window and the graphics-window, declare

        open up the inventory-window
        open up the graphics-window

    It can be closed again by writing

        shut down the inventory-window

    The same applies for the graphical panel although the graphical panel is a subwindow of the inventory window. If you require just a graphics panel, use Simple Graphical Window or defined the measurement of the graphics-window to be 100. (But to affect its placing, you'll need to change the position of the inventory-window, not the graphics-window!)

    The default behaviour of the inventory window is to reprint the player's inventory at the end of every turn. This is done by the "default print inventory to inventory window rule". If you wanted to change this behaviour, you can unlist this rule, and write a new "window-drawing rule for the inventory-window" to do whatever you like.

    The replacement rule should always start with the instruction

        set focus to inventory-window, clearing the window

    (Comma'd option is optional, of course). Then finish with
        
        return to main window.

    In case where rules vary depending on where we are printing, we can test for the name of the "current g-window".