summaryrefslogtreecommitdiff
path: root/demo.stage
diff options
context:
space:
mode:
Diffstat (limited to 'demo.stage')
-rw-r--r--demo.stage86
1 files changed, 44 insertions, 42 deletions
diff --git a/demo.stage b/demo.stage
index e0e9768..5ba0c13 100644
--- a/demo.stage
+++ b/demo.stage
@@ -7,6 +7,11 @@ game.start = <<start>>;
7 7
8global 8global
9{ 9{
10 /**
11 * This is an example of a very general "travelling" command. It inspects
12 * the current situation to see what exits are available, and if the given
13 * exit is in the situation.exits dictionary it goes that way.
14 */
10 command: "go" dir 15 command: "go" dir
11 { 16 {
12 if exists(situation.exits) then 17 if exists(situation.exits) then
@@ -19,6 +24,9 @@ global
19 display('''You're not really sure how to do that...'''); 24 display('''You're not really sure how to do that...''');
20 } 25 }
21 26
27 /**
28 * A simple command that lists the currently visible exits.
29 */
22 command: "exits" 30 command: "exits"
23 { 31 {
24 if exists(situation.exits) then 32 if exists(situation.exits) then
@@ -45,6 +53,10 @@ global
45 } 53 }
46 } 54 }
47 55
56 /**
57 * Takes an item from the current situation, if it's there, and adds it to
58 * the user's inventory.
59 */
48 command: "take" item 60 command: "take" item
49 { 61 {
50 if exists(situation.items) then 62 if exists(situation.items) then
@@ -60,6 +72,9 @@ global
60 display("You don't see that anywhere."); 72 display("You don't see that anywhere.");
61 } 73 }
62 74
75 /**
76 * Lists items that are in the user's inventory.
77 */
63 command: "inventory" 78 command: "inventory"
64 { 79 {
65 out = 'You are carrying: '; 80 out = 'You are carrying: ';
@@ -83,7 +98,15 @@ situation <<start>>
83 setup 98 setup
84 { 99 {
85 player.inventory = []; 100 player.inventory = [];
86 goto( <<diningRoom>> ); 101
102 display('''You awaken after a long, dreamless sleep to find yourself
103 lying on a hard, cold, deserted beach. You have no memory of how
104 you got here. After a few minutes your eyes adjust to the bright,
105 glinting daylight shinning off the crests of the waves in the ocean.
106 You don't seem to have anything with you but the clothes you're
107 wearing. (You also posses an eerily accurate innate sense of
108 direction.)''');
109 goto( <<beachEast>> );
87 } 110 }
88 111
89 enter 112 enter
@@ -91,77 +114,56 @@ situation <<start>>
91 } 114 }
92} 115}
93 116
94situation <<diningRoom>> 117situation <<beachEast>>
95{ 118{
119 /**
120 * This overrides the global go command for the east parameter.
121 */
122 command: "go" "east"
123 {
124 display("Those rocks are far too sharp and jagged, you don't think you
125 could make it over them.");
126 }
127
96 setup 128 setup
97 { 129 {
98 situation.exits = { 130 situation.exits = {
99 'south': <<livingRoom>>, 131 'west': <<beachCenter>>
100 'east': <<kitchen>>
101 }; 132 };
102 situation.items = ['postcard'];
103 } 133 }
104 enter 134 enter
105 { 135 {
106 display('''You are in the dining room, it's very nice and warm. There 136 display('''You're standing on a narrow stretch of beach. The ocean
107 is a big table and...stuff. Looks like the living room is south, and 137 sparkles to the north, there's a cliff face just to the south. The
108 the kitchen is to the east.'''); 138 beach extends westward. To the east are some jagged rocks.''');
109 } 139 }
110} 140}
111 141
112situation <<livingRoom>> 142situation <<beachCenter>>
113{ 143{
114 setup 144 setup
115 { 145 {
116 situation.exits = { 146 situation.exits = {
117 'north': <<diningRoom>> 147 'east': <<beachEast>>,
148 'west': <<beachWest>>
118 }; 149 };
119 } 150 }
120 enter 151 enter
121 { 152 {
122 display('''Living room!''');
123 } 153 }
124} 154}
125 155
126situation <<kitchen>> 156situation <<beachWest>>
127{ 157{
128 command: "open" "cupboard"
129 {
130 if not situation.bCupboardOpen then
131 {
132 situation.bCupboardOpen = true;
133 if "pan" in situation.cupboardItems then
134 {
135 display("You open the cupboard, it's mostly empty. There is a
136 single frying pan inside.");
137 situation.cupboardItems -= "pan";
138 situation.items += "pan";
139
140 }
141 else
142 {
143 display("You open the cupboard, it's empty.");
144 }
145 }
146 else
147 {
148 display("The cupboard is already open.");
149 }
150 }
151
152 setup 158 setup
153 { 159 {
154 situation.exits = { 160 situation.exits = {
155 'west': <<diningRoom>> 161 'east': <<beachCenter>>
156 }; 162 };
157 situation.bCupboardOpen = false;
158 situation.cupboardItems = ['pan'];
159 situation.items = [];
160 } 163 }
161 164
162 enter 165 enter
163 { 166 {
164 display('''You are standing in the kitchen. There is an electric
165 range, a microwave, cupboards, a fridge, and a window.''');
166 } 167 }
167} 168}
169