From 55e6f570f5760e970c6523458914b5e4c63a6ce4 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 31 Dec 2011 00:13:13 -0700 Subject: Random function added, other fixes. --- demo.stage | 84 ++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 29 deletions(-) (limited to 'demo.stage') diff --git a/demo.stage b/demo.stage index 00e7d94..e0e9768 100644 --- a/demo.stage +++ b/demo.stage @@ -45,47 +45,44 @@ global } } - // You should always have a global exit, quit, escape, something for - // dev-testing at least. - command: "exit" + command: "take" item { - exit(); + if exists(situation.items) then + { + if item in situation.items then + { + situation.items -= item; + player.inventory += item; + display("You take the " + item); + return(); + } + } + display("You don't see that anywhere."); } -} - -function square( x ) -{ - return( x*x ); -} -function sillyDisplay( txt, extra ) -{ - display("!~! " + txt + " !~!"); - if extra then + command: "inventory" { - display("And then some extra!"); + out = 'You are carrying: '; + for each item in player.inventory do + { + out += " " + item; + } + display( out ); } - else + + // You should always have a global exit, quit, escape, something for + // dev-testing at least. + command: "exit" { - display("...no extra for you"); + exit(); } } -function myGoto( txt ) -{ - display( txt ); - goto( txt ); -} - -function getThing() -{ - display( situation.thing ); -} - situation <> { setup { + player.inventory = []; goto( <> ); } @@ -102,6 +99,7 @@ situation <> 'south': <>, 'east': <> }; + situation.items = ['postcard']; } enter { @@ -127,15 +125,43 @@ situation <> situation <> { + command: "open" "cupboard" + { + if not situation.bCupboardOpen then + { + situation.bCupboardOpen = true; + if "pan" in situation.cupboardItems then + { + display("You open the cupboard, it's mostly empty. There is a + single frying pan inside."); + situation.cupboardItems -= "pan"; + situation.items += "pan"; + + } + else + { + display("You open the cupboard, it's empty."); + } + } + else + { + display("The cupboard is already open."); + } + } + setup { situation.exits = { 'west': <> }; + situation.bCupboardOpen = false; + situation.cupboardItems = ['pan']; + situation.items = []; } enter { - display('''Kitchen!'''); + display('''You are standing in the kitchen. There is an electric + range, a microwave, cupboards, a fridge, and a window.'''); } } -- cgit v1.2.3