summaryrefslogtreecommitdiff
path: root/test.stage
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-12-30 23:07:59 -0700
committerMike Buland <eichlan@xagasoft.com>2011-12-30 23:07:59 -0700
commit70076bb00bdedb57405ed2ef27e2fec172e2f38a (patch)
tree4339853d972427b02bb4d51a88bcb665ba61307a /test.stage
parent8bcb83035607371a2326374665e9cc56c662a783 (diff)
downloadstage-70076bb00bdedb57405ed2ef27e2fec172e2f38a.tar.gz
stage-70076bb00bdedb57405ed2ef27e2fec172e2f38a.tar.bz2
stage-70076bb00bdedb57405ed2ef27e2fec172e2f38a.tar.xz
stage-70076bb00bdedb57405ed2ef27e2fec172e2f38a.zip
Well, +=, -= on dictionaries/lists works now.
Diffstat (limited to 'test.stage')
-rw-r--r--test.stage129
1 files changed, 13 insertions, 116 deletions
diff --git a/test.stage b/test.stage
index 00e7d94..9e5c00a 100644
--- a/test.stage
+++ b/test.stage
@@ -1,5 +1,5 @@
1 1
2game.title = "Demo game"; 2game.title = "Code Test";
3game.author = "Mike Buland"; 3game.author = "Mike Buland";
4game.version = 1; 4game.version = 1;
5game.revision = 0; 5game.revision = 0;
@@ -7,135 +7,32 @@ game.start = <<start>>;
7 7
8global 8global
9{ 9{
10 command: "go" dir
11 {
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 }
46 }
47
48 // You should always have a global exit, quit, escape, something for
49 // dev-testing at least.
50 command: "exit" 10 command: "exit"
51 { 11 {
52 exit(); 12 exit();
53 } 13 }
54} 14}
55 15
56function square( x )
57{
58 return( x*x );
59}
60
61function sillyDisplay( txt, extra )
62{
63 display("!~! " + txt + " !~!");
64 if extra then
65 {
66 display("And then some extra!");
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>> 16situation <<start>>
86{ 17{
87 setup 18 setup
88 { 19 {
89 goto( <<diningRoom>> ); 20 dict = {1: "Hello"};
90 } 21 dict['bob'] = 'yup';
91 22 display( dict );
92 enter 23 dict -= 1;
93 { 24 display( dict );
94 } 25
95} 26 lst = [55];
96 27 lst += 112;
97situation <<diningRoom>> 28 display( lst );
98{ 29 lst -= 55;
99 setup 30 display( lst );
100 { 31 exit();
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 } 32 }
112}
113 33
114situation <<livingRoom>>
115{
116 setup
117 {
118 situation.exits = {
119 'north': <<diningRoom>>
120 };
121 }
122 enter 34 enter
123 { 35 {
124 display('''Living room!''');
125 } 36 }
126} 37}
127 38
128situation <<kitchen>>
129{
130 setup
131 {
132 situation.exits = {
133 'west': <<diningRoom>>
134 };
135 }
136
137 enter
138 {
139 display('''Kitchen!''');
140 }
141}