ralphmerridew

Alternate Keys on the Tomb

Jul 20th, 2011
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. "Keys on the Tomb"
  2.  
  3. [ To make output slightly nicer, uncomment one of the two blocks. (Using consolidate keys without using multiple keys has no effect.) ]
  4. [Use multiple keys;]
  5. [Use multiple keys; Use consolidate keys;]
  6.  
  7.  
  8.  
  9. Use multiple keys translates as (- Constant MULTIPLE_KEYS; -).
  10. Use consolidate keys translates as (- Constant CONSOLIDATE_KEYS; -).
  11.  
  12. kings_tomb is a room. The printed name is "The King's Tomb". "Old and dusty."
  13. The tomb is a supporter in kings_tomb.
  14.  
  15. A key is a kind of thing. Understand "keys" as the plural of key.
  16.  
  17. The player holds a rock.
  18. The player holds a key called the iron key.
  19. The player holds a key called the silver key.
  20. The player holds a book.
  21. The player holds a key called the brass key.
  22. The player holds a key called the gold key.
  23. The player holds a key called the bronze key.
  24. The player holds a container called the knapsack.
  25.  
  26. Key vault is a container.
  27.  
  28.  
  29. After putting a key on the tomb:
  30. if not using the multiple keys option:
  31. say "You hear a jingle and [the noun] disappears.";
  32. move the noun to the key vault;
  33. otherwise:
  34. let m_o_l be the multiple object list;
  35. let placed_keys be a list of objects;
  36. repeat with obj running through m_o_l:
  37. if obj is a key:
  38. add obj to placed_keys;
  39. if the number of entries in placed_keys <= 1:
  40. say "You hear a jingle and [the noun] disappears.";
  41. move the noun to the key vault;
  42. otherwise:
  43. say "You hear a jingle and [placed_keys with definite articles] disappear.";
  44. repeat with removed key running through placed_keys:
  45. move the removed key to the key vault;
  46. remove noun from placed_keys;
  47. remove placed_keys from m_o_l;
  48. alter the multiple object list to m_o_l;
  49. [ Below code is used whether multiple keys is active or not]
  50. if the number of keys in the key vault >= 5:
  51. say "You hear a creak as the tomb opens up...";
  52. end the game in victory.
  53.  
  54.  
  55. [===================================================]
  56. [ If not using "consolidate keys", these lines have no effect. ]
  57.  
  58. This is the my announce rule:
  59. if the current item from the multiple object list is not nothing:
  60. follow the announcement rules.
  61.  
  62. My announce rule is listed instead of the announce items from multiple object lists rule in the action-processing rules.
  63.  
  64. The announcement rules are a rulebook.
  65. An announcement rule while putting a key on the tomb:
  66. if the multiple keys option is active and the consolidate keys option is active:
  67. let all-keys be a list of objects;
  68. repeat with potential key running through the multiple object list:
  69. if potential key is a key:
  70. add potential key to all-keys;
  71. say "[all-keys with definite articles]: [run paragraph on]" instead;
  72.  
  73. An announcement rule:
  74. say "[current item from the multiple object list]: [run paragraph on]".
  75.  
  76. [===================================================]
  77.  
  78. test first with "put all on tomb".
  79. test second with "put keys on tomb".
  80. test third with "put all but silver key on tomb / put silver key on tomb".
Advertisement
Add Comment
Please, Sign In to add comment