Adventure Book

version 1/110101 by Edward Griffiths

  • Home page
  • Beginning
  • Previous
  • Next



  • Example: * Simple Choices - The basics of setting up a story with choices.

    This is a simple example of how to set up branching text - no flags or inventory items required. If you can understand how this works, then you're ready to start writing your own stories.

    Notice that there is a lot of repetition between pages in this story when the events of the previous pages don't have much influence on the current state of the story, but it does influence later events. If we used flags - say, a flag to tell whether or not the grandmother has been eaten - we could save a lot of typing by leading both outcomes of the grandmother scene to a single page, then checking later to see if the grandmother was eaten when it makes a difference to the narrative.

        "Little Red Riding Hood Interactive" by Edward Griffiths
        
        Include Adventure Book by Edward Griffiths
        
        The First Page is a page.
        "Once upon a time, there was a little girl who lived in a cottage on the edge of the woods. Everywhere she went, she wore a bright red riding hood, and everyone who knew her called her Little Red Riding Hood."
        It is followed by Page 2.
        
        Page 2 is a page.
        "One day, Little Red Riding Hood's grandmother fell ill, and so her mother gave her a basket of goodies to take to her grandmother's house.
        
        'But be careful on the road through the forest,' her mother said. 'Stay on the path, and don't talk to any strangers.'"
        It is followed by Page 3.
        
        Page 3 is a page.
        "But as Little Red Riding Hood made her way to her grandmother's, she came upon a wicked wolf. But he was so kind and so sweet that she quite forgot her mother's instructions.
        
        'Where are you going, Little Red Riding Hood?' he asked.
        
        'I'm going to visit my grandmother,' Little Red Riding Hood explained. 'She lives in the cottage on the other edge of the forest. She's very sick, and I'm bringing this basket of goodies to cheer her up.'
        
        The wolf heard this, and he licked his chops, scheming to himself. 'Perhaps you should stop a moment to pick some flowers for her,' the wolf suggested. 'That would be sure to cheer her up.'"
        It is followed by Page 4.
        
        Page 4 is a page.
        "As Little Red Riding Hood stopped to pick a bouquet of flowers for her grandmother, the wolf ran on ahead. What did he do when he reached the grandmother's cottage?"
        A choice called p4a is for Page 4. "He tied her up and threw her in the closet." It triggers Page 5.
        A choice called p4b is for Page 4. "He ate her up in one bite." It triggers Page 6.
        
        Page 5 is a page. [The wolf ties up Grandmother.]
        "When the wolf reached the grandmother's cottage, he knocked on the door. 'Who is it?' asked the grandmother. 'It's your granddaughter, Little Red Riding Hood,' the wolf replied, disguising his voice.
        
        But when the grandmother opened the door and found a ferocious wolf, she screamed and fainted dead away. And so the wolf tied her up with her own bedsheets and locked her up tight in the closet.
        
        With the grandmother safely locked up, the wolf dressed himself in her bedclothes, climbed into her bed, and pulled the sheets up over his head."
        It is followed by Page 7.
        
        Page 6 is a page. [The wolf eats Grandmother.]
        "The wolf broke open the door to the grandmother's cottage, snarling ferociously. The grandmother screamed in fright as the wolf attacked and ate her up in one bite.
        
        He licked his chops, chuckling wickedly to himself as he dressed himself in the grandmother's bedclothes and hid himself under the covers of her bed."
        It is followed by Page 8.
        
        Page 7 is a page. [Grandmother is tied up, Red appears.]
        "When Little Red Riding Hood arrived at her grandmother's house, she found her grandmother looking very peculiar.
        
        'Grandmother!' she cried. 'What big eyes you have!'
        
        'All the better to see you with, my dear,' the wolf said.
        
        'And what big ears you have!' Red Riding Hood said.
        
        'All the better to hear you with, my dear,' the wolf grinned.
        
        Red Riding Hood gasped. 'Grandmother! What big teeth you have!'
        
        At last, the wolf threw off his bedclothes. 'All the better to eat you with, my dear!'
        
        What happens next?"
        A choice called p7a is for Page 7. "The wolf ate Little Red Riding Hood." It triggers Page 9.
        A choice called p7b is for Page 7. "The hunter burst into the room." It triggers Page 10.
        
        Page 8 is a page. [Grandmother was eaten, Red appears.]
        "When Little Red Riding Hood arrived at her grandmother's house, she found her grandmother looking very peculiar.
        
        'Grandmother!' she cried. 'What big eyes you have!'
        
        'All the better to see you with, my dear,' the wolf said.
        
        'And what big ears you have!' Red Riding Hood said.
        
        'All the better to hear you with, my dear,' the wolf grinned.
        
        Red Riding Hood gasped. 'Grandmother! What big teeth you have!'
        
        At last, the wolf threw off his bedclothes. 'All the better to eat you with, my dear!'
        
        What happens next?"
        A choice called p8a is for Page 8. "The wolf ate Little Red Riding Hood." It triggers Page 11.
        A choice called p8b is for Page 8. "Red Riding Hood escaped." It triggers Page 12.
        
        Page 9 is a page. [Grandmother is tied up, Red is eaten.]
        "The wolf pounced upon Little Red Riding Hood, and before she could even call for help, he ate her up in a single bite. Chuckling happily to himself, he crawled back into the grandmother's bed and soon fell soundly asleep.
        
        Just then, a hunter arrived at the grandmother's cottage and found a wicked wolf in the grandmother's bed, no doubt up to mischief. What did he do?"
        A choice called p9a is for Page 9. "The hunter shot the wolf dead." It triggers Page 13.
        A choice called p9b is for Page 9. "The hunter cut the wolf open and filled him with rocks." It triggers Page 14.
        
        Page 10 is a page. [Grandmother is tied up, Red escapes.]
        "The wolf sprang from the bed and chased Little Red Riding Hood around and around the room. It looked like he was about to catch up with her, when suddenly a hunter burst into the room. He'd heard the screaming and came to investigate, only to find a wicked wolf chasing a poor little girl around the grandmother's bedroom. What did he do?"
        A choice called p10a is for Page 10. "The hunter shot the wolf dead." It triggers Page 15.
        A choice called p10b is for Page 10. "The hunter scared the wolf off." It triggers Page 16.
        
        Page 11 is a page. [Grandmother and Red are eaten.]
        "The wolf sprang from the bed, pounced Little Red Riding Hood, and gobbled her up in one big bite. After such a large meal, he began to feel very sleepy, and so he crawled back into the grandmother's bed and fell fast asleep.
        
        Just then, a hunter happened past the grandmother's cottage. Thinking it odd that the door should be ajar with no sounds coming from inside, he stepped in and found the wolf sound asleep. What did he do?"
        A choice called p11a is for Page 11. "The hunter shot the wolf dead." It triggers Page 17.
        A choice called p11b is for Page 11. "The hunter cut the wolf open and filled him with rocks." It triggers Page 18.
        
        Page 12 is a page. [Grandmother is eaten, Red escapes.]
        "The wolf sprange from the bed and chased Little Red Riding Hood around and around the room, but she was too quick, and she hopped out the window to safety.
        
        She ran and ran as fast as she could until she found a hunter in the forest. She told him everything that happened, and together they returned to the grandmother's cottage. The hunter shot the wolf dead and cut open his stomach to free the grandmother."
        It is followed by Page 19.
        
        Page 13 is a page. [Grandmother is tied up, Red is eaten, the hunter shoots the wolf dead.]
        "The hunter heard a sound from the closet and opened it to find the poor grandmother, tied up. When he cut her bindings and she told him what happened, he loaded his rifle and shot the wicked wolf dead. Then he took his hunting knife from his pocket and cut open the wolf's stomach to rescue Little Red Riding Hood."
        It is followed by Page 19.
        
        Page 14 is a page. [Grandmother is tied up, Red is eaten, the hunter fills the wolf with rocks.]
        "The hunter heard a sound from the closet and opened it to find the poor grandmother, tied up. When he cut her bindings and she told him what happened, he took his hunting knife from his pocket and cut the wolf's belly open to rescue Little Red Riding Hood. While the wolf slept, they all filled his empty stomach with stones and sewed his stomach shut again.
        
        When the wolf woke up, he was very thirsty, and so he drug himself out the door and to the well to get a drink. But when he bent over to get some water, the weight in his stomach pulled him to the bottom of the well, where he was drowned."
        It is followed by Page 19.
        
        Page 15 is a page. [Grandmother is tied up, Red escapes, the hunter shoots the wolf.]
        "Taking careful aim, the hunter shot the wolf dead. Just then, they heard a sound coming from the closet. They opened the door to find the grandmother, all tied up. The hunter quickly cut the bedsheets and freed her."
        It is followed by Page 19.
        
        Page 16 is a page. [Grandmother is tied up, Red escapes, the wolf escapes.]
        "The wolf took one look at the hunter's gun and he leapt out the window and back into the forest, never to be seen again. Just then, they heard a noise coming from the closet. Opening the door, the found the grandmother all tied up. The hunter quickly cut the bedsheets and freed her."
        It is followed by Page 19.
        
        Page 17 is a page. [Grandmother and Red are eaten, the hunter shoots the wolf.]
        "The hunter loaded his rifle and shot the wolf dead where he slept. Then he took the hunting knife from his belt and cut open the wolf's stomach, freeing Little Red Riding Hood and her grandmother."
        It is followed by Page 19.
        
        Page 18 is a page. [Grandmother and Red are eaten, the hunter fills the wolf with rocks.]
        "The hunter took the hunting knife from his belt and cut open the wolf's stomach, freeing Little Red Riding Hood and her grandmother. Then they gathered up a large pile of heavy stones to fill the wolf's stomach and sewed it shut again.
        
        When the wolf awoke, he was very thirsty, and so he drug himself out the door and to the well to get a drink. But when he bent over to get some water, the weight in his stomach pulled him to the bottom of the well, where he was drowned."
        It is followed by Page 19.
        
        Page 19 is a page.
        "From that day forward, Little Red Riding Hood never strayed from the path through the forest, and she never ever talked to strangers. And they all lived happily ever after.
        
        The End."
        It is followed by The Last Page.