Glimmr Canvas-Based Drawing

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Part - Debugging commands for image-maps

    Chapter - Dumping image-map data (not for release)

    Dumping imap is an action out of world applying to one visible thing. Understand "image-map [any image-map]" or "[any image-map]" or "image map [any image-map]" as dumping imap.

    Understand "image-map [text]" or "image map [text]" as a mistake ("That image-map could not be found. If this is not a typo, you may need to assign it the 'publically-named' property.").
        
    Carry out dumping imap:
        let rules-altered be false;
        let image-map-width be a number;
        let image-map-height be a number;
        let total-length be a number;
        say "[line break]";
        if intensive rules tracing is active:[we disable RULES ALL temporarily to avoid the enumeration of each iteration through the loops that build the data dump.]
            now rules-altered is true;
            suspend rules tracing;
        if the noun is a tileset image-map:
            now image-map-width is the number of entries of entry 1 of the tile-array of the noun;
            now image-map-height is the number of entries in the tile-array of the noun;
            now total-length is image-map-width * image-map-height;
            say "Showing data for [i][noun][/i], a tileset image-map assigned to [the associated canvas of the noun]. Map ([image-map-width] x [image-map-height] = [total-length] tiles) rendered using tileset [associated tileset]; tiles measure [desired tile-width of noun] x [desired tile-height of noun] canvas units. [if the noun is graphlinked] Graphlink [quotation mark][linked replacement-command of noun][quotation mark] applies to entire map.[end if][line break]Tile-array data:[paragraph break]";
        if the noun is a direct image-map:
            now image-map-height is the number of entries in the figure-array of the noun;
            now image-map-width is the number of entries in entry 1 of the figure-array of the noun;
            now total-length is image-map-width * image-map-height;
            say "[>console][CBD]Showing data for [i][noun][/i], a direct image-map assigned to [associated canvas of the noun]. Map ([image-map-width] x [image-map-height] = [total-length] tiles) rendered using tileset [associated tileset]; tiles measure [desired tile-width of noun] x [desired tile-height of noun] canvas units.[if the noun is graphlinked] Graphlink [quotation mark][linked replacement-command of noun][quotation mark] applies to entire map.[end if] Figure-array data:[paragraph break][<]";
        let scan be 0;
        let row-count be 1;
        say "[fixed letter spacing][run paragraph on]";
        if the noun is a tileset image-map:
            say " ";
            repeat with count running from 1 to the image-map-width:
                say "[if count < 100] [end if][count][if count < 100] [end if][if count < 10] [end if]";
            repeat with current-row running through the tile-array of the noun:
                say "[line break][row-count][appropriate spacing for row-count]";
                repeat with item running through current-row:
                    if item is 0:
                        say "... ";
                    otherwise if item < 10:
                        say " [item] ";
                    otherwise if item < 100:
                        say " [item] ";
                    otherwise:
                        say "[item] ";
                increment row-count;
        if the noun is a direct image-map:
            let row-count be 1;
            repeat with current-row running through the figure-array of the noun:
                say "[row-count]: ";
                repeat with item running through current-row:
                    say "[item], ";
                say "[line break]";
                increment row-count;
        say "[variable letter spacing]";
        say line break;
        if the noun is tile-graphlinked:
            let row-count be 1;
            repeat with current-row running through the linked command array of the noun:
                repeat with column-count running from 1 to the number of entries in current-row:
                    unless entry (column-count) of current-row is "":
                        say "[one of][line break][The noun] has individual graphlinks defined for the following tiles (given in the image-map's internal tile coordinates):[line break][or][stopping]([column-count], [row-count]) [quotation mark][entry column-count of current-row][quotation mark][line break]";
                increment row-count;
            say "[line break]";
        if rules-altered is true:
            activate intensive rules tracing.
            
    To say appropriate spacing for (N - a number):
        if N < 10:
            say " ";
        otherwise if N < 100:
            say " ";
        otherwise:
            say " ".