Simple CYOA

version 1 by Mark Tilford

  • Home page
  • Beginning
  • Previous



  • Example: * Castle Escape - A simple test.

        "Castle Escape" by ralphmerridew

        Use inline choices;
        [Use mention all changes;]

        Include Simple CYOA by Mark Tilford.

        The game pages are at entrance, left door, right door, down hall, take sword, climb ladder, take potion, back down, take sword 2, left bridge, right bridge, drink, and across bridge.

        Initial page is at entrance.

        A game state can be has sword or hasnt sword. A game state can be has potion or hasnt potion. A game state has a number called the player score.

        Initial state is hasnt sword.
        Initial state is hasnt potion.
        The player score of initial state is 0.

        An interturn rule: if player score of current state is greater than player score of backup state then say "Your score went up by [player score of current state - player score of backup state] point[s] to [player score of current state].".

        An interturn rule: if player score of current state is less than player score of backup state then say "Your score went down by [player score of backup state - player score of current state] point[s] to [player score of current state].".

        [ Just to help keep track of the way the game branches, we diagram the nodes:
         at start -> left door, right door, down hall (down hall == left door)
         left door -> take sword, climb ladder, right door
         take sword (set sword) -> climb ladder, right door
         climb ladder (if has sword) -> DIE; otherwise -> take potion, back down
         take potion (set potion) -> back down
         back down -> take sword 2, right door
         take sword 2 (set sword) -> right door
         right door (if has potion) -> left bridge, right bridge, drink; otherwise -> left bridge, right bridge
         left bridge -> DIE
         right bridge -> DIE
         drink -> across bridge
         across bridge (if has sword) -> WIN; otherwise -> DIE
        ]

        Instead of displaying page at entrance, say "You find yourself in a long hall with doors on either side. Do you [link left door]go left, [link right door]go right, or [link down hall]go forward?".

        Instead of displaying page left door, say "There is a sword resting on the ground here; a rope ladder leads to the ceiling, and there's another door at the far end of the room. Do you [link take sword]take the sword, [link climb ladder]climb the ladder, or [link right door]go through the door?".

        Instead of preparing page down hall: decrease player score of current state by 1.
        Instead of displaying page down hall: say "Ten feet down the hall, a trapdoor opens below you. After hitting the ground, you look around to see a sword by your feet, a rope ladder leading upwards, and a door at the far end of the room. Do you [link take sword]take the sword, [link climb ladder]climb the ladder, or [link right door]go through the door?".

        Instead of preparing page take sword: increase player score of current state by 1; now current state is has sword.
        Instead of displaying page take sword: say "Taken. Now do you [link climb ladder]climb up the ladder or [link right door]go out the door?".

        Instead of displaying page climb ladder:
            say "[if current state is has sword]Oops. The sword cuts the ladder as you climb it. You die.[otherwise]You are in a small room. There is a potion on the floor. Do you [link take potion]take it or [link back down]climb back down?[end if]";

        Instead of preparing page take potion: increase player score of current state by 1; now current state is has potion.
        Instead of displaying page take potion: say "You take the potion. With nothing left to do here, you climb back down the ladder. Do you [link take sword 2]take the sword or [link right door]move on?".

        Instead of displaying page back down: say "You are back at the bottom. Do you [link take sword 2]take the sword or [link right door]move on?".

        Instead of preparing page take sword 2: increase player score of current state by 1; now current state is has sword.
        Instead of displaying page take sword 2: say "Taken. You then move on. [continue to right door]";

        Instead of preparing page right door: increase player score of current state by 1.
        Instead of displaying page right door: say "The door locks behind you. A fiery pit splits this room in two. Two bridges cross it. Do you [link left bridge]cross the left bridge"; if current state is has potion, say ", [link right bridge]cross the right bridge, or [link drink]drink the potion?"; otherwise say " or [link right bridge]cross the right bridge?".

        Instead of displaying page left bridge: say "It breaks and you die.".

        Instead of displaying page right bridge: say "It breaks and you die.".

        Instead of displaying page drink: say "As you drink, a third bridge appears between the two. Do you [link left bridge]cross the left bridge, [link right bridge]cross the right bridge, or [link across bridge]cross the middle bridge?".

        Instead of displaying page across bridge: say "You quickly run across. On the other side, a man suddenly attacks you[if current state is has sword]. You quickly draw your sword and defeat him, then exit the complex. *** YOU WIN ***[otherwise], and being unarmed, you are unable to fight back.[end if]".