# This is a variable found_the_key = false tree = -> do cs write """ After a long walk in the forest, you find yourself under an old, mossy oak tree. The sunlight glimmers against something hidden in its gnarled roots... """ menu "Keep walking to the castle": castle "Look closer at the roots": roots roots = -> do cs write """ You dig among the roots with your fingers and find an old key. It's dirty and rusty, but it looks like it would still work. """ write """ <img src="/img/ancient-key"> """ # Remember that we found the key! found_the_key = true menu "Go to the castle": castle castle = -> do cs write """ You walk to the castle and go inside to look at the treasury door. """ # If you found the key, then you get # this choice. if found_the_key menu "Unlock the door": treasure # If you haven't found it yet... if not found_the_key write """ If only you had the key, you might be able to save the kingdom. """ menu "Go for a walk": tree treasure = -> write """ The key fits! You open the door, and among the treasure you see a Crown... """ # Start the game do tree