version 5 by Michael Callaghan

  • Home page
  • Beginning
  • Previous
  • Next

  • Example: * Open Sesame - A short example to show the question rules with an initial open text question followed by an interview section to gather information about the player.
        "Open Sesame" by Michael Callaghan
        Include questions by Michael Callaghan.
        Canyon is a room. "You are at the far end of a canyon. A recent rock fall behind you prevents all further hopes of escape. A large boulder to the east emits a faint green light."
        A large boulder is a door. The large boulder is locked and closed.
        The large boulder is scenery. The description is "Inscribed in runic letters on the face of the boulder are the words 'Solve Oriel[']s Myth to find your way forward.'"
        Instead of doing anything other than examining with the large boulder:
            say "There is an aura of magic about the large boulder that prevents you doing this."
        Small cave is a room. "A flight of steps leads down into the darkness."
        The large boulder is east of the canyon and west of the small cave.
        Introduction is a scene.
        Introduction begins when play begins.
        Introduction ends when the large boulder is open.
        When introduction begins:
            follow the set open sesame rule.
        Every turn when introduction is happening (this is the set open sesame rule):
            now current question is "";
            now current prompt is ">";
            now punctuation removal is true;
            ask an open question, in text mode.
        A text question rule (this is the open sesame rule):
            if introduction is happening:
                if the current answer is "emily short":
                    say "With an eerie screech, the boulder rolls to one side.";
                    now the large boulder is open;
                    now the large boulder is unopenable;
        Room of requirements is a room. Room of requirements is down from the small cave. The description is "The room smells musty.[If unvisited] An alien presence invades your mind and deep in your bones you hear a voice echo 'Welcome brave soul. You have passed the first hurdle. Before you proceed, you must answer the following questions.'"
        Instead of doing anything when gathering is happening and stage is not complete:
            say "You are under a strange compulsion and unable to move."
        Data is a kind of value. The data are name, age, sex, character, finalise, seed and complete.
        Gathering is a scene. Gathering begins when the location is the room of requirements.
        Gathering ends when stage is complete.
        Stage is data that varies.
        When Gathering begins:
            now stage is name.
        Every turn during Gathering:
            if stage is name:
                now current question is "What is your name?";
                now current prompt is "Enter your name >";
                now punctuation removal is false;
                ask a closed question, in text mode;
            if stage is age:
                now current question is "How old are you?";
                ask a closed question, in number mode;
            if stage is sex:
                now current question is "Do you want to play as a male, female or neutral character";
                ask a closed question, in gender mode;
            if stage is character:
                now current question is "Which of the following is your preferred character type:";
                now current question menu is { "Wizard", "Warrior", "Sage", "Healer" };
                ask a closed question, in menu mode;
            if stage is finalise:
                say "You have chosen:[line break]Name: [player's name][line break]Age: [Player's age][line break]Sex: [Player's sex][line break]Character: [Player's character][paragraph break]";
                now current question is "Are you happy with your responses?";
                ask a closed question, in yes/no mode;
            if stage is seed:
                now current question is "Enter a seed number between 0 and 1:";
                ask a closed question, in real number mode.
        The player's name is indexed text that varies.
        The player's age is a number that varies.
        The player's sex is a gender that varies.
        The player's character is text that varies.
        The player's strength is a number that varies.
        A text question rule (this is the gather name rule):
            if gathering is happening and stage is name:
                if the number of words in the current answer is greater than 1:
                    say "I think we will simply refer to you as [word number 1 in the current answer][line break]";
                    now the player's name is word number 1 in the current answer;
                    now the player's name is the current answer;
                    say "Welcome to this venture, [player's name][line break]";
                now stage is age;
        A number question rule (this is the gather age rule):
            if gathering is happening and stage is age:
                if the number understood is less than 5:
                    say "It seems improbable that one of such tender years would be venturing so far.[line break]";
                if the number understood is greater than 111:
                    say "Let's try to be realistic about this.";
                now the player's age is the number understood;
                say "Thank you: You are [the player's age] for the remainder of your venture into the unknown[line break]";
                now stage is sex;
        A gender question rule (this is the gather gender rule):
            if gathering is happening and stage is sex:
                now the player's sex is the gender understood;
                say "Thank you. You are [the player's sex] gender[line break]";
                now stage is character;
        A menu question rule (this is the gather character rule):
            if gathering is happening and stage is character:
                let temp be the number understood;
                now the player's character is entry temp in the current question menu;
                say "Thank you, you are playing as a [player's character][line break]";
                now stage is finalise;
        A yes/no question rule (this is the confirm answers rule):
            if gathering is happening and stage is finalise:
                if the decision understood is Yes:
                    say "Thank you.";
                    now stage is seed;
                    say "OK. Let's start again, shall we[line break]";
                    now stage is name;
        A real number question rule (this is the seed rule):
            if gathering is happening and stage is seed:
                if the real number understood is 0.0:
                    say "The number must be more than 0";
                if the real number understood < 0.0:
                    say "The number must be more than 0";
                if the real number understood is 1.0:
                    say "The number must be less than 1.";
                if the real number understood > 1.0:
                    say "The number must be less than 1.";
                let seed be the real number understood;
                repeat with counter running from 1 to a random number from 5 to 10:
                    now seed is seed times 997;
                    now seed is seed minus floor of seed;
                now seed is seed times 100;
                now seed is floor of seed;
                now player's strength is seed to the nearest whole number;
                say "Your strength has been set to [player's strength].";
                now stage is complete;
                say "Venture into the unknown brave [player's character].";
        Test me with "x boulder / push boulder/ say Emily Short / e / d / Peter / 34 / M / 3 / Y / 0.23448".