summaryrefslogtreecommitdiff
path: root/demo.stage
diff options
context:
space:
mode:
Diffstat (limited to 'demo.stage')
-rw-r--r--demo.stage116
1 files changed, 93 insertions, 23 deletions
diff --git a/demo.stage b/demo.stage
index 67c6063..00e7d94 100644
--- a/demo.stage
+++ b/demo.stage
@@ -7,65 +7,135 @@ game.start = <<start>>;
7 7
8global 8global
9{ 9{
10 command: "take" item 10 command: "go" dir
11 { 11 {
12 if item in situation.items then 12 if exists(situation.exits) then
13 { 13 {
14 player.inventory += item; 14 if dir in situation.exits then
15 situation.items -= item; 15 {
16 display('''You pickup the ''' + item + 16 goto( situation.exits[dir] );
17 ''' and put it in your pocket.'''); 17 }
18 }
19 else
20 {
21 display('''You don't see anything like that here.''');
22 } 18 }
19 display('''You're not really sure how to do that...''');
23 } 20 }
24 21
25 command: "use" item 22 command: "exits"
26 { 23 {
27 if not item in player.inventory then 24 if exists(situation.exits) then
28 { 25 {
29 display('''You don't have anything like that in your pocket.'''); 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 );
30 } 41 }
31 else 42 else
32 { 43 {
44 display("There are no obvious exits.");
33 } 45 }
34 } 46 }
47
48 // You should always have a global exit, quit, escape, something for
49 // dev-testing at least.
50 command: "exit"
51 {
52 exit();
53 }
54}
55
56function square( x )
57{
58 return( x*x );
35} 59}
36 60
37situation <<main>> 61function sillyDisplay( txt, extra )
38{ 62{
39 command: "there" hi 63 display("!~! " + txt + " !~!");
64 if extra then
40 { 65 {
66 display("And then some extra!");
41 } 67 }
68 else
69 {
70 display("...no extra for you");
71 }
72}
73
74function myGoto( txt )
75{
76 display( txt );
77 goto( txt );
78}
79
80function getThing()
81{
82 display( situation.thing );
83}
84
85situation <<start>>
86{
42 setup 87 setup
43 { 88 {
44 player.inventory = []; 89 goto( <<diningRoom>> );
45 } 90 }
91
46 enter 92 enter
47 { 93 {
48 } 94 }
49} 95}
50 96
51function hello() 97situation <<diningRoom>>
52{ 98{
53 bob = 55 * 2 + 1; 99 setup
100 {
101 situation.exits = {
102 'south': <<livingRoom>>,
103 'east': <<kitchen>>
104 };
105 }
106 enter
107 {
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.''');
111 }
54} 112}
55 113
56situation <<start>> 114situation <<livingRoom>>
57{ 115{
116 setup
117 {
118 situation.exits = {
119 'north': <<diningRoom>>
120 };
121 }
58 enter 122 enter
59 { 123 {
60 display('''You are here, there is a wrench sitting on the table.'''); 124 display('''Living room!''');
61 test("use", bob );
62 } 125 }
63} 126}
64 127
65situation <<end>> 128situation <<kitchen>>
66{ 129{
130 setup
131 {
132 situation.exits = {
133 'west': <<diningRoom>>
134 };
135 }
136
67 enter 137 enter
68 { 138 {
69 goto( <<start>> ); 139 display('''Kitchen!''');
70 } 140 }
71} 141}