summaryrefslogtreecommitdiff
path: root/test.stage
blob: 00e7d94eeed904c0a734d6fa5488f21dd6382718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

game.title = "Demo game";
game.author = "Mike Buland";
game.version = 1;
game.revision = 0;
game.start = <<start>>;

global
{
	command: "go" dir
	{
		if exists(situation.exits) then
		{
			if dir in situation.exits then
			{
				goto( situation.exits[dir] );
			}
		}
		display('''You're not really sure how to do that...''');
	}

	command: "exits"
	{
		if exists(situation.exits) then
		{
			out = "Obvious exits are: ";
			bFirst = true;
			for each dir : dest in situation.exits do
			{
				if bFirst then
				{
					bFirst = false;
				}
				else
				{
					out += ", ";
				}
				out += dir;
			}
			display( out );
		}
		else
		{
			display("There are no obvious exits.");
		}
	}

	// You should always have a global exit, quit, escape, something for
	// dev-testing at least.
	command: "exit"
	{
		exit();
	}
}

function square( x )
{
	return( x*x );
}

function sillyDisplay( txt, extra )
{
	display("!~! " + txt + " !~!");
	if extra then
	{
		display("And then some extra!");
	}
	else
	{
		display("...no extra for you");
	}
}

function myGoto( txt )
{
	display( txt );
	goto( txt );
}

function getThing()
{
	display( situation.thing );
}

situation <<start>>
{
	setup
	{
		goto( <<diningRoom>> );
	}

	enter
	{
	}
}

situation <<diningRoom>>
{
	setup
	{
		situation.exits = {
			'south': <<livingRoom>>,
			'east': <<kitchen>>
		};
	}
	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.''');
	}
}

situation <<livingRoom>>
{
	setup
	{
		situation.exits = {
			'north': <<diningRoom>>
		};
	}
	enter
	{
		display('''Living room!''');
	}
}

situation <<kitchen>>
{
	setup
	{
		situation.exits = {
			'west': <<diningRoom>>
		};
	}

	enter
	{
		display('''Kitchen!''');
	}
}