From ef56ac3105dbd72cc5989edef9bbbb3fedfe6449 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 4 Jan 2012 23:30:24 -0700 Subject: Demo is being reworked. Fixed comment handling. --- demo.stage | 86 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 44 insertions(+), 42 deletions(-) (limited to 'demo.stage') diff --git a/demo.stage b/demo.stage index e0e9768..5ba0c13 100644 --- a/demo.stage +++ b/demo.stage @@ -7,6 +7,11 @@ game.start = <>; global { + /** + * This is an example of a very general "travelling" command. It inspects + * the current situation to see what exits are available, and if the given + * exit is in the situation.exits dictionary it goes that way. + */ command: "go" dir { if exists(situation.exits) then @@ -19,6 +24,9 @@ global display('''You're not really sure how to do that...'''); } + /** + * A simple command that lists the currently visible exits. + */ command: "exits" { if exists(situation.exits) then @@ -45,6 +53,10 @@ global } } + /** + * Takes an item from the current situation, if it's there, and adds it to + * the user's inventory. + */ command: "take" item { if exists(situation.items) then @@ -60,6 +72,9 @@ global display("You don't see that anywhere."); } + /** + * Lists items that are in the user's inventory. + */ command: "inventory" { out = 'You are carrying: '; @@ -83,7 +98,15 @@ situation <> setup { player.inventory = []; - goto( <> ); + + display('''You awaken after a long, dreamless sleep to find yourself + lying on a hard, cold, deserted beach. You have no memory of how + you got here. After a few minutes your eyes adjust to the bright, + glinting daylight shinning off the crests of the waves in the ocean. + You don't seem to have anything with you but the clothes you're + wearing. (You also posses an eerily accurate innate sense of + direction.)'''); + goto( <> ); } enter @@ -91,77 +114,56 @@ situation <> } } -situation <> +situation <> { + /** + * This overrides the global go command for the east parameter. + */ + command: "go" "east" + { + display("Those rocks are far too sharp and jagged, you don't think you + could make it over them."); + } + setup { situation.exits = { - 'south': <>, - 'east': <> + 'west': <> }; - situation.items = ['postcard']; } enter { - display('''You are in the dining room, it's very nice and warm. There - is a big table and...stuff. Looks like the living room is south, and - the kitchen is to the east.'''); + display('''You're standing on a narrow stretch of beach. The ocean + sparkles to the north, there's a cliff face just to the south. The + beach extends westward. To the east are some jagged rocks.'''); } } -situation <> +situation <> { setup { situation.exits = { - 'north': <> + 'east': <>, + 'west': <> }; } enter { - display('''Living room!'''); } } -situation <> +situation <> { - command: "open" "cupboard" - { - if not situation.bCupboardOpen then - { - situation.bCupboardOpen = true; - if "pan" in situation.cupboardItems then - { - display("You open the cupboard, it's mostly empty. There is a - single frying pan inside."); - situation.cupboardItems -= "pan"; - situation.items += "pan"; - - } - else - { - display("You open the cupboard, it's empty."); - } - } - else - { - display("The cupboard is already open."); - } - } - setup { situation.exits = { - 'west': <> + 'east': <> }; - situation.bCupboardOpen = false; - situation.cupboardItems = ['pan']; - situation.items = []; } enter { - display('''You are standing in the kitchen. There is an electric - range, a microwave, cupboards, a fridge, and a window.'''); } } + -- cgit v1.2.3