Graphic Links

version 2 by Jeff Sheets

  • Home page
  • Beginning



  • Documentation

    Graphic Links allows us to apply actions to rectangular regions of the graphical window provided by Emily Short's Simple Graphical Window. Two phrases can be used to maintain the list of graphlinks.

        set a graphlink identified as "myLink" from 0 by 0 to 10 by 10 as "wait";
        clear the graphlink identified as "myLink".

    The first line adds a graphlink called "myLink" to the table of graphlinks. This link will reproduce the wait command, and is active in the square area from 0,0 (the top left corner) to 10,10 (implying a size of 11 pixels by 11 pixels). The order of the coordinates is Top by Left to Bottom by Right.

    One can create much more complex graphlink rules by adding custom rules to the clicking graphlink rulebook. The default, however, allows us to use the previously mentioned phrases to set up simpler graphlinks. As an example of how to construct such a rule, the following is provided:

        The first clicking graphlink rule (this is the up graphlink rule):
            choose row with arrowcode of "U" in the Table of arrow offsets;
            if current graphlink x >= xoffset entry and current graphlink x <= xmax entry and current graphlink y >= yoffset entry and current graphlink y <= ymax entry
            begin;
                if the room up from the location is not nothing
                begin;
                    now the glulx replacement command is "up";
                    rule succeeds;
                end if;
            end if;
            now the glulx replacement command is "".

    The system assumes that space for 25 graphlinks is sufficeint for most purposes, but one can always use something like the following to increase the number of graphlinks available:

        Table of Graphlink Glulx Replacement Commands (continued)
      linkid  p-top  p-bottom  p-left  p-right  replacement  
      with 25 blank rows  

    This example would increase the number of available graphlinks to 50. Note that this table has nothing to do with any custom rules added to the clicking graphlink rulebook.