diff options
Diffstat (limited to 'test.stage')
| -rw-r--r-- | test.stage | 129 |
1 files changed, 13 insertions, 116 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | game.title = "Demo game"; | 2 | game.title = "Code Test"; |
| 3 | game.author = "Mike Buland"; | 3 | game.author = "Mike Buland"; |
| 4 | game.version = 1; | 4 | game.version = 1; |
| 5 | game.revision = 0; | 5 | game.revision = 0; |
| @@ -7,135 +7,32 @@ game.start = <<start>>; | |||
| 7 | 7 | ||
| 8 | global | 8 | global |
| 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 | ||
| 56 | function square( x ) | ||
| 57 | { | ||
| 58 | return( x*x ); | ||
| 59 | } | ||
| 60 | |||
| 61 | function 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 | |||
| 74 | function myGoto( txt ) | ||
| 75 | { | ||
| 76 | display( txt ); | ||
| 77 | goto( txt ); | ||
| 78 | } | ||
| 79 | |||
| 80 | function getThing() | ||
| 81 | { | ||
| 82 | display( situation.thing ); | ||
| 83 | } | ||
| 84 | |||
| 85 | situation <<start>> | 16 | situation <<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; | |
| 97 | situation <<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 | ||
| 114 | situation <<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 | ||
| 128 | situation <<kitchen>> | ||
| 129 | { | ||
| 130 | setup | ||
| 131 | { | ||
| 132 | situation.exits = { | ||
| 133 | 'west': <<diningRoom>> | ||
| 134 | }; | ||
| 135 | } | ||
| 136 | |||
| 137 | enter | ||
| 138 | { | ||
| 139 | display('''Kitchen!'''); | ||
| 140 | } | ||
| 141 | } | ||
