summaryrefslogtreecommitdiff
path: root/test.stage
diff options
context:
space:
mode:
Diffstat (limited to 'test.stage')
-rw-r--r--test.stage92
1 files changed, 65 insertions, 27 deletions
diff --git a/test.stage b/test.stage
index ff159ff..00e7d94 100644
--- a/test.stage
+++ b/test.stage
@@ -7,10 +7,44 @@ game.start = <<start>>;
7 7
8global 8global
9{ 9{
10 command: "eat" object 10 command: "go" dir
11 { 11 {
12 display(object); 12 if exists(situation.exits) then
13 {
14 if dir in situation.exits then
15 {
16 goto( situation.exits[dir] );
17 }
18 }
19 display('''You're not really sure how to do that...''');
20 }
21
22 command: "exits"
23 {
24 if exists(situation.exits) then
25 {
26 out = "Obvious exits are: ";
27 bFirst = true;
28 for each dir : dest in situation.exits do
29 {
30 if bFirst then
31 {
32 bFirst = false;
33 }
34 else
35 {
36 out += ", ";
37 }
38 out += dir;
39 }
40 display( out );
41 }
42 else
43 {
44 display("There are no obvious exits.");
45 }
13 } 46 }
47
14 // You should always have a global exit, quit, escape, something for 48 // You should always have a global exit, quit, escape, something for
15 // dev-testing at least. 49 // dev-testing at least.
16 command: "exit" 50 command: "exit"
@@ -50,54 +84,58 @@ function getThing()
50 84
51situation <<start>> 85situation <<start>>
52{ 86{
53 command: "go" "home" 87 setup
54 { 88 {
55 display("Home would be nice..."); 89 goto( <<diningRoom>> );
56 } 90 }
57 91
58 command: "go" elsewhere 92 enter
59 { 93 {
60 display("You don't know how to go " + elsewhere );
61 } 94 }
95}
96
97situation <<diningRoom>>
98{
62 setup 99 setup
63 { 100 {
64 stuff = {"things": 55, 112: "Bob"}; 101 situation.exits = {
65 display( stuff ); 102 'south': <<livingRoom>>,
66 display( 113 - 1 in stuff ); 103 'east': <<kitchen>>
67 exit(); 104 };
68 } 105 }
69
70 enter 106 enter
71 { 107 {
72 display('''This is the enter part of the start situation'''); 108 display('''You are in the dining room, it's very nice and warm. There
109 is a big table and...stuff. Looks like the living room is south, and
110 the kitchen is to the east.''');
73 } 111 }
74} 112}
75 113
76situation <<stuff>> 114situation <<livingRoom>>
77{ 115{
78 command: "eat" object 116 setup
79 { 117 {
80 display("You can't eat " + object ); 118 situation.exits = {
119 'north': <<diningRoom>>
120 };
81 } 121 }
82 122 enter
83 command: "eat" object "now"
84 { 123 {
85 display("Alright, fine, eat " + object + " now..." ); 124 display('''Living room!''');
86 } 125 }
126}
87 127
128situation <<kitchen>>
129{
88 setup 130 setup
89 { 131 {
90 situation.thing = "Just a thing"; 132 situation.exits = {
133 'west': <<diningRoom>>
134 };
91 } 135 }
136
92 enter 137 enter
93 { 138 {
94 getThing(); 139 display('''Kitchen!''');
95 display('''Entered stuff''' + player.name);
96 count = 0;
97 while count < 5 do
98 {
99 display('thing to count!');
100 count += 1;
101 }
102 } 140 }
103} 141}