document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. ! made up a couple new constants for the FORMAT mask to be used by the
  2. ! replaced routines
  3. constant OVERRIDEHERE_F 8192
  4. constant ALSO_F 16384
  5.  
  6. replace WhatsIn(obj)
  7. {
  8. local i, totallisted
  9. local initial_list_nest
  10.  
  11. if FORMAT & NORECURSE_F
  12. return
  13.  
  14. for i in obj
  15. {
  16. i is not already_listed
  17. if i is not hidden
  18. totallisted++
  19. }
  20.  
  21. if totallisted = 0
  22. return
  23.  
  24. list_count = totallisted
  25.  
  26. if obj is not container or obj is platform or
  27. (obj is container and (obj is not openable or
  28. (obj is openable and
  29. (obj is open or obj is transparent)))) and
  30. (obj ~= player or FORMAT & INVENTORY_F) and obj is not quiet
  31. {
  32. SpecialDesc(obj)
  33.  
  34. ! If list_count is 0 now, but totallisted was not, something must have been
  35. ! printed by SpecialDesc
  36.  
  37.  
  38. if list_count = 0
  39. {
  40. if FORMAT & INVENTORY_F and not (FORMAT & LIST_F) and
  41. list_nest = 0
  42. {
  43. print newline ! was ' print "" '
  44. }
  45. return totallisted
  46. }
  47.  
  48. if obj.list_contents
  49. return totallisted
  50.  
  51. initial_list_nest = list_nest
  52.  
  53. if FORMAT & LIST_F
  54. {
  55. if list_nest
  56. {
  57. ! Indent the first time so that it lines up with
  58. ! paragraph indentation:
  59. i = list_nest
  60. if list_nest = 1 and not (FORMAT & NOINDENT_F)
  61. {
  62. Indent
  63. i--
  64. }
  65.  
  66. print to (i * 2); ! INDENT_SIZE);
  67. }
  68. }
  69. else
  70. {
  71. Indent
  72. }
  73.  
  74. if obj.contains_desc ! custom heading
  75. {
  76. if FORMAT & LIST_F
  77. RLibMessage(&WhatsIn, 1 ) ! ":"
  78. }
  79. else
  80. {
  81. if obj = player
  82. {
  83. if FORMAT & LIST_F and list_count < totallisted
  84. print "\\n";
  85.  
  86. ! "You are carrying..."
  87. Message(&WhatsIn, 1, totallisted)
  88.  
  89. if FORMAT & LIST_F
  90. RLibMessage(&WhatsIn, 1 ) ! ":"
  91. }
  92. elseif obj is living and not obj.prep
  93. {
  94. ! "X has..."
  95. Message(&WhatsIn, 2, obj, totallisted)
  96. if FORMAT & LIST_F
  97. RLibMessage(&WhatsIn, 1 ) ! ":"
  98. }
  99. elseif not (FORMAT & OVERRIDEHERE_F)
  100. {
  101. if list_count < totallisted
  102. ! "Also sitting on/in..."
  103. RLibMessage(&WhatsIn, 2, obj )
  104. else
  105. ! "Sitting on/in..."
  106. RLibMessage(&WhatsIn, 3, obj )
  107. FORMAT = FORMAT | ISORARE_F
  108. }
  109. }
  110.  
  111. ListObjects(obj)
  112.  
  113. list_nest = initial_list_nest
  114. }
  115. return totallisted
  116. }
  117.  
  118. replace ListObjects(thisobj, conjunction)
  119. {
  120. local i, obj, count, pluralcount
  121. local templist_count ! temporary total of unlisted objs.
  122. local id_count ! for identical (or plural) objects
  123. #ifset USE_PLURAL_OBJECTS
  124. local j, this_class
  125. #endif
  126.  
  127. if not conjunction
  128. conjunction = AND_WORD
  129. list_nest++
  130. for obj in thisobj
  131. {
  132. if obj is hidden
  133. {
  134. obj is already_listed
  135. #ifclear NO_OBJLIB
  136. if obj.type = scenery
  137. obj is known
  138. #endif
  139. }
  140. else
  141. obj is known
  142.  
  143. #ifset USE_PLURAL_OBJECTS
  144.  
  145. ! Need to count identical (and possibly plural) objects
  146. ! for grouping in listing
  147.  
  148. if obj.identical_to and obj is not already_listed
  149. {
  150. this_class = obj.identical_to
  151. if this_class.type = identical_class or
  152. FORMAT & GROUPPLURALS_F
  153. {
  154. id_count = 1
  155. for (i=1; i<=this_class.#plural_of; i++)
  156. {
  157. j = this_class.plural_of #i
  158. if j in thisobj and j~=obj and j is not hidden
  159. {
  160. id_count++
  161. pluralcount++
  162. list_count--
  163. j is already_listed
  164. }
  165. }
  166. }
  167. }
  168. #endif
  169. if obj is not already_listed
  170. {
  171. ! May have a leading "is" or "are" that needs to
  172. ! be printed at the head of the list
  173.  
  174. if FORMAT & ISORARE_F
  175. {
  176. if list_count = 1 and id_count <= 1 and
  177. obj is not plural
  178. {
  179. RLibMessage(&ListObjects,1, IS_WORD) ! "is"
  180. ! print " "; IS_WORD;
  181. }
  182. else
  183. {
  184. RLibMessage(&ListObjects,1, ARE_WORD) ! "are"
  185. ! print " "; ARE_WORD;
  186. }
  187. if FORMAT & LIST_F
  188. RLibMessage(&ListObjects,2) ! ":"
  189. FORMAT = FORMAT & ~ISORARE_F ! clear it
  190. }
  191.  
  192. need_newline = false
  193. if obj is plural
  194. pluralcount++
  195.  
  196. AssignPronoun(obj)
  197. if not (FORMAT & LIST_F)
  198. {
  199. if list_count > 2 and count
  200. print ",";
  201. if list_count > 1 and count = list_count - 1
  202. print " "; conjunction;
  203. if not (FORMAT & FIRSTCAPITAL_F)
  204. print " ";
  205. }
  206. else
  207. {
  208. print to (list_nest * 2); ! INDENT_SIZE);
  209. }
  210.  
  211. #ifset USE_PLURAL_OBJECTS
  212.  
  213. ! If a number of identical (or possibly plural)
  214. ! objects are grouped together, they are printed
  215. ! as a single entry in the list
  216. !
  217. if obj.identical_to and
  218. (this_class.type = identical_class or
  219. FORMAT & GROUPPLURALS_F)
  220. {
  221. if id_count = 1
  222. {
  223. if FORMAT & FIRSTCAPITAL_F
  224. CArt(obj)
  225. else
  226. Art(obj)
  227. }
  228. else
  229. {
  230. if FORMAT & FIRSTCAPITAL_F
  231. print NumberWord(id_count, true);
  232. else
  233. print NumberWord(id_count);
  234. print " "; this_class.name;
  235.  
  236. if this_class.type = plural_class
  237. {
  238. local k
  239.  
  240. if FORMAT & LIST_F
  241. print ":";
  242. else
  243. print " (";
  244.  
  245. k = 0
  246. for (i=1; i<=this_class.#plural_of; i++)
  247. {
  248. j = this_class.plural_of #i
  249. if parent(j) = thisobj
  250. {
  251. if not (FORMAT & LIST_F)
  252. {
  253. if id_count > 2 and k
  254. print ",";
  255. if k = id_count - 1
  256. print " "; AND_WORD;
  257. if k
  258. print " ";
  259. }
  260. else
  261. {
  262. print "\\n";
  263. print to ((list_nest+1) * 2); ! INDENT_SIZE);
  264. }
  265. Art(j)
  266. if not (FORMAT & NOPARENTHESES_F)
  267. ObjectIs(j)
  268. k++
  269. }
  270. }
  271. if not (FORMAT & LIST_F): print ")";
  272. }
  273. }
  274. }
  275. else
  276. {
  277. #endif
  278. ! Regular old non-plural, non-identical
  279. ! objects get listed here:
  280.  
  281. if FORMAT & FIRSTCAPITAL_F
  282. CArt(obj)
  283. else: Art(obj)
  284. if not (FORMAT & NOPARENTHESES_F)
  285. ObjectIs(obj)
  286. #ifset USE_PLURAL_OBJECTS
  287. }
  288. #endif
  289. FORMAT = FORMAT & ~FIRSTCAPITAL_F ! clear it
  290.  
  291. count++
  292. }
  293.  
  294. ! For itemized listings, list the children of
  295. ! each object immediately after that object (unless
  296. ! it is a SpecialDesc-printed description)
  297.  
  298. if obj is not hidden and FORMAT & LIST_F
  299. {
  300. print newline
  301. if children(obj)
  302. {
  303. if not obj.list_contents
  304. {
  305. templist_count = list_count
  306. WhatsIn(obj)
  307. list_count = templist_count
  308. }
  309. }
  310. }
  311. }
  312.  
  313. ! If not an itemized list, it is necessary to finish off the
  314. ! sentence, adding any necessary words at the end. Then, the
  315. ! children of all previously objects listed at this level are
  316. ! listed.
  317.  
  318. if not (FORMAT & LIST_F)
  319. {
  320. if count
  321. {
  322. if list_nest = 1 and FORMAT & ISORAREHERE_F
  323. {
  324. if count + pluralcount > 1
  325. print " "; ARE_WORD;
  326. else: print " "; IS_WORD;
  327. if not (FORMAT & OVERRIDEHERE_F) or
  328. ((FORMAT & OVERRIDEHERE_F) and thisobj = parent(player))
  329. print " "; HERE_WORD;
  330. if FORMAT & OVERRIDEHERE_F
  331. {
  332. if FORMAT & ALSO_F
  333. {
  334. print " also";
  335. FORMAT = FORMAT & ~ALSO_F
  336. }
  337. print " ";
  338. if thisobj = location and player not in location and
  339. parent(player) is container
  340. {
  341. print "outside ";
  342. }
  343. elseif thisobj is container
  344. print "inside ";
  345. else
  346. print "on ";
  347. The(parent(player))
  348. }
  349. FORMAT = FORMAT & ~ISORAREHERE_F ! clear it
  350. if FORMAT & OVERRIDEHERE_F
  351. FORMAT = FORMAT & ~OVERRIDEHERE_F ! clear it
  352. if not (FORMAT&LIST_F or FORMAT&TEMPLIST_F)
  353. override_indent = true
  354. }
  355.  
  356. if not (FORMAT & NORECURSE_F)
  357. print ".";
  358. }
  359.  
  360. i = 0
  361. local char_count
  362. for obj in thisobj
  363. {
  364. if children(obj) and obj is not hidden and
  365. (obj is not already_listed or
  366. thisobj ~= location) and not ClothingCheck(obj)
  367. char_count++
  368. if char_count = 2
  369. break
  370. }
  371. for obj in thisobj
  372. {
  373. if children(obj) and obj is not hidden and
  374. (obj is not already_listed or
  375. thisobj ~= location) and not ClothingCheck(obj)
  376. {
  377. if FORMAT & TEMPLIST_F
  378. {
  379. FORMAT = FORMAT | LIST_F & ~TEMPLIST_F
  380. i = true
  381. print newline
  382. }
  383.  
  384. if count > 1 and obj.type = character
  385. {
  386. FORMAT = FORMAT | USECHARNAMES_F
  387. if char_count = 2
  388. {
  389. print newline
  390. override_indent = false
  391. }
  392. }
  393. templist_count = list_count
  394. WhatsIn(obj)
  395. list_count = templist_count
  396. }
  397. }
  398. }
  399.  
  400. if --list_nest = 0
  401. {
  402. if not (FORMAT & LIST_F) and not (FORMAT & NORECURSE_F)
  403. {
  404. print newline
  405. override_indent = false
  406. need_newline = false
  407. }
  408. }
  409. }
  410.  
  411. replace Describeplace(place, long)
  412. {
  413. local obj, count, notlisted, tempformat, charcount
  414.  
  415. if not place
  416. place = location
  417.  
  418. if AssignPronounsToRoom
  419. parser_data[PARSER_STATUS] &= ~PRONOUNS_SET
  420.  
  421. ! Since, for example, a room description following entering via
  422. ! DoGo does not trigger before/after properties tied to looking
  423. ! around:
  424. !
  425. #ifclear NO_VERBS
  426. if verbroutine = &MovePlayer
  427. {
  428. if place is not visited and verbosity ~= 1
  429. return Perform(&DoLookAround)
  430. elseif long = true or verbosity = 2
  431. return Perform(&DoLookAround)
  432. }
  433. #endif
  434.  
  435. exit_type = 0 ! clear the exit_type global
  436.  
  437. if not light_source
  438. {
  439. Message(&DescribePlace, 1) ! "It's too dark to see..."
  440. return
  441. }
  442.  
  443. place is known
  444.  
  445. ! Print the name of the location as a heading
  446. RLibMessage(&DescribePlace,1,place)
  447.  
  448. override_indent = false
  449.  
  450. if place is not visited and verbosity ~= 1
  451. {
  452. if &place.initial_desc or &place.long_desc
  453. Indent
  454. if not place.initial_desc
  455. run place.long_desc
  456. }
  457. elseif long = true or verbosity = 2
  458. {
  459. if &place.long_desc
  460. Indent
  461. run place.long_desc
  462. }
  463. elseif place is not visited and verbosity = 1
  464. {
  465. if &place.initial_desc
  466. Indent
  467. run place.initial_desc
  468. }
  469.  
  470. if &place.list_contents and FORMAT & DESCFORM_F
  471. print "" ! for double-space-after-heading formatting
  472.  
  473. ! A location may contain an overriding listing routine, as may any
  474. ! parent, in the list_contents property
  475. !
  476. if not place.list_contents
  477. {
  478. list_nest = 0
  479.  
  480. ! For double-space-after-heading formatting:
  481. if FORMAT & DESCFORM_F
  482. {
  483. for obj in place
  484. {
  485. if obj is not hidden and
  486. (player not in obj or children(obj) > 1)
  487. {
  488. print ""
  489. break
  490. }
  491. }
  492. }
  493.  
  494. ! List contents of chair, vehicle, etc. player is in
  495. if player not in location
  496. {
  497. tempformat = FORMAT
  498. if SmartParents(parent(player))
  499. {
  500. FORMAT = FORMAT | FIRSTCAPITAL_F | ISORAREHERE_F | \\
  501. OVERRIDEHERE_F
  502. if FORMAT & LIST_F
  503. {
  504. FORMAT = FORMAT & ~LIST_F ! clear it
  505. FORMAT = FORMAT | TEMPLIST_F
  506. }
  507. list_nest = 0
  508. }
  509. else
  510. list_nest = 1
  511. WhatsIn(Parent(player))
  512. FORMAT = tempformat
  513. }
  514.  
  515. ! List all characters, if any
  516. count = 0
  517. for obj in place
  518. {
  519. if obj is hidden or obj is not living or
  520. player in obj
  521. {
  522. obj is already_listed
  523. }
  524. else
  525. {
  526. obj is not already_listed
  527. }
  528. }
  529. for obj in place
  530. {
  531. if obj is not already_listed
  532. {
  533. print newline
  534. ShortDescribe(obj)
  535. if obj is not already_listed
  536. count++
  537. }
  538. }
  539.  
  540. list_count = count
  541. count = 0
  542.  
  543. if list_count ! if characters are to be listed
  544. {
  545. charcount++
  546. tempformat = FORMAT
  547. FORMAT = FORMAT | FIRSTCAPITAL_F | ISORAREHERE_F
  548. if SmartParents
  549. FORMAT = FORMAT | OVERRIDEHERE_F
  550. if list_count > 1
  551. FORMAT = FORMAT | USECHARNAMES_F
  552. if FORMAT & LIST_F
  553. {
  554. FORMAT = FORMAT & ~LIST_F ! clear it
  555. FORMAT = FORMAT | TEMPLIST_F
  556. }
  557. Indent
  558. list_nest = 0
  559. ListObjects(place)
  560. FORMAT = tempformat
  561. }
  562.  
  563. for obj in place
  564. {
  565. #ifset USE_ATTACHABLES
  566. ! Exclude all attachables for now (and characters)
  567.  
  568. if obj is living or obj.type = attachable or
  569. player in obj
  570. #else
  571. if obj is living or player in obj
  572. #endif
  573. obj is already_listed
  574. else
  575. obj is not already_listed
  576. }
  577.  
  578. for obj in place
  579. {
  580. #ifset USE_PLURAL_OBJECTS
  581. ! ...And don't list identical objects yet, either
  582.  
  583. if (obj.identical_to).type = identical_class
  584. {
  585. if obj is not hidden
  586. count++
  587. }
  588. elseif player not in obj
  589. #else
  590. if player not in obj
  591. #endif
  592. {
  593. if obj is not already_listed and
  594. obj is not hidden
  595. {
  596. ShortDescribe(obj)
  597. if obj is not already_listed
  598. notlisted++
  599. }
  600. }
  601. }
  602.  
  603. if notlisted or count
  604. {
  605. list_count = notlisted + count
  606. tempformat = FORMAT
  607. FORMAT = FORMAT | FIRSTCAPITAL_F | ISORAREHERE_F
  608. Indent
  609. if SmartParents
  610. {
  611. FORMAT = FORMAT | OVERRIDEHERE_F
  612. if charcount
  613. {
  614. FORMAT = FORMAT | ALSO_F
  615. }
  616. }
  617. if FORMAT & LIST_F
  618. {
  619. FORMAT = FORMAT & ~LIST_F ! clear it
  620. FORMAT = FORMAT | TEMPLIST_F
  621. }
  622. list_nest = 0
  623. ListObjects(place)
  624. FORMAT = tempformat
  625. }
  626.  
  627. #ifclear NO_OBJLIB
  628. #ifset USE_ATTACHABLES
  629. for obj in place
  630. {
  631. ! Print attachables last
  632. if obj.type = attachable and obj is not hidden
  633. {
  634. ShortDescribe(obj)
  635. if obj is not already_listed
  636. Message(&DescribePlace, 2, obj)
  637. }
  638. }
  639. #endif
  640.  
  641. print newline
  642. override_indent = false
  643.  
  644. ! Finally, list contents of scenery objects (unless we've
  645. ! already done so as the parent of the player)
  646. !
  647. for obj in place
  648. {
  649. if obj.type = scenery
  650. {
  651. obj is known
  652. if player not in obj and
  653. ! (obj is open or obj is not openable)
  654. ! ((obj is container and (obj is open or obj is transparent)) or
  655. ! obj is platform) and obj is not quiet
  656. (obj is open or obj is not openable or obj is platform or
  657. obj is transparent) and obj is not quiet
  658. {
  659. list_nest = 1
  660. WhatsIn(obj)
  661. }
  662. }
  663.  
  664. ! For scenery-derived objects that may change the type
  665. elseif obj is static, hidden
  666. obj is known
  667. }
  668. #endif ! ifclear NO_OBJLIB
  669.  
  670. print newline
  671. need_newline = false
  672.  
  673. }
  674. }
  675.  
  676. routine SmartParents(obj)
  677. {
  678. if player not in location and parent(player) is container
  679. return true
  680. else
  681. return false
  682. }
');