Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Advent.inf

23. The Chasm and the Troll Bridge (lines 2388-2528)

2388  Room    In_Sloping_Corridor "Sloping Corridor"
2389    with  name 'sloping' 'corridor',
2390          description
2391              "You are in a long winding corridor sloping out of sight in both directions.",
2392          d_to In_Large_Low_Room,
2393          u_to On_Sw_Side_Of_Chasm,
2394          cant_go "The corridor slopes steeply up and down.";
2395   
2396  Room    On_Sw_Side_Of_Chasm "On SW Side of Chasm"
2397    with  name 'southwest' 'sw' 'side' 'of' 'chasm',
2398          description
2399              "You are on one side of a large, deep chasm.
2400               A heavy white mist rising up from below obscures all view of the far side.
2401               A southwest path leads away from the chasm into a winding corridor.",
2402          ne_to CrossRicketyBridge,
2403          sw_to In_Sloping_Corridor,
2404          d_to In_Sloping_Corridor,
2405          cant_go "The path winds southwest.",
2406          before [;
2407            Jump:
2408              if (RicketyBridge in self)
2409                  "I respectfully suggest you go across the bridge instead of jumping.";
2410              deadflag = 1;
2411              "You didn't make it.";
2412          ];
2413   
2414  [ CrossRicketyBridge;
2415      if (Troll.has_caught_treasure || Troll in nothing) {
2416          Troll.has_caught_treasure = false;
2417          if (Bear.is_following_you) {
2418              remove Bear;
2419              remove self;
2420              give Wreckage ~absent;
2421              remove RicketyBridge;
2422              give RicketyBridge absent;
2423              StopDaemon(Bear);
2424              deadflag = 1;
2425              "Just as you reach the other side, the bridge buckles beneath the weight of the bear,
2426               which was still following you around.
2427               You scrabble desperately for support,
2428               but as the bridge collapses you stumble back and fall into the chasm.";
2429          }
2430          return RicketyBridge;
2431      }
2432      if (Troll in location) "The troll refuses to let you cross.";
2433      move Troll to location;
2434      "The troll steps out from beneath the bridge and blocks your way.";
2435  ];
2436   
2437  Object  -> RicketyBridge "rickety bridge"
2438    with  name 'bridge' 'rickety' 'unstable' 'wobbly' 'rope',
2439          description "It just looks like an ordinary, but unstable, bridge.",
2440          describe [;
2441              print
2442                  "A rickety wooden bridge extends across the chasm, vanishing into the mist.
2443                   ^^
2444                   A sign posted on the bridge reads, ~Stop! Pay troll!~^";
2445              if (Troll notin location)
2446                  "The troll is nowhere to be seen.";
2447              rtrue;
2448          ],
2449          door_dir [;
2450              if (location == On_Sw_Side_Of_Chasm) return ne_to;
2451              return sw_to;
2452          ],
2453          door_to [;
2454              if (location == On_Sw_Side_Of_Chasm) return On_Ne_Side_Of_Chasm;
2455              return On_Sw_Side_Of_Chasm;
2456          ],
2457          found_in On_Sw_Side_Of_Chasm On_Ne_Side_Of_Chasm,
2458    has   static door open;
2459   
2460  Object  -> -> Troll "burly troll"
2461    with  name 'troll' 'burly',
2462          description
2463              "Trolls are close relatives with rocks and have skin as tough as that of a rhinoceros.",
2464          initial
2465              "A burly troll stands by the bridge
2466               and insists you throw him a treasure before you may cross.",
2467          life [;
2468            Attack:
2469              "The troll laughs aloud at your pitiful attempt to injure him.";
2470            ThrowAt, Give:
2471              if (noun ofclass Treasure) {
2472                  remove noun;
2473                  move self to RicketyBridge;
2474                  self.has_caught_treasure = true;
2475                  score = score - 5;
2476                  "The troll catches your treasure and scurries away out of sight.";
2477              }
2478              if (noun == tasty_food)
2479                  "Gluttony is not one of the troll's vices. Avarice, however, is.";
2480              "The troll deftly catches ", (the) noun,
2481                  ", examines it carefully, and tosses it back, declaring,
2482                  ~Good workmanship, but it's not valuable enough.~";
2483            Order:
2484              "You'll be lucky.";
2485            Answer, Ask:
2486              "Trolls make poor conversation.";
2487          ],
2488          has_caught_treasure false,
2489    has   animate;
2490   
2491  Object  Wreckage "wreckage of bridge"
2492    with  name 'wreckage' 'wreck' 'bridge' 'dead' 'bear',
2493          initial
2494              "The wreckage of the troll bridge (and a dead bear)
2495               can be seen at the bottom of the chasm.",
2496          before [;
2497              "The wreckage is too far below.";
2498          ],
2499          found_in On_Sw_Side_Of_Chasm On_Ne_Side_Of_Chasm,
2500    has   static absent;
2501   
2502  ! ------------------------------------------------------------------------------
2503   
2504  Room    On_Ne_Side_Of_Chasm "On NE Side of Chasm"
2505    with  name 'northeast' 'ne' 'side' 'of' 'chasm',
2506          description
2507              "You are on the far side of the chasm.
2508               A northeast path leads away from the chasm on this side.",
2509          sw_to CrossRicketyBridge,
2510          ne_to In_Corridor,
2511          before [;
2512            Jump:
2513              if (RicketyBridge in self)
2514                  "I respectfully suggest you go across the bridge instead of jumping.";
2515              deadflag = 1;
2516              "You didn't make it.";
2517          ],
2518    has   nodwarf;
2519   
2520  Room    In_Corridor "In Corridor"
2521    with  name 'corridor',
2522          description
2523              "You're in a long east/west corridor.
2524               A faint rumbling noise can be heard in the distance.",
2525          w_to On_Ne_Side_Of_Chasm,
2526          e_to At_Fork_In_Path,
2527    has   nodwarf;
2528   


Last updated 23 June 2004. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.