Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bin/crypt] add a descriptions file

  • Loading branch information...
commit a36b8dd89fce10613c0aaf75e21636cf06fd1a3d 1 parent 2efa9e7
Carl Mäsak authored July 03, 2012
8  bin/crypt
@@ -250,6 +250,12 @@ multi MAIN() {
250 250
     say "";
251 251
 
252 252
     my $game = Crypt::Game.new();
  253
+    my %descriptions;
  254
+    for slurp("game-data/descriptions").split(/\n\n/) {
  255
+        /^^ '== ' (\N+) \n (.*)/
  256
+            or die "Could not parse 'descriptions' file: $_";
  257
+        %descriptions{$0} = ~$1;
  258
+    }
253 259
 
254 260
     loop {
255 261
         my $command = prompt('> ');
@@ -266,7 +272,7 @@ multi MAIN() {
266 272
                 my @events = $game.look();
267 273
                 for @events {
268 274
                     when Crypt::PlayerLooked {
269  
-                        say "<{.description_of}>";
  275
+                        say %descriptions{.description_of};
270 276
                     }
271 277
                 }
272 278
             }
3  game-data/descriptions
... ...
@@ -0,0 +1,3 @@
  1
+== clearing
  2
+The forest road stops here, and the gaps between the trees widen into a
  3
+patch of un-forest. The sky above is clear apart from a few harmless clouds.

0 notes on commit a36b8dd

Please sign in to comment.
Something went wrong with that request. Please try again.