Adventure Book

version 1/110101 by Edward Griffiths

  • Home page
  • Beginning
  • Previous



  • Section 7 -- Debugging - Not for release

    [For authors only. We allow commands to print the names of unwritten pages, to give or remove individual flags or inventory items, to give or remove ALL flags and inventory items, and to turn directly to the page of our choice.]

    [First we define commands for all debugging commands.]

    Table of Commands (continued)
    topic  
    "report"  
    "skip to [any page]"  
    "list pages/flags/items"  
    "list magic words"  
    "give [any flag]"  
    "give all"  
    "remove [any flag]"  
    "remove all"  
    "page names on/off"  

    [Printing a report is the most involved activity.]

    Printing a report is an action applying to nothing.

    Understand "report" as printing a report.

    Carry out printing a report:
        say "Searching for pages that don't have any option to continue...";
        repeat with x running through pages:
            if x is unwritten and x is not special:
                say "[line break][x] has no options to continue.[line break]";
                repeat with y running through choices that trigger x:
                    if y is not a use:
                        say "* The choice '[the initial appearance of y]' for [the parent of y] triggers [x].[line break]";
                    otherwise:
                        say "* A use for [the tool of y] for [the parent of y] triggers [x].[line break]";
                repeat with y running through pages that are followed by x:
                    say "* [y] is followed by [x]. [line break]";
        say "[line break]Searching for pages that can't be reached:[line break]";
        repeat with x running through pages:
            if x is unreachable and x is not special, say "[x][line break]";
        say "[line break]Finished."

    To decide if (possibility - a page) is unreachable:
        if something triggers possibility, decide no;
        if something is followed by possibility, decide no;
        decide yes;

    [Skiping to a given page is no sweat.]

    Skipping to is an action applying to one visible thing. Understand "skip to [any page]" as skipping to.

    Carry out skipping to something:
        turn to the noun;

    [We can make up a big list of all pages, flags, inventory items, and magic words.]

    Listing pages is an action applying to nothing. Understand "list pages" as listing pages.

    Carry out listing pages:
        say "Pages in the story:[line break]";
        repeat with x running through pages:
            say "[x][line break]";

    Listing flags is an action applying to nothing. Understand "list flags" as listing flags.

    Carry out listing flags:
        say "Flags:[line break]";
        repeat with x running through flags:
            if x is not an inventory item, say "[x]: [if x is on]ON[otherwise]OFF[end if][line break]";

    Listing items is an action applying to nothing. Understand "list items" as listing items.

    Carry out listing items:
        say "[line break]Inventory Items:[line break]";
        repeat with x running through inventory items:
            if x is not a magic word, say "[x][line break]";

    Listing magic words is an action applying to nothing. Understand "list magic words" as listing magic words.

    Carry out listing magic words:
        say "[line break]Magic Words:[line break]";
        repeat with x running through magic words:
            say "[x][line break]";

    [Giving and removing. Very simple; just flip the switch the player indicates and rebuild the list of choices.]

    Understand the command "give" as something new. Understand the command "remove" as something new.

    Flagsetting is an action applying to one visible thing. Understand "give [any flag]" as flagsetting.

    Carry out flagsetting something:
        set the noun;
        rebuild the list of choices;
        say "Done.[line break]";
        try looking;

    Setting all is an action applying to nothing. Understand "give all" as setting all.

    Carry out setting all:
        repeat with x running through flags:
            set x;
        rebuild the list of choices;
        say "Done.[line break]";
        try looking;

    Flagclearing is an action applying to one visible thing. Understand "remove [any flag]" as flagclearing.

    Carry out flagclearing something:
        clear the noun;
        rebuild the list of choices;
        say "Done.[line break]";
        try looking;

    Clearing all is an action applying to nothing. Understand "remove all" as clearing all.

    Carry out clearing all:
        repeat with x running through flags:
            clear x;
        rebuild the list of choices;
        say "Done.[line break]";
        try looking;

    [We can list page names while we're debugging.]

    Turning on page names is an action applying to nothing. Understand "page names on" as turning on page names.

    Carry out turning on page names:
        now pagenames is on;
        say "Page names on."

    Turning off page names is an action applying to nothing. Understand "page names off" as turning off page names.

    Carry out turning off page names:
        now pagenames is off;
        say "Page names off."

    Adventure Book ends here.