home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / monhl105 / delta4 < prev    next >
Encoding:
Text File  |  1992-12-05  |  42.8 KB  |  1,483 lines

  1. Newsgroups: vmsnet.sources.games
  2. Path: uunet!europa.asd.contel.com!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!news.funet.fi!hydra!klaava!hurtta
  3. From: Kari.Hurtta@Helsinki.FI
  4. Subject: Delta: Monster Helsinki 1.05 to 1.06 (part 4/5)
  5. Message-ID: <1992Dec6.181345.20237@klaava.Helsinki.FI>
  6. Followup-To: vmsnet.sources.d
  7. Sender: hurtta@klaava.Helsinki.FI (Kari Hurtta)
  8. Organization: University of Helsinki
  9. Date: Sun, 6 Dec 1992 18:13:45 GMT
  10. Lines: 1470
  11. Xref: uunet vmsnet.sources.games:559
  12.  
  13. Archive-name: monster_helsinki_105_to_106/part4
  14. Author: Kari.Hurtta@Helsinki.FI
  15. Package: Delta from Helsinki Monster 1.05 to Helsinki Monster 1.06
  16. Environment: VMS, Pascal
  17. Part: 4/5
  18.  
  19. -+-+-+-+-+-+-+-+ START OF PART 4 -+-+-+-+-+-+-+-+
  20. X  Returns a list of objects that were duplicated.
  21. X
  22. X  Requirements:
  23. X`09- the code must be in the "privileged" mode
  24. X
  25. X  Errors:
  26. X`09- the code is not in the "privileged" mode
  27. X   `09  => no action; p1 is not evaluated; the result is
  28. X          an empty string
  29. X`09- an object does not have the same onowner as the code
  30. X          and the code is not monster code
  31. X          or
  32. X        - an object does not have the same owner as the code and
  33. X`09  the code does not have the "object" privilege
  34. X          or
  35. X        - the player cannot take any more objects
  36. X          => the object is not duplicated
  37. X
  38. X  Interpretation:
  39. X     p1, result : list
  40. X4 destroy
  41. X  Function: destroy (p1)
  42. X
  43. X  Evaluates p1.
  44. X
  45. X  Destroys all the objects found in the list p1. The objects`20
  46. X  and the monster must have the same owner oror the monster
  47. X  must have the "object" privilege.
  48. X
  49. X  Returns a list of the destroyed objects.
  50. X                         `20
  51. X  Errors:
  52. X`09- the code is not monster code
  53. X`09  => no action; an empty string is returned
  54. X`09- an object and the monster does not have the same
  55. X`09  owner and the monster does not have the "object"
  56. X`09  privilege
  57. X          => the object is not destroyed`20
  58. X
  59. X  Interpretation:
  60. X     p1, result : list   `20
  61. X4 pdestroy
  62. X  Function: pdestroy (p1)
  63. X
  64. X  Evaluates p1.
  65. X
  66. X  Destroys all the objects found in the list p1 from the`20
  67. X  player. The objects and the monster must have the same
  68. X  owner or the monster must have the "object" privilege.
  69. X
  70. X  Returns a list of destroyed objects.
  71. X
  72. X  Requirements:
  73. X`09- the code must be in the "privileged" mode
  74. X
  75. X  Errors:
  76. X`09- the code is not in the "privileged" mode
  77. X`09  => no action; an empty string is returned
  78. X        - an object and the code does not have the same
  79. X`09  owner and te code is not mosnter code
  80. X`09  or
  81. X`09- an object and the monster does not have the same
  82. X`09  owner and the monster does not have the "object"
  83. X`09  privilege
  84. X          => the object is not destroyed`20
  85. X
  86. X  Interpretation:
  87. X     p1, result : list   `20
  88. X4 or
  89. X  Function: or (p1,p2,p3,...)
  90. X
  91. X  Evaluates p1, p2, p3,...
  92. X
  93. X  Returns a list of items found in pN. Every item is included
  94. X  only once.
  95. X
  96. X  Errors:
  97. X   - the result list is longer than 1000 characters
  98. X     => the result is a list containing only so many items
  99. X     that fit into 1000 chars.`20
  100. X
  101. X  Interpretation:
  102. X     pN, result : list
  103. X4 string_head
  104. X  Function: string head (p1)
  105. X
  106. X  Evaluates p1.
  107. X
  108. X  Returns the first word of the string p1.
  109. X
  110. X  Errors:
  111. X`09- p1 is an empty string
  112. X`09  => Ran emprty string is returned
  113. X
  114. X  Interpretation:
  115. X     p1, result : string
  116. X4 string_tail
  117. X  Function: string tail (p1)
  118. X
  119. X  Evaluates p1.
  120. X
  121. X  Returns the tail of string p1 ( all except the first word ).
  122. X
  123. X  Errors:
  124. X`09- p1 is an empty string
  125. X`09  or
  126. X`09- p1 contains only one word
  127. X`09  => an empty string is returned
  128. X
  129. X  Interpretation:
  130. X     p1, result : string
  131. X4 tail
  132. X  Function: tail (p1)
  133. X
  134. X  Evaluates p1.
  135. X
  136. X  Returns the list p1 excluding the first item.
  137. X
  138. X  Errors:
  139. X`09- p1 is an epmty list
  140. X`09  or
  141. X`09- p1 has only one item
  142. X`09  => an empty list/string is returned
  143. X
  144. X  Interpretation:
  145. X     p1, result : list
  146. X4 head
  147. X  Function: head (p1)
  148. X
  149. X  Evaluates p1.
  150. X
  151. X  Returns the first item of the list p1.
  152. X
  153. X  Errors:
  154. X`09- p1 is an empty list
  155. X`09  => an empty string is returned
  156. X
  157. X  Interpretation:
  158. X     p1     : list
  159. X     result : item
  160. X4 lookup_room
  161. X  Function: lookup room (p1)
  162. X
  163. X  Evaluates p1.
  164. X
  165. X  Parses the items found in the list p1 to room names. If`20
  166. X  a parsing is unsuccessfull that item is exculded from the
  167. X  result list.
  168. X
  169. X  Interpretation:
  170. X     p1, result : list
  171. X4 lookup_player
  172. X  Function: lookup player (p1)
  173. X
  174. X  Evaluates p1.
  175. X
  176. X  Parses ( completes ) the items in the p1 list to player
  177. X  and monster names. If the completion of an item fails that
  178. X  item is removed from the result list.
  179. X
  180. X  Interpretation:
  181. X     p1, result : list
  182. X4 lookup_object
  183. X  Function: lookup object (p1)
  184. X
  185. X  Evaluates p1.
  186. X
  187. X  Parses ( completes ) the items in the list p1 to object names.
  188. X  If the completion of an item fails that item is removed from`20
  189. X  the result list.
  190. X
  191. X  Interpretation:
  192. X     p1, result : list
  193. X4 parse_player
  194. X  Function: parse player (p1)
  195. X
  196. X  Evaluates p1.
  197. X
  198. X  The function offers an equivalent parameter interpretation`20
  199. X  service as used in those monster functions where wild cards`20
  200. X  are allowed.
  201. X
  202. X  Return a list of players and monsters. The list is equivalent to
  203. X  parameter p1. ( whatever that implies, then )
  204. X
  205. X  Errors:
  206. X    - p1 is empty
  207. X    or
  208. X    - an error occurs while interpreting p1
  209. X    => the result is an empty string
  210. X
  211. X  Interpretation:
  212. X      p1     : string
  213. X      result : list
  214. X4 parse_object
  215. X  Function: parse object (p1)
  216. X                  `20
  217. X  Evaluates p1.
  218. X
  219. X  Offers an equivalent parameter interpretation service as
  220. X  is used in those monster functions where wild cards are
  221. X  allowed.
  222. X
  223. X  Returns a list of objects equivalent to p1.
  224. X
  225. X  Errors:
  226. X    - p1 is empty`20
  227. X    or
  228. X    - there is an error while interpreting p1
  229. X    => the result is an empty string/list
  230. X
  231. X  Interpretation:
  232. X      p1     : string
  233. X      result : list
  234. X4 parse_room
  235. X  Function: parse room (p1)
  236. X
  237. X  Evaluates p1.
  238. X
  239. X  The function offers an equivalent parameter interpretation service
  240. X  as used in those monster functions where wild cards are allowed.
  241. X
  242. X  Returns a list of rooms equivalent to p1.
  243. X
  244. X  Errors:
  245. X    - p1 is empty
  246. X    or
  247. X    - An error occurs while interpreting p1
  248. X    => the result is an empty string
  249. X
  250. X  Interpretation:
  251. X      p1     : string
  252. X      result : list
  253. X4 privilege
  254. X  Function: privilege (p1,p2)
  255. X
  256. X  Evaluates p1 and p2.
  257. X
  258. X  All the player ( or monster ) p1 privileges found in the
  259. X  list p2 are returned. Possible privileges are : wizard,
  260. X  manager, experience, quota, object, poof, special and
  261. X  monster. The "wizard" privilege means that the player is
  262. X  the Monster Manager.
  263. X
  264. X  Errors:
  265. X`09- p1 is not a player or monster name
  266. X          => the result is an empty string/list
  267. X        - p2 has a non-existent privilege
  268. X          => the privilege is excluded from the`20
  269. X             result list
  270. X
  271. X  Interpretation:
  272. X     p1     : name
  273. X     p2     : list
  274. X     result :  list
  275. X
  276. X4 userid
  277. X  Function: userid (p1)
  278. X
  279. X  Evaluates p1.
  280. X
  281. X  The function requires the "experience" privilege from the
  282. X  monster.
  283. X
  284. X  Returns a list where the player names in p1 have been`20
  285. X  substituted for their respective userids.
  286. X
  287. X  Errors:
  288. X        - the code is not monster code or the monster does not
  289. X          have the "experience" privilege
  290. X          => the function does not evaluate p1; an empty string
  291. X          is returned
  292. X`09- an invalid player ( monster ) name is found
  293. X`09  => the respective userid is excluded from the result
  294. X`09- a monster name is found
  295. X`09  => is included, the userid uses internal format
  296. X
  297. X  Interpretation:
  298. X      p1, result : list
  299. X4 attack
  300. X  Function: attack (p1)
  301. X
  302. X  Evaluates p1.
  303. X
  304. X  Substracts p1 units from the player ( who triggered the
  305. X  action ) health. However, the monster experience dictates
  306. X  the maximum damage allowed ( p1 can be greater than what
  307. X  is allowed in which case p1 is decreased ). The total sum
  308. X  of subsequent attacks may not exceed the maximum damage`20
  309. X  allowed.
  310. X
  311. X  Returns the attack strength.
  312. X
  313. X  Requirements:
  314. X     - Monster cannot have attacked to its limit already.
  315. X     - Player must not be protected
  316. X     - Hooks must be in the "privileged" mode
  317. X
  318. X  Errors:
  319. X     - The monster has already attacked to its limit
  320. X       or
  321. X     - The player is protected
  322. X       or
  323. X     - p1 is not a number
  324. X       or
  325. X     - the code is not monster code and the "privileged"`20
  326. X       mode is off
  327. X       => no action; an empty string/number is returned
  328. X     - p1 is greater than the maximum attack strength
  329. X       allowed
  330. X       => The attack strength is the maximum allowed
  331. X       ( it is also returned )
  332. X     - the code is not monster code and privileged mode
  333. X       is on
  334. X       => no limits in attack strength
  335. X`20
  336. X  Interpretation:
  337. X     p1, result : number
  338. X
  339. X  N.B:
  340. X     - The function does not tell how the attack succeeded
  341. X     ( can be found out be the function "health" )
  342. X     - The function does not require monsters to be
  343. X     in the "privileged" mode anymore
  344. X4 spell_level
  345. X  Function: spell level()
  346. X
  347. X  Returns the user's experience level of a spell. Can only be used
  348. X  while executing spell code ( labels summon and learn ).
  349. X
  350. X  Errors:
  351. X         - As in other spell functions
  352. X           => an empty string is returned
  353. X
  354. X  Interpretation:
  355. X     result : number
  356. X
  357. X  N.B:
  358. X `09 - The spell user ( in the variable "summoner name" )
  359. X           is different from the user executing the code
  360. X`09   ( exception: the label "learn" )
  361. X4 set_spell_level
  362. X  Function: set spell level(p1)
  363. X`20
  364. X  Evaluates p1.
  365. X
  366. X  Sets the spell user's experience level ( of a spell ).`20
  367. X  Can only be used when executing spell code ( the labels
  368. X  "summon" and "learn" ).`20
  369. X    Level 0           - the player does not know the spell
  370. X    a positive number - the player knows the spell
  371. X
  372. X  Returns the new experience level.
  373. X
  374. X  Errors:
  375. X         - As in other spell functions
  376. X         or
  377. X`09 - p1 is not a number
  378. X         or
  379. X`09 - p1 < 0
  380. X          =>an empty string/number is returned
  381. X
  382. X  Interpretation:
  383. X     p1 , result : number
  384. X
  385. X  N.B:
  386. X `09 - The spell user ( in the variable "summoner name" )
  387. X           is different from the user executing the code
  388. X`09   ( exception: the label "learn" )
  389. X`09 - This function is for teaching spells to players
  390. X           ( in the label "learn" )
  391. X`09 - The variable "book name" has the name of the book
  392. X           ( magic book ) that triggered the label "learn" of
  393. X           the spell
  394. X2 Fixing_Database `20
  395. X  Start monster with MONSTER/FIX -command.
  396. X
  397. X  The fixing subsystem uses file level locks to prevent other`20
  398. X  players from playing Monster while you are fixing the database.
  399. X
  400. X  If someone is playing, and you want to fix the database,`20
  401. X  it's better to shut Monster down with the  command "D" in`20
  402. X  the subsystem menu (in system-menu).
  403. X `20
  404. X3 Menu
  405. X  By typing "?" you get the following menu in /FIX -system:
  406. X- 3939, 3940
  407. X  The following commands make partial rebuild of the Monster database.  Afte
  408. Vr`20
  409. X  these command use the fixing commands to fix pointers in the database.
  410. X- 3955, 3961
  411. X  Recommended order: GL R O P M C F N S SP
  412. X
  413. X  You can use only one of these: R, O and P.  Should you need more, use`20
  414. X  /REBUILD  instead.
  415. X
  416. X3 Fix_commands
  417. X  The following commands can fix small errors in the database without disast
  418. Ver:
  419. X- 3973, 3973
  420. X  Recommended order: C I N G J K L D OW
  421. X/
  422. $ CALL UNPACK MONSTER_E.DIF;1 1503667532
  423. $ create 'f'
  424. X-  344,  346
  425. X               Claim room
  426. X               Claim <object>
  427. X               Claim object <object>
  428. X               Claim <monster>
  429. X               Claim monster <monster>
  430. X               Claim <spell>
  431. X               Claim spell <spell>
  432. X-  411,  416
  433. X               Disown room
  434. X               Disown <object>
  435. X               Disown object <object>
  436. X               Disown <monster>
  437. X               Disown monster <monster>
  438. X               Disown <spell>
  439. X               Disown spell <spell>
  440. X
  441. XDescription:   Sets ownership of <object> or <monster> or <spell>
  442. X                  or this room to Disowned
  443. X-  531,  531
  444. XDescription:  Creates a new monster with name <monster>
  445. X-  709
  446. X              Charset             Show name of used character set
  447. X-  782,  785
  448. X              Public room
  449. X              Public <object>
  450. X              Public object <object>
  451. X              Public <monster>
  452. X              Public monster <monster>
  453. X              Public <spell>
  454. X              public spell <spell>
  455. X/
  456. $ CALL UNPACK MONSTER_HELP.DIF;1 170483440
  457. $ create 'f'
  458. X-    1,    1
  459. X! Monster initialization file    (c) Kari Hurtta
  460. X-   20,   20
  461. XREBUILD_OK: true
  462. X-   25,   26
  463. Xroot:    DATABASE_:
  464. Xcoderoot:DATABASE_CODE_: ! mdl database
  465. X-   50,   50
  466. XSorcerer,           70000,       256,      100,      80,      20,    nohidde
  467. Vn
  468. X-   74,   74
  469. X! Eli suomeksi:
  470. X! Monster on suljettu arkisin 09-17.
  471. X
  472. X!Playtime: ++++++++++++++++++++++++   ! Miten niin suljettu ?
  473. X!                                       onpa taas suljettu.
  474. X-   78
  475. X
  476. X
  477. X! default chartable is Multinational
  478. XCHARTABLE:  ! This modifies default chartable - one character per line
  479. XEND OF CHARTABLE
  480. X
  481. X! Time of between database polling in VMS delta-time format
  482. Xdatabase_poltime: 0 ::1          !  One second
  483. X
  484. X! Message what is written when playtime: -entry closes Monster
  485. XCLOSED MESSAGE:
  486. XWelcome to the game Monster!
  487. X
  488. XBut what now?
  489. X
  490. XGoodgulf the Grey appears in a puff of orange smoke!
  491. XHe is very angry...
  492. X
  493. X"What are you doing here? The Dungeon is now closed!"
  494. X
  495. XHe waves his Iron Staff and yells "Begone!"
  496. X
  497. XYou disappear in a burst of multicolored light...
  498. X
  499. XOn wall you see announcement:
  500. X
  501. X**********************************************************************
  502. X*                                                                    *
  503. X*                    Dungeon is closed on weekdays                   *
  504. X*                         between 09.00-17.00                        *
  505. X*                                                                    *
  506. X**********************************************************************
  507. X
  508. XEND OF MESSAGE
  509. X
  510. Xmdl_buffers: 20
  511. Xallow_dcl_access: true
  512. X/
  513. $ CALL UNPACK MONSTER_INIT.DIF;1 1292657895
  514. $ create 'f'
  515. X-    6,    6
  516. X$ scrd = F$PARSE("SYS$SCRATCH:",,,,"SYNTAX_ONLY") - ".;"
  517. X$`20
  518. X-   11,   12
  519. X$ CALL SUBDIR_NAME 'scrd' MONSTER_106_WORK def_work
  520. X$ work_directory == ""
  521. X$ CALL ASK_DIR work_directory "Give work directory for compilation" 'def_wor
  522. Vk'
  523. X-   48,   50
  524. X$ ! IF option .ne. 4 THEN CALL CHECK_FILE 'source_directory'ILMOITUS.TXT
  525. X$ CALL CHECK_FILE 'source_directory'CLD.PROTO
  526. X$ IF option .ne. 4 THEN CALL CHECK_FILE 'source_directory'INIT.PROTO
  527. X$ IF option .eq. 4 THEN CALL CHECK_FILE 'source_directory'INIT.APPEND
  528. X-   77,   82
  529. X$ !IF option .ne. 4`20
  530. X$ !  THEN
  531. X$ !  COPY/LOG 'source_directory'ILMOITUS.TXT 'DBDIR'
  532. X$ !  IF .not. $SEVERITY THEN CALL FATAL "Copy failed"
  533. X$ !ENDIF
  534. X$ SET FILE/PROTECTION=(W:R)/LOG 'DBDIR'MONSTER.HELP
  535. X-   99
  536. X$ IF option .eq. 4 THEN CALL EDIT_INIT
  537. X-  120
  538. X$ IF F$TRNLMN("APPEND") .nes. "" THEN CLOSE APPEND
  539. X$ IF F$TRNLMN("INSFILE") .nes. "" THEN CLOSE INSFILE
  540. X-  150
  541. X$ ELSE
  542. X$   CALL DIRNAME 'full' dname
  543. X$   SET FILE/PROTECTION=(W:E)/LOG 'dname
  544. X$   IF .not. $SEVERITY THEN CALL FATAL "Set file/protection failed"
  545. X-  163,  163
  546. X$ SUBDIR_NAME: SUBROUTINE
  547. X-  168,  175
  548. X-  180,  180
  549. X$ CREATE_SUBDIR: SUBROUTINE
  550. X$ CALL SUBDIR_NAME 'p1' 'p2' subdir_
  551. X$ dir = subdir_
  552. X$ IF F$PARSE(dir) .eqs. ""`20
  553. X$ THEN`20
  554. X$   CREATE/DIRECTORY/LOG/PROTECTION=(S:RWE,O:RWE,G:E,W:E) 'dir
  555. X$   IF .not. $SEVERITY THEN CALL FATAL "Create/directory failed"
  556. X$ ELSE
  557. X$   CALL DIRNAME 'dir' dname
  558. X$   SET FILE/PROTECTION=(W:E)/LOG 'dname
  559. X$   IF .not. $SEVERITY THEN CALL FATAL "Set file/protection failed"
  560. X$ ENDIF
  561. X$ CALL DIRNAME 'dir' dirname
  562. X$ SET FILE/ACL=(IDENTIFIER='F$USER(),access=r+w+e+d+c)/LOG 'dirname
  563. X$ IF .not. $SEVERITY THEN CALL FATAL "Set file/acl failed"
  564. X$ SET FILE/ACL=(IDENTIFIER='F$USER(),OPTIONS=DEFAULT,access=r+w+e+d+c)/LOG '
  565. Vdirname
  566. X$ IF .not. $SEVERITY THEN CALL FATAL "Set file/acl failed"
  567. X$ SET FILE/ACL=(DEFAULT_PROTECTION,SYSTEM:RWED,OWNER:RWED,GROUP,WORLD:RW)/LO
  568. VG 'dirname
  569. X$ IF .not. $SEVERITY THEN CALL FATAL "Set file/acl failed"
  570. X$ 'p3 == dir
  571. X$ EXIT
  572. X$ ENDSUBROUTINE
  573. X$!
  574. X$ DIRNAME: SUBROUTINE
  575. X$ node = F$PARSE(p1,,,"NODE","SYNTAX_ONLY")     ! Usually empty
  576. X-  201,  203
  577. X$    dirname = node + disk + build + tail + name + ".DIR"
  578. X$ ELSE
  579. X$    dirname = node + disk + "<000000>" + name + ".DIR"
  580. X-  243,  243
  581. X$!
  582. X$ APPEND_FILE: SUBROUTINE
  583. X$ COPY/LOG 'p1 'p2
  584. X$ IF .not. $SEVERITY THEN CALL FATAL "Backup copy failed"
  585. X$ OPEN/ERROR=error21 from 'p1
  586. X$ OPEN/ERROR=error22 append 'p3
  587. X$ WRITE SYS$OUTPUT "Creating new ''P1'"
  588. X$ OPEN/WRITE/ERROR=error23 to 'p1
  589. X$again21:
  590. X$ READ/END_OF_FILE=out21 from line
  591. X$ temp=F$EDIT(line,"TRIM,UNCOMMENT")
  592. X$ IF temp .eqs. "" THEN GOTO none21
  593. X$ IF F$LOCATE(p4,temp) .eq. 0 THEN GOTO found21
  594. X$none21:
  595. X$ WRITE to line
  596. X$ GOTO again21
  597. X$found21:
  598. X$ WRITE to line
  599. X$again22:
  600. X$ READ/END_OF_FILE=out22 append line
  601. X$ IF F$LOCATE("%INSERT ",line) .eq. 0 .and. line .nes. ""
  602. X$ THEN
  603. X$    inssym = f$extract(8,F$length(line)-8,line)
  604. X$    file_ = ins_'inssym
  605. X$    OPEN/ERROR=error24 insfile 'file_
  606. X$    WRITE SYS$OUTPUT "Inserting ''file_' to ''P1'"
  607. X$again24:
  608. X$    READ/END_OF_FILE=out24 insfile line
  609. X$    WRITE to line
  610. X$    GOTO again24
  611. X$out24:
  612. X$    CLOSE insfile
  613. X$again25:                                   ! Skip default text
  614. X$    READ/END_OF_FILE=out23 append line
  615. X$    IF F$LOCATE("%ENDINSERT",line) .ne. 0 .or. line .eqs. "" THEN GOTO agai
  616. Vn25
  617. X$    goto out23
  618. X$error24:
  619. X$    WRITE SYS$OUTPUT "Can't open ''file_' - using default text for ''P1'"
  620. X$again23:
  621. X$    READ/END_OF_FILE=out23 append line
  622. X$    IF F$LOCATE("%ENDINSERT",line) .eq. 0 .and. line .nes. "" THEN GOTO out
  623. V23
  624. X$    WRITE to line
  625. X$    GOTO again23
  626. X$out23:
  627. X$ line=""                                                      ! Buggy
  628. X$ ENDIF
  629. X$ write to line
  630. X$ GOTO again22
  631. X$out22:
  632. X$ CLOSE from
  633. X$ CLOSE append
  634. X$ CLOSE to
  635. X$ EXIT`20
  636. X$out21:
  637. X$ CLOSE from
  638. X$ CLOSE append
  639. X$ CLOSE to
  640. X$ CALL FATAL "Label ''p4' don't found from ''p1'"
  641. X$ EXIT
  642. X$error21:
  643. X$ CALL FATAL "Opening of ''p1' failed"
  644. X$ EXIT
  645. X$error22:
  646. X$ CLOSE from
  647. X$ CALL FATAL "Opening of ''p3' failed"
  648. X$ EXIT
  649. X$error23:
  650. X$ CLOSE from
  651. X$ CLOSE append
  652. X$ CALL FATAL "Creating of new ''p1' failed"
  653. X$ EXIT
  654. X$ ENDSUBROUTINE
  655. X$!
  656. X-  247,  247
  657. X$ IF P3 .nes. "" THEN WRITE SYS$OUTPUT "Default: ",P3
  658. X-  386
  659. X$ WRITE SYS$OUTPUT "       and edit MONSTER.INIT"
  660. X-  403
  661. X$!
  662. X$ EDIT_INIT: SUBROUTINE
  663. X$ ins_message :== "''DBDIR'ILMOITUS.TXT"
  664. X$ CALL APPEND_FILE 'image_directory'MONSTER.INIT -
  665. X  'image_directory'MONSTER.INIT_OLD 'source_directory'INIT.APPEND -
  666. X  "min_accept:"
  667. X$ EXIT
  668. X$ ENDSUBROUTINE
  669. X/
  670. $ CALL UNPACK MONSTER_INSTALL.DIF;1 1114963065
  671. $ create 'f'
  672. X-   23
  673. X    9.07.1992 `7C         `7C Fixed some help text
  674. X   12.08.1992 `7C         `7C Dummy player_here removed (now defined in modu
  675. Vle
  676. X              `7C         `7C   PARSER)
  677. X   24.10.1992 `7C`09`09`7C fix_repair_location uudelleenkirjoitettu
  678. X`09      `7C`09`09`7C fixed dummy gethere !!!!!!!!!!!!!!!!!!!!!!!!!!
  679. X-   33,   40
  680. Xprocedure checkevents(silent: boolean := false);
  681. X-   44,   50
  682. X`7B ---------- `7D
  683. X
  684. X`5Bglobal`5D
  685. Xprocedure gethere(n: integer);
  686. Xbegin
  687. X    getroom(n);
  688. X    freeroom;
  689. Xend;
  690. X-  321,  322
  691. X`09writeln('Use the SYSTEM command in MONSTER to view and add capacity to th
  692. Ve database');
  693. X-  334,  334
  694. X   writeln ('E        Leave /fix.');
  695. X-  353,  353
  696. X   writeln ('Q        Leave /fix');
  697. X-  360,  360
  698. X   writeln ('Use SYSTEM command in MONSTER to add database capacity.');
  699. X-  704,  704
  700. X`09writeln ('Creating of Great Hall FAILED');
  701. X-  716,  716
  702. X`09writeln ('Creating of Void FAILED');
  703. X-  729,  729
  704. X`09writeln ('Creating of Pit of Fire FAILED');
  705. X- 1149, 1151
  706. X    ex_indx,sleep_indx,room_indx,header_indx: indexrec;
  707. X    locs: intrec;
  708. X    temp: namrec;
  709. X    c: char;
  710. X    del_it: boolean;
  711. X- 1173, 1173
  712. X    for id := 1 to ex_indx.top do if not ex_indx.free`5Bid`5D then begin
  713. X- 1178, 1219
  714. X`09    del_it := false;
  715. X
  716. X`09    readv(user.idents`5Bid`5D,c,code,error := continue);`20
  717. X`09    if statusv <> 0 then begin
  718. X`09`09writeln('Bad monster username record #',id:1);
  719. X`09`09writeln('    player name: ',pers.idents`5Bid`5D);
  720. X`09`09writeln('    user name:   ',user.idents`5Bid`5D);
  721. X`09`09del_it := true;
  722. X`09`09code := 0;
  723. X`09    end else begin
  724. X`09`09found_counter := 0;
  725. X`09`09true_loc := 0;
  726. X`09`09loc := locs.int`5Bid`5D;
  727. X
  728. X`09`09for room := 1 to room_indx.top do if not room_indx.free`5Broom`5D`20
  729. X`09`09    then begin
  730. X`09`09    getroom(room); `7B locking `7D
  731. X`09`09    for slot := 1 to maxpeople do begin
  732. X`09`09`09if (here.people`5Bslot`5D.parm = code) and`20
  733. X`09`09`09    (here.people`5Bslot`5D.kind = P_MONSTER) then begin
  734. X`09`09`09    found_counter := found_counter +1;
  735. X`09`09`09    true_loc := room;
  736. X`09`09`09    if here.people`5Bslot`5D.username <>`20
  737. X`09`09`09`09user.idents`5Bid`5D then begin`20
  738. X`09`09`09`09writeln(pers.idents`5Bid`5D,
  739. X`09`09`09`09    ': Bad username field in room ',
  740. X`09`09`09`09    here.nicename,
  741. X`09`09`09`09    ' (slot #',slot:1,') - fixed.');
  742. X`09`09`09`09here.people`5Bslot`5D.username := user.idents`5Bid`5D;
  743. X`09`09`09    end; `7B if `7D
  744. X`09`09`09end; `7B if `7D
  745. X`09`09    end; `7B slot `7D
  746. X`09`09    putroom;       `7B storing `7D
  747. X`09`09end; `7B room -loop `7D
  748. X`09`09if (found_counter = 1) and (true_loc = loc) then
  749. X`09`09    writeln(pers.idents`5Bid`5D,': ok')
  750. X`09`09else if found_counter = 0 then begin
  751. X`09`09    writeln(pers.idents`5Bid`5D,': not found from any room.');
  752. X`09`09    del_it := true;
  753. X`09`09end else if (found_counter = 1) and ( loc <> true_loc) then begin
  754. X`09`09    writeln(pers.idents`5Bid`5D,': found from wrong location - updated
  755. V.');
  756. X`09`09    locs.int`5Bid`5D := true_loc;
  757. X`09`09end else if (found_counter > 1) then begin
  758. X`09`09    writeln(pers.idents`5Bid`5D,': duplicated monster - deleted.');
  759. X`09`09end else writeln('%',pers.idents`5Bid`5D,': bad software error !!');
  760. X`09    end; `7B if statusv <> 0 (parsing monster username) `7D
  761. X`09    if del_it and (code = 0) then`20
  762. X`09`09writeln(pers.idents`5Bid`5D,'% can''t delete it !')
  763. X`09    else if del_it then begin`20
  764. X`09`09writeln(pers.idents`5Bid`5D,'% deleting.');
  765. X`09`09for room := 1 to room_indx.top do`20
  766. X`09`09    if not room_indx.free`5Broom`5D then begin
  767. X`09`09    getroom(room); `7B locking `7D
  768. X`09`09    for slot := 1 to maxpeople do begin
  769. X`09`09`09if (here.people`5Bslot`5D.parm = code) and`20
  770. X`09`09`09(here.people`5Bslot`5D.kind = P_MONSTER) then begin
  771. X- 1223, 1233
  772. X`09`09`09    writeln(pers.idents`5Bid`5D,
  773. X`09`09`09`09'% deleted from room ',here.nicename,
  774. X`09`09`09`09' (slot #',slot:1,')');
  775. X`09`09`09end; `7B if `7D
  776. X`09`09    end; `7B for slot `7D
  777. X`09`09    putroom;`09    `7B unlocking `7D
  778. X`09`09end; `7B end of room loop `7D
  779. X`09`09if not header_indx.free`5Bcode`5D then begin
  780. X`09`09    header_indx.free`5Bcode`5D := true;
  781. X`09`09    header_indx.inuse := sleep_indx.inuse - 1;`20
  782. X`09`09    delete_program(code);
  783. X`09`09    writeln(pers.idents`5Bid`5D,'% MDL code #',code:1,' deleted.');
  784. X`09`09end else
  785. X`09`09    writeln(pers.idents`5Bid`5D,
  786. X`09`09`09'% MDL code #',code:1,' was already deleted !');
  787. X
  788. X- 1246, 1247
  789. X`09    end; `7B del_it `7D
  790. X`09end; `7B if user.idents`5Bid`5D `7D
  791. X    end; `7B for id `7D
  792. X- 1322, 1322
  793. X`09    if old_value <> table`5Bobject`5D then`20
  794. X`09`09writeln(obj.oname,' fixed: ',old_value:1,' -> ',
  795. X`09`09table`5Bobject`5D:1);
  796. X/
  797. $ CALL UNPACK MONSTER_REBUILD.DIF;1 137326107
  798. $ create 'f'
  799. X-   20,   20
  800. X 11.6.1990    `7C Hurtta  `7C  read_global_flag
  801. X 12.8.1992    `7C         `7C  Dummy player_here removed (now defined in mod
  802. Vule`20
  803. X              `7C         `7C      PARSER
  804. X-   25,   29
  805. X
  806. X`7B DUMMY for linker `7D
  807. X`5Bglobal`5D
  808. Xprocedure gethere(n: integer := 0);
  809. Xbegin
  810. X-   34,   34
  811. Xprocedure checkevents(silent: boolean := false);
  812. X-   38,   43
  813. X/
  814. $ CALL UNPACK MONSTER_WHO.DIF;1 2132369292
  815. $ create 'f'
  816. X- Jorma Korkiakoski translated Finnish ducumentation of MDL to English
  817. X  (This includes only MDL functions of version 1.05). And fix (part of)
  818. X  monster_e.hlp. (Thanks !)
  819. X- New commands:
  820. X`09show charset
  821. X- New command forms:
  822. X`09claim room
  823. X`09claim object `7Bobject`7D
  824. X`09claim monster `7Bmonster`7D
  825. X`09claim spell `7Bspell`7D
  826. X`09disown room
  827. X`09disown object `7Bobject`7D
  828. X`09disown monster `7Bmonster`7D
  829. X`09disown spell `7Bspell`7D
  830. X`09public room
  831. X`09public object `7Bobject`7D
  832. X`09public monster `7Bmonster`7D
  833. X`09public spell `7Bspell`7D
  834. X
  835. X`09If `7Borject`7D, `7Bmonster`7D or `7Bspell`7D argument is missing, it is
  836. V prompted.
  837. X`09If it is ambiquous, list for possible matches are given (selection
  838. X`09`09by number or cursor keys).
  839. X- New MDL-functions:
  840. X`09boolean and (arg1,arg2,...)
  841. X`09boolean or (arg1,arg2,...)
  842. X`09or else (arg1,arg2,...)
  843. X`09and then (arg1,arg2,...)
  844. X- Changed MDL-functions:
  845. X`09get global flag(arg)
  846. X`09strip (arg)
  847. X- Default character set is now Dec Multinational
  848. X- If argument of command is ambiquos, monster gives list of possible
  849. X  matches and player can select correct one by number or by cursor keys.
  850. X  (This not apply to all commands or all forms of commands.)
  851. X  This is available (at least) in following commands:
  852. X`09claim `5Bobject`7Cmonster`7Cspell`5D `7Bsomething`7D
  853. X`09disown `5Bobject`7Cmonster`7Cspell`5D `7Bsomething`7D
  854. X`09public `5Bobject`7Cmonster`7Cspell`5D `7Bsomething`7D
  855. X`09custom `5Bobject`7Cmonster`5D `7Bsomething`7D
  856. X`09get `7Bobejct`7D
  857. X`09drop `7Bobject`7D
  858. X`09delete `5Broom`7Cobject`7Cmonster`5D `7Bsomething`7D
  859. X`09scan `7Bobject`7D
  860. X`09destroy `7Bobject`7D
  861. X`09duplicate `7Bobject`7D
  862. X`09erase `7Bmonster`7D
  863. X`09reset `7Bobject`7D
  864. X`09wear `7Bobject`7D
  865. X`09wield `7Bobject`7D
  866. X`09set `7Bsomething`7D
  867. X- New tables in MONSTER.INIT:
  868. X`09CHARTABLE:   (can be empty)
  869. X`09`7B charset ....
  870. X`09  char ... `7D`09`09`09This table also effects to parsing of`20
  871. X`09END OF CHARTABLE`09`09MDL and MDL function strip(...).
  872. X
  873. X`09CLOSED MESSAGE:`09`09`09This is same as ILMOITUS.TXT file
  874. X`09`7Bsome text`7D`09`09`09`09in previously.
  875. X`09END OF MESSAGE
  876. X- New fields in MONSTER.INIT:`09`09(this is value what MONSTER_INSTALL.COM
  877. X`09`09`09`09`09 gives)
  878. X`09database_poltime:`09`09default "0 ::1"
  879. X`09mdl_buffers: `09`09`09default 20
  880. X`09dcl_access_allowed:`09`09default yes
  881. X- Format of dump of MONSTER/DUMP is also changed little (as usual).
  882. X`09MONSTER/REBUILD (of course) reads all previous formats.
  883. X- MDL parser now tires check if variable is used before it defination
  884. X`09in compile time (not easy task, because variables are defined`20
  885. X`09dynamically).
  886. X- MDL code loading from terminal is now handled correctly (no block
  887. X`09Monster's event loop). So you can use "g tt:" command to
  888. X`09enter MDL -code.
  889. X- MDL interpreter should now be little faster (and use memory
  890. X`09little more sensible - however number of mdl -buffers
  891. X`09is now 20 by default instead of 5).
  892. X- BUG fixes:
  893. X`09- recovery routines in MONSTER/FIX destroys intergity
  894. X`09  of database in version 1.05. Now fixed.
  895. X`09- MONSTER/DUMP - MONSTER/REBUILD now not destroy end
  896. X`09  of descriptions lines if these are near to 80 characters.
  897. X        - MONSTER/REBUILD don't now crashed so easily when it
  898. X`09  detects some errors in dumpfile.
  899. X`09- Some other bug fixes.
  900. $ CALL UNPACK NEW.TXT;1 1848652340
  901. $ create 'f'
  902. X-    1,    1
  903. X`5Benvironment,inherit ('Global','Database','Guts') `5D
  904. X-  112,  114
  905. X`09myslot: `5Bglobal`5D integer := 1;`09`7B here.people`5Bmyslot`5D... is th
  906. Vis player `7D
  907. X
  908. X-  218,  219
  909. X-  230,  233
  910. X`09`09sprime := '';
  911. X`09`09for i := 1 to length(s) do
  912. X`09`09`09case chartable`5Bs`5Bi`5D`5D.kind of
  913. X`09`09`09    ct_none:    ;`09`7B DISCARD `7D
  914. X`09`09`09    otherwise   sprime := sprime +`20
  915. X`09`09`09`09    chartable`5Bs`5Bi`5D`5D.lcase;
  916. X`09`09`09end; `7B case `7D
  917. X-  241,  247
  918. X   case chartable`5Ba`5D.kind of
  919. X`09ct_space, ct_none:`09classify := space;
  920. X`09otherwise case a of
  921. X`09    '"':`09`09classify := string_c;
  922. X`09    '(',')',',','-':`09classify := bracket;            `20
  923. X`09    '!':`09`09classify := comment;
  924. X`09    otherwise`09`09classify := letter;
  925. X`09end; `7B case a `7D
  926. X   end; `7B case chartable `7D
  927. X-  258,  263
  928. X`09if chartable`5Binbuf `5B1`5D`5D.kind = ct_none then  `7B DISCARD `7D
  929. X`09else if chartable`5Binbuf `5B1`5D`5D.kind <> ct_space then begin
  930. X`09    bf := bf + inbuf `5B1`5D;
  931. X`09    space_f := false;
  932. X`09end else if not space_f then begin
  933. X`09    bf := bf + ' ';
  934. X`09    space_f := true;
  935. X`09end;
  936. X`09inbuf := substr(inbuf,2,length(inbuf)-1)
  937. X    end;     `20
  938. X    if bf > '' then if chartable`5Bbf`5Blength(bf)`5D`5D.kind = ct_space the
  939. Vn
  940. X-  273
  941. X    result,result2: shortstring;
  942. X-  277,  277
  943. X    if x > length (main) then result := ''
  944. X-  285,  289
  945. X`09result := substr(main,start,x-start);
  946. X`09x := x +1
  947. X    end;
  948. X    result2 := '';
  949. X    for i := 1 to length(result) do
  950. X`09if chartable`5Bresult`5Bi`5D`5D.kind <> ct_none then`20
  951. X`09    result2 := result2 + result`5Bi`5D;
  952. X    cut_atom := result;
  953. Xend; `7B cut_atom `7D
  954. X
  955. X`5Bglobal`5D
  956. Xfunction obj_here(n: integer; nohidden: boolean := false): boolean;
  957. Xvar
  958. X`09i: integer;
  959. X`09found: boolean;
  960. X
  961. Xbegin
  962. X    i := 1;
  963. X    found := false;
  964. X    while (i <= maxobjs) and (not found) do begin
  965. X`09if here.objs`5Bi`5D = n then begin
  966. X`09    if not nohidden then found := true
  967. X`09    else if here.objhide`5Bi`5D = 0 then found := true
  968. X`09    else i := i + 1;
  969. X`09end else i := i + 1;
  970. X    end;
  971. X    obj_here := found;
  972. Xend; `7B obj_here `7D
  973. X
  974. X`5Bglobal`5D   `20
  975. Xfunction player_here(id: integer; var slot: integer): boolean;
  976. X    `7B suppose that gethere and getpers have made `7D
  977. Xvar i: integer;
  978. X    name: shortstring;
  979. Xbegin
  980. X    slot := 0;
  981. X    name := lowcase(pers.idents`5Bid`5D);
  982. X    for i := 1 to maxpeople do
  983. X`09if here.people`5Bi`5D.kind > 0 then
  984. X`09`09if lowcase(here.people`5Bi`5D.name) = name then slot := i;
  985. X    player_here := slot > 0;
  986. Xend; `7B player_here `7D
  987. X
  988. X`7B returns true if object N is being held by the player (id slot)`7D
  989. X
  990. Xfunction obj_hold(n: integer; slot: integer := 0): boolean;
  991. Xvar
  992. X`09i: integer;
  993. X`09found: boolean;
  994. X
  995. Xbegin
  996. X`09if slot = 0 then slot := myslot;
  997. X`09
  998. X`09if n = 0 then
  999. X`09`09obj_hold := false
  1000. X`09else begin
  1001. X`09`09i := 1;
  1002. X`09`09found := false;
  1003. X`09`09while (i <= maxhold) and (not found) do begin
  1004. X`09`09`09if here.people`5Bslot`5D.holding`5Bi`5D = n then
  1005. X`09`09`09`09found := true
  1006. X`09`09`09else
  1007. X`09`09`09`09i := i + 1;
  1008. X`09`09end;
  1009. X`09`09obj_hold := found;
  1010. X`09end;
  1011. Xend; `7B obj_hold `7D
  1012. X
  1013. Xtype tabletype = array `5B 1.. maxroom`5D of boolean;
  1014. X     `7B used in lookup_general and in meta_scan `7D
  1015. X
  1016. Xfunction solve_ambiquous(rec: namrec; indx: indexrec;
  1017. X`09`09`09 table: tabletype; s: string;
  1018. X`09`09`09 var result: integer): boolean;
  1019. Xlabel quit_label;
  1020. X
  1021. X    procedure leave;
  1022. X    begin
  1023. X`09writeln('QUIT - no selection');
  1024. X`09solve_ambiquous := false;
  1025. X`09goto quit_label;
  1026. X    end;
  1027. X
  1028. Xvar mapping : array `5B 1 .. maxroom `5D of 1 .. maxroom;
  1029. X    count,i,current: integer;
  1030. X    line: string;
  1031. X    ok: boolean;`20
  1032. Xbegin
  1033. X    writeln('"',s,'" is ambiquous - Refer you one of following?');
  1034. X    count := 0;
  1035. X    for i := 1 to indx.top do`20
  1036. X`09if table`5Bi`5D then begin
  1037. X`09`09count := count +1;
  1038. X`09`09writeln(' ',count:3,' ',rec.idents`5Bi`5D);
  1039. X`09`09mapping`5Bcount`5D := i;
  1040. X`09end;
  1041. X    current := 0;
  1042. X    ok := false;
  1043. X    writeln('Give number (0 for nothing) or use cursor keys (UP and DOWN) fo
  1044. Vr selection.');
  1045. X    repeat
  1046. X`09if current = 0 then line := '  0'
  1047. X`09else writev(line,current:3,' ; ',rec.idents`5Bmapping`5Bcurrent`5D`5D);
  1048. X`09grab_line('selection: ',line,edit_mode := true,eof_handler := leave);
  1049. X`09if grab_next < 0 then begin
  1050. X`09    current := current -1;
  1051. X`09    if current < 0 then current := count;
  1052. X`09end else if grab_next > 0 then begin
  1053. X`09    current := current +1;
  1054. X`09    if current > count then current := 0;
  1055. X`09end else begin
  1056. X`09    readv(line,i,error:=continue);
  1057. X`09    if statusv = 0 then`20
  1058. X`09`09if (i >= 0) or (i <= count) then begin
  1059. X`09`09    current := i;
  1060. X`09`09    ok := true;
  1061. X`09    end;
  1062. X`09end;
  1063. X    until ok;
  1064. X
  1065. X    if current = 0 then solve_ambiquous := false
  1066. X    else begin
  1067. X`09result := mapping`5Bcurrent`5D;
  1068. X`09solve_ambiquous := true;
  1069. X    end;
  1070. X
  1071. X    quit_label:
  1072. Xend; `7B solve_ambiquous `7D
  1073. X
  1074. Xfunction solve_ambiquous_list (list : array `5B lower .. upper : integer `5D
  1075. X`09`09`09`09    of shortstring;
  1076. X                               table: tabletype;
  1077. X`09`09`09       s: string; var result: integer): boolean;
  1078. Xlabel quit_label;
  1079. X
  1080. X    procedure leave;
  1081. X    begin
  1082. X`09writeln('QUIT - no selection');
  1083. X`09solve_ambiquous_list := false;
  1084. X`09goto quit_label;
  1085. X    end;
  1086. X
  1087. Xvar mapping : array `5B 1 .. maxroom `5D of 1 .. maxroom;
  1088. X    count,i,current: integer;
  1089. X    line: string;
  1090. X    ok: boolean;`20
  1091. X
  1092. Xbegin
  1093. X    writeln('"',s,'" is ambiquous - Refer you one of following?');
  1094. X    count := 0;
  1095. X
  1096. X    for i := lower to upper do if table`5Bi`5D then begin
  1097. X`09 count := count +1;
  1098. X`09 writeln(' ',count:3,' ',list`5Bi`5D);
  1099. X`09 mapping`5Bcount`5D := i;
  1100. X    end;
  1101. X
  1102. X    current := 0;
  1103. X    ok := false;
  1104. X    writeln('Give number (0 for nothing) or use cursor keys (UP and DOWN) fo
  1105. Vr selection.');
  1106. X    repeat
  1107. X`09if current = 0 then line := '  0'
  1108. X`09else writev(line,current:3,' ; ',list`5Bmapping`5Bcurrent`5D`5D);
  1109. X`09grab_line('selection: ',line,edit_mode := true,eof_handler := leave);
  1110. X`09if grab_next < 0 then begin
  1111. X`09    current := current -1;
  1112. X`09    if current < 0 then current := count;
  1113. X`09end else if grab_next > 0 then begin
  1114. X`09    current := current +1;
  1115. X`09    if current > count then current := 0;
  1116. X`09end else begin
  1117. X`09    readv(line,i,error:=continue);
  1118. X`09    if statusv = 0 then`20
  1119. X`09`09if (i >= 0) or (i <= count) then begin
  1120. X`09`09    current := i;
  1121. X`09`09    ok := true;
  1122. X`09    end;
  1123. X`09end;
  1124. X    until ok;
  1125. X
  1126. X    if current = 0 then solve_ambiquous_list := false
  1127. X    else begin
  1128. X`09result := mapping`5Bcurrent`5D;
  1129. X`09solve_ambiquous_list := true;
  1130. X    end;
  1131. X
  1132. X    quit_label:
  1133. Xend; `7B solve_ambiquous_list `7D
  1134. X`09`09`09      `20
  1135. X-  295,  296
  1136. X    table: tabletype;
  1137. Xbegin
  1138. X    if debug then writeln('lookup_general: ',s);   `20
  1139. X    for i := 1 to maxroom do table`5Bi`5D := false;
  1140. X
  1141. X-  307,  309
  1142. X`09    else if (index(temp,s) = 1) or (index(temp,' '+s) > 1) then begin
  1143. X`09`09maybe := maybe + 1;
  1144. X`09`09poss := i;
  1145. X`09`09table`5Bi`5D := true;
  1146. X-  322,  328
  1147. X`09    lookup_general := solve_ambiquous(rec,indx,table,s,id);
  1148. X`09end else lookup_general := false;
  1149. X-  380
  1150. X
  1151. X`5Bglobal`5D`20
  1152. Xfunction parse_pers(var pnum: integer;s: string; help: boolean := false):`20
  1153. X    boolean;
  1154. Xvar
  1155. X`09i,poss,maybe,num: integer;
  1156. X`09pname: string;
  1157. X
  1158. X`09names: array `5B 1 .. maxpeople `5D of shortstring;
  1159. X`09table: tabletype;
  1160. Xbegin
  1161. X`09gethere;
  1162. X`09s := lowcase(s);
  1163. X`09i := 1;
  1164. X`09maybe := 0;
  1165. X`09num := 0;
  1166. X`09for i := 1 to maxpeople do begin
  1167. X`09`09table`5Bi`5D := false;
  1168. X
  1169. X`09`09if (here.people`5Bi`5D.kind > 0) and`20
  1170. X`09`09    (here.people`5Bi`5D.hiding = 0) then begin
  1171. X`09`09`09pname := lowcase(here.people`5Bi`5D.name);
  1172. X`09`09`09names `5B i `5D := here.people`5Bi`5D.name;
  1173. X
  1174. X`09`09`09if s = pname then
  1175. X`09`09`09`09num := i
  1176. X`09`09`09else if (index(pname,s) = 1) or`20
  1177. X`09`09`09        (index(pname,' '+s) > 1) then begin
  1178. X`09`09`09`09table`5Bi`5D := true;
  1179. X`09`09`09`09maybe := maybe + 1;
  1180. X`09`09`09`09poss := i;
  1181. X`09`09`09end;
  1182. X`09`09end;
  1183. X`09end;
  1184. X`09if num <> 0 then begin
  1185. X`09`09pnum := num;
  1186. X`09`09parse_pers := true;
  1187. X`09end else if maybe = 1 then begin
  1188. X`09`09pnum := poss;
  1189. X`09`09parse_pers := true;
  1190. X`09end else if maybe > 1 then begin
  1191. X`09`09pnum := 0;
  1192. X`09`09if help then parse_pers :=
  1193. X`09`09    solve_ambiquous_list(names,table,s,pnum)
  1194. X`09`09else parse_pers := false;
  1195. X`09end else begin
  1196. X`09`09pnum := 0;
  1197. X`09`09parse_pers := false;
  1198. X`09end;
  1199. Xend; `7B parse_pers `7D
  1200. X
  1201. X`7B similar to lookup_obj, but only returns true if the object is in
  1202. X  this room or is being held by the player `7D
  1203. X`7B and s may be in the middle of the objact name -- Leino@finuh `7D
  1204. X
  1205. Xfunction parse_obj (var pnum: integer;
  1206. X`09`09`09s: string; help: boolean := false): boolean;
  1207. Xvar
  1208. X`09i,poss,maybe: integer;
  1209. X
  1210. X`09table: tabletype;
  1211. X`09temp: shortstring;
  1212. X
  1213. Xbegin
  1214. X`09getobjnam;
  1215. X`09freeobjnam;
  1216. X`09getindex(I_OBJECT);
  1217. X`09freeindex;
  1218. X
  1219. X        for i := 1 to maxroom do table`5Bi`5D := false;
  1220. X
  1221. X`09s := lowcase(s);
  1222. X`09pnum := 0;
  1223. X`09maybe := 0;
  1224. X`09for i := 1 to indx.top do begin
  1225. X`09`09if not(indx.free`5Bi`5D) then begin
  1226. X`09`09`09temp := lowcase(objnam.idents`5Bi`5D);
  1227. X`09`09`09if s =  temp then begin
  1228. X`09`09`09`09if obj_here(i) or obj_hold(i) then
  1229. X`09`09`09`09    pnum := i
  1230. X`09`09`09end else if ((index(temp,s) = 1) or
  1231. X`09`09`09`09(index(temp,' '+s) > 0)) then begin
  1232. X`09`09`09    if (obj_here(i) or obj_hold(i)) then begin
  1233. X`09`09`09`09maybe := maybe + 1;
  1234. X`09`09`09`09poss := i;
  1235. X`09`09`09`09table`5Bi`5D := true;
  1236. X`09`09`09    end;
  1237. X`09`09`09end;
  1238. X`09`09end;
  1239. X`09end;
  1240. X`09if pnum <> 0 then begin
  1241. X`09`09parse_obj := true;
  1242. X`09end else if maybe = 1 then begin
  1243. X`09`09pnum := poss;
  1244. X`09`09parse_obj := true;
  1245. X`09end else if maybe > 1 then begin
  1246. X`09   if help then parse_obj := solve_ambiquous(objnam,indx,table,s,pnum)
  1247. X`09   else parse_obj := false;
  1248. X`09end else begin
  1249. X`09`09parse_obj := false;
  1250. X`09end;
  1251. Xend; `7B parse_obj `7D
  1252. X
  1253. X
  1254. X-  390,  390
  1255. X-  404
  1256. X`09temp: shortstring;
  1257. X-  411,  412
  1258. X`09    temp := clean_spaces(lowcase(name.idents`5Bi`5D));
  1259. X`09    if ((index(temp,atom) = 1) or`20
  1260. X`09`09((index(temp,' '+atom) > 0)`20
  1261. X-  423,  424
  1262. X-  443,  444
  1263. X`09    if silent then error := true
  1264. X`09    else if error then writeln('"',atom,'" is ambiquous.')
  1265. X`09    else error := not solve_ambiquous(name,indx,temp,atom,exact);
  1266. X-  555
  1267. X`09table: tabletype;
  1268. X`09temp: shortstring;
  1269. X-  562,  567
  1270. X
  1271. X`09for i := 1 to maxroom do table`5Bi`5D := false;
  1272. X
  1273. X`09for i := 1 to maxexit do begin
  1274. X`09`09temp := lowcase(direct`5Bi`5D);
  1275. X`09`09if s = temp then num := i
  1276. X`09`09else if index(temp,s) = 1 then begin
  1277. X`09`09`09maybe := maybe + 1;
  1278. X`09`09`09poss := i;
  1279. X`09`09`09table`5Bi`5D := true;
  1280. X-  579,  585
  1281. X`09    if help then lookup_dir := solve_ambiquous_list (direct,table,s,dir)
  1282. X`09    else lookup_dir := false;
  1283. X-  596,  598
  1284. X`09table: tabletype;
  1285. X`09temp: shortstring;
  1286. Xbegin
  1287. X    if debug then writeln('lookup_show: ',s);
  1288. X
  1289. X`09for i := 1 to maxroom do table`5Bi`5D := false;
  1290. X
  1291. X-  604,  608
  1292. X`09`09temp := lowcase(show`5Bi`5D);
  1293. X`09`09if s = temp then num := i
  1294. X`09`09else if index(temp,s) = 1 then begin
  1295. X`09`09`09maybe := maybe + 1;
  1296. X`09`09`09poss := i;
  1297. X`09`09`09table`5Bi`5D := true;
  1298. X-  620,  626
  1299. X`09    if help then lookup_show := solve_ambiquous_list(show,table,s,n)
  1300. X`09    else lookup_show := false;
  1301. X-  637,  637
  1302. X`09table: tabletype;
  1303. X`09temp: shortstring;
  1304. X-  644,  649
  1305. X
  1306. X`09for i := 1 to maxroom do table`5Bi`5D := false;
  1307. X
  1308. X`09for i := 1 to numset do begin
  1309. X`09`09temp := lowcase(setkey`5Bi`5D);
  1310. X`09`09if s = temp then num := i
  1311. X`09`09else if index(temp,s) = 1 then begin
  1312. X`09`09`09maybe := maybe + 1;
  1313. X`09`09`09poss := i;
  1314. X`09`09`09table`5Bi`5D := true;
  1315. X-  660,  666
  1316. X`09    if help then lookup_set := solve_ambiquous_list(setkey,table,s,n)
  1317. X`09    else lookup_set := false;
  1318. X-  681,  681
  1319. X`09`09if lowcase(nam.idents`5Bn`5D) = lowcase(s) then
  1320. X-  693,  701
  1321. X`09ident_cache: `5Bstatic`5D integer := -1;
  1322. X`09ident_last: `5Bstatic`5D string := '';
  1323. X`09cache_ok: boolean;
  1324. Xbegin
  1325. X`09`7B because INT_* routines calls so many time, we
  1326. X`09  build one item deep cache for that routine.
  1327. X`09  Cache supposes that new monster/player isn't`20
  1328. X`09  get same name as what was asked in last time or
  1329. X`09  name isn't changed.`20
  1330. X
  1331. X`09  Chance detect only if player/monster is deleted.
  1332. X`09  I think that, this is enough.
  1333. X`09`7D
  1334. X
  1335. X`09cache_ok := false;
  1336. X`09if (ident_last = s) and (ident_cache > 0) then begin
  1337. X`09    getindex(I_PLAYER);
  1338. X`09`09if ident_cache < indx.top then
  1339. X`09`09    if not indx.free`5Bident_cache`5D then cache_ok := true
  1340. X`09`09    else ident_cache := -1;
  1341. X`09    freeindex;
  1342. X`09end;
  1343. X`09`09
  1344. X`09if cache_ok then begin
  1345. X`09    n := ident_cache;
  1346. X`09    exact_pers := true;
  1347. X`09end else if lookup_pers(n,s) then begin
  1348. X`09`09if lowcase(pers.idents`5Bn`5D) = lowcase(s) then begin
  1349. X`09`09    ident_cache := n;
  1350. X`09`09    ident_last := s;
  1351. X`09`09    exact_pers := true
  1352. X`09`09end else begin
  1353. X`09`09    ident_cache := -1;
  1354. X`09`09    exact_pers := false;
  1355. X`09`09end;
  1356. X`09end else begin
  1357. X`09    ident_cache := -1;
  1358. X`09    exact_pers := false;
  1359. X`09end;
  1360. X-  726,  726
  1361. X`09`09if lowcase(objnam.idents`5Bn`5D) = lowcase(s) then
  1362. X-  739,  739
  1363. X`09names: array `5B 1 .. maxclass `5D of shortstring;
  1364. X`09table: tabletype;
  1365. X`09temp: shortstring;
  1366. X-  747,  751
  1367. X`09`09table`5Bi`5D := false;
  1368. X`09`09names`5Bi`5D := classtable`5Bi`5D.name;
  1369. X`09`09temp := lowcase(classtable`5Bi`5D.name);
  1370. X`09`09if s = temp then num := i
  1371. X`09`09else if index(temp,s) = 1 then begin
  1372. X`09`09`09maybe := maybe + 1;
  1373. X`09`09`09poss := i;
  1374. X`09`09`09table`5Bi`5D := true;
  1375. X-  763,  770
  1376. X`09    id := '<error>';
  1377. X`09    lookup_class := false;
  1378. X`09    if help then begin
  1379. X`09`09if solve_ambiquous_list(names,table,s,num) then begin
  1380. X`09`09    id := classtable`5Bnum`5D.id;
  1381. X`09`09    lookup_class := true;
  1382. X`09`09end;
  1383. X`09    end;
  1384. X-  782
  1385. X`09names: array `5B 1 .. maxpriv `5D of shortstring;
  1386. X`09table: tabletype;
  1387. X
  1388. X-  789
  1389. X`09`09table`5Bi`5D := false;
  1390. X`09`09names`5Bi`5D := privtable`5Bi`5D.name;
  1391. X-  794
  1392. X`09`09`09table`5Bi`5D := true;
  1393. X-  806,  813
  1394. X`09    id := 0;
  1395. X`09    lookup_priv := false;
  1396. X`09    if help then begin
  1397. X`09`09if solve_ambiquous_list(names,table,s,num) then begin
  1398. X`09`09    id := privtable`5Bnum`5D.value;
  1399. X`09`09    lookup_priv := true;
  1400. X`09`09end;
  1401. X`09    end;
  1402. X-  826
  1403. X`09names: array `5B 1 .. maxtype`5D of shortstring;
  1404. X`09table: tabletype;
  1405. X-  835
  1406. X`09`09names`5Bi`5D := name;
  1407. X`09`09table`5Bi`5D := false;
  1408. X-  840
  1409. X`09`09`09table`5Bi`5D := true;
  1410. X-  852,  866
  1411. X`09`09id := t_none;
  1412. X`09`09lookup_type := false;
  1413. X`09    if help then begin
  1414. X`09`09if solve_ambiquous_list(names,table,s,num) then begin
  1415. X`09`09    id := typetable`5Bnum`5D.value;
  1416. X`09`09    lookup_type := true;
  1417. X`09`09end;
  1418. X`09    end;
  1419. X-  878
  1420. X`09names: array `5B 1 .. maxflag`5D of shortstring;
  1421. X`09table: tabletype;
  1422. X-  885
  1423. X`09`09table`5Bi`5D := false;
  1424. X`09`09names`5Bi`5D := flagtable`5Bi`5D.name;
  1425. X-  902,  909
  1426. X`09    id := 0;
  1427. X`09    lookup_flag := false;
  1428. X`09    if help then begin
  1429. X`09`09if solve_ambiquous_list(names,table,s,num) then begin
  1430. X`09`09    id := flagtable`5Bnum`5D.value;
  1431. X`09`09    lookup_flag := true;
  1432. X`09`09end;
  1433. X`09    end;
  1434. X/
  1435. $ CALL UNPACK PARSER.DIF;1 463208737
  1436. $ create 'f'
  1437. X-    3
  1438. Xconst max_message_lines = 50;
  1439. X
  1440. X-    8
  1441. X    msg: array `5B1 .. max_message_lines`5D of string;
  1442. X    msg_count: 0 .. max_message_lines := 0;
  1443. X
  1444. X    alloc_dcl_access: boolean := true;
  1445. X
  1446. X-   45,   47
  1447. X-   51,   51
  1448. X`09if ok then ok := chartable`5Bline`5B1`5D`5D.kind = ct_space;
  1449. X`09if ok then line := substr(line,2,length(line)-1);
  1450. X    end;
  1451. X
  1452. X    ok := true;
  1453. X    while ok do begin
  1454. X`09ok := line > '';
  1455. X`09if ok then ok := chartable`5Bline`5Blength(line)`5D`5D.kind = ct_space;
  1456. X-   65,   68
  1457. X    procedure message(s: string);
  1458. X    begin
  1459. X`09writeln('%Error in ',path);
  1460. X`09writeln('%at line ',counter:1);
  1461. X`09writeln('%',current_line);
  1462. X`09writeln('%',s);
  1463. X`09writeln('%Notify Monster Manager.');
  1464. X`09halt;
  1465. X    end; `7B message `7D
  1466. X
  1467. X    function get_line (exact: boolean := false): string;
  1468. X    var line: string;
  1469. X`09pos,i: integer;
  1470. X`09ok,quoted: boolean;
  1471. X-   74
  1472. X`09`09counter := counter +1;
  1473. X`09`09current_line := '';
  1474. X-   79,   85
  1475. X`09`09
  1476. X`09`09if not exact then begin
  1477. X`09`09    quoted := false;
  1478. X`09`09    pos := 0;
  1479. +-+-+-+-+-+-+-+-  END  OF PART 4 +-+-+-+-+-+-+-+-
  1480. -- 
  1481. - K E H                                      /  El{m{ on monimutkaista
  1482.   Kari.Hurtta@Helsinki.FI
  1483.