Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Advent.inf

15. Here be dragons (lines 1689-1765)

1689  Room    In_Secret_Canyon "Secret Canyon"
1690    with  name 'secret' 'canyon',
1691          description
1692              "You are in a secret canyon which exits to the north and east.",
1693          e_to [;
1694              if (canyon_from == In_Secret_E_W_Canyon) return canyon_from;
1695              if (Dragon in location)
1696                  "The dragon looks rather nasty. You'd best not try to get by.";
1697              return In_Secret_E_W_Canyon;
1698          ],
1699          n_to [;
1700              if (canyon_from == In_Secret_N_S_Canyon_0) return canyon_from;
1701              if (Dragon in location)
1702                  "The dragon looks rather nasty. You'd best not try to get by.";
1703              return In_Secret_N_S_Canyon_0;
1704          ],
1705          out_to [;
1706              return canyon_from;
1707          ],
1708          before [;
1709              if (action == ##Yes && Dragon.is_being_attacked) {
1710                  remove Dragon;
1711                  move DragonCorpse to location;
1712                  Dragon.is_being_attacked = false;
1713                  "Congratulations! You have just vanquished a dragon with your bare hands!
1714                   (Unbelievable, isn't it?)";
1715              }
1716              if (action == ##No && Dragon.is_being_attacked) {
1717                  Dragon.is_being_attacked = false;
1718                  "I should think not.";
1719              }
1720              Dragon.is_being_attacked = false;
1721          ];
1722   
1723  Object  -> Dragon "dragon"
1724    with  name 'dragon' 'monster' 'beast' 'lizard' 'huge' 'green' 'fierce' 'scaly'
1725               'giant' 'ferocious',
1726          description "I wouldn't mess with it if I were you.",
1727          initial "A huge green fierce dragon bars the way!",
1728          life [;
1729            Attack:
1730              self.is_being_attacked = true;
1731              "With what? Your bare hands?";
1732            Give:
1733              "The dragon is implacable.";
1734            ThrowAt:
1735              if (noun ~= axe)
1736                  "You'd probably be better off using your bare hands than that thing!";
1737              move axe to location;
1738              "The axe bounces harmlessly off the dragon's thick scales.";
1739          ],
1740          is_being_attacked false,
1741    has   animate;
1742   
1743  Treasure -> "Persian rug"
1744    with  name 'rug' 'persian' 'persian' 'fine' 'finest' 'dragon^s',
1745          describe [;
1746              if (Dragon in location)
1747                  "The dragon is sprawled out on the Persian rug!";
1748              "The Persian rug is spread out on the floor here.";
1749          ],
1750          before [;
1751            Take:
1752              if (Dragon in location)
1753                  "You'll need to get the dragon to move first!";
1754          ],
1755          depositpoints 14;
1756   
1757  Object  DragonCorpse "dragon's body"
1758    with  name 'dragon' 'corpse' 'dead' 'dragon^s' 'body',
1759          initial "The body of a huge green dead dragon is lying off to one side.",
1760          before [;
1761            Attack:
1762              "You've already done enough damage!";
1763          ],
1764    has   static;
1765   


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.