home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / monhl10b / delta2 < prev    next >
Encoding:
Internet Message Format  |  1992-08-02  |  43.0 KB

  1. Path: uunet!mcsun!news.funet.fi!hydra!klaava!hurtta
  2. From: Kari.Hurtta@Helsinki.FI (Kari. E. Hurtta)
  3. Newsgroups: vmsnet.sources.games
  4. Subject: Monster Helsinki, Delta from 1.04 to 1.05 - part 2/7
  5. Message-ID: <1992Jun30.200629.11291@klaava.Helsinki.FI>
  6. Date: 30 Jun 92 20:06:29 GMT
  7. Sender: hurtta@klaava.Helsinki.FI (Kari Hurtta)
  8. Followup-To: vmsnet.sources.d
  9. Organization: University of Helsinki
  10. Lines: 1268
  11.  
  12. Archive-name: monster_helsinki_104_to_105/delta2
  13. Environment: VMS, Pascal
  14. Author: Kari.Hurtta@Helsinki.FI
  15.  
  16. -+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
  17. X`009maybe := 0;
  18. X`009num := 0;
  19. X`009for i := 1 to maxdetail do begin
  20. X`009`009if s = here.detail`091i`093 then
  21. X`009`009`009num := i
  22. X`009`009else if index(here.detail`091i`093,s) = 1 then begin
  23. X`009`009`009maybe := maybe + 1;
  24. X`009`009`009poss := i;
  25. X`009`009end;
  26. X`009end;
  27. X`009if num <> 0 then begin
  28. X`009`009n := num;
  29. X`009`009lookup_detail := true;
  30. X`009end else if maybe = 1 then begin
  31. X`009`009n := poss;
  32. X`009`009lookup_detail := true;
  33. X`009end else if maybe > 1 then begin
  34. X`009`009lookup_detail := false;
  35. X`009end else begin
  36. X`009`009lookup_detail := false;
  37. X-  643,  752
  38. X`123
  39. XUser describe procedure.  If no s then describe the room
  40. X
  41. XKnown problem: if two people edit the description to the same room one of th
  42. Veir
  43. X`009description blocks could be lost.
  44. XThis is unlikely to happen unless the Monster Manager tries to edit a
  45. Xdescription while the room's owner is also editing it.
  46. X`125
  47. X`091global`093 PROCEDURE do_describe(s: string);
  48. Xvar
  49. X`009i: integer;
  50. X`009newdsc: integer;
  51. X
  52. Xbegin
  53. X`009gethere;
  54. X`009if checkhide then begin
  55. X`009if s = '' then begin `123 describe this room `125
  56. X`009`009if desc_allowed then begin
  57. X`009`009`009log_action(desc,0);
  58. X`009`009`009writeln('`091 Editing the primary room description `093');
  59. X`009`009`009newdsc := here.primary;
  60. X`009`009`009if edit_desc(newdsc) then begin
  61. X`009`009`009`009getroom;
  62. X`009`009`009`009here.primary := newdsc;
  63. X`009`009`009`009putroom;
  64. X`009`009`009end;
  65. X`009`009`009log_event(myslot,E_EDITDONE,0,0);
  66. X`009`009end;
  67. X`009end else begin`123 describe a detail of this room `125
  68. X`009`009if length(s) > veryshortlen then
  69. X`009`009`009writeln('Your detail keyword can only be ',veryshortlen:1,' char
  70. Vacters.')
  71. X`009`009else if desc_allowed then begin
  72. X`009`009`009if not(lookup_detail(i,s)) then
  73. X`009`009`009if not(alloc_detail(i,s)) then begin
  74. X`009`009`009`009writeln('You have used all ',maxdetail:1,' details.');
  75. X`009`009`009`009writeln('To delete a detail, DESCRIBE <the detail> and delet
  76. Ve all the text.');
  77. X`009`009`009end;
  78. X`009`009`009if i <> 0 then begin
  79. X`009`009`009`009log_action(e_detail,0);
  80. X`009`009`009`009writeln('`091 Editing detail "',here.detail`091i`093,'" of t
  81. Vhis room `093');
  82. X`009`009`009`009newdsc := here.detaildesc`091i`093;
  83. X`009`009`009`009if edit_desc(newdsc) then begin
  84. X`009`009`009`009`009getroom;
  85. X`009`009`009`009`009here.detaildesc`091i`093 := newdsc;
  86. X`009`009`009`009`009putroom;
  87. X`009`009`009`009end;
  88. X`009`009`009`009log_event(myslot,E_DONEDET,0,0);
  89. X`009`009`009end;
  90. X`009`009end;
  91. X`009end;
  92. X`123`009clear_command;`009`125
  93. X-  756,  878
  94. X`123 return TRUE if the player is allowed to program the object n
  95. X  if checkpub is true then obj_owner will return true if the object in
  96. X  question is public `125
  97. X
  98. X`091global`093 function obj_owner(n: integer;checkpub: boolean := FALSE):boo
  99. Vlean;
  100. Xbegin
  101. X`009getobjown;
  102. X`009freeobjown;
  103. X`009if (objown.idents`091n`093 = userid) or`032
  104. X`009    (owner_priv and (objown.idents`091n`093 <> system_id)) or
  105. X`009    manager_priv then begin `123 minor change by leino@finuha `125
  106. X`009`009`009`009    `123 and hurtta@finuh `125
  107. X`009`009obj_owner := true;
  108. X`009end else if (objown.idents`091n`093 = public_id) and (checkpub) then beg
  109. Vin
  110. X`009`009obj_owner := true;
  111. X`009end else begin
  112. X`009`009obj_owner := false;
  113. X-  882,  906
  114. X`091global`093 function parse_pers(var pnum: integer;s: string): boolean;
  115. Xvar
  116. X`009persnum: integer;
  117. X`009i,poss,maybe,num: integer;
  118. X`009pname: string;
  119. X
  120. Xbegin
  121. X`009gethere;
  122. X`009s := lowcase(s);
  123. X`009i := 1;
  124. X`009maybe := 0;
  125. X`009num := 0;
  126. X`009for i := 1 to maxpeople do begin
  127. X`123`009`009if here.people`091i`093.username <> '' then begin`009`125
  128. X
  129. X`009`009if here.people`091i`093.kind > 0 then begin
  130. X`009`009`009pname := lowcase(here.people`091i`093.name);
  131. X
  132. X`009`009`009if s = pname then
  133. X`009`009`009`009num := i
  134. X`009`009`009else if index(pname,s) = 1 then begin
  135. X`009`009`009`009maybe := maybe + 1;
  136. X`009`009`009`009poss := i;
  137. X`009`009`009end;
  138. X`009`009end;
  139. X`009end;
  140. X`009if num <> 0 then begin
  141. X`009`009persnum := num;
  142. X`009`009parse_pers := true;
  143. X`009end else if maybe = 1 then begin
  144. X`009`009persnum := poss;
  145. X`009`009parse_pers := true;
  146. X`009end else if maybe > 1 then begin
  147. X`009`009persnum := 0;
  148. X`009`009parse_pers := false;
  149. X`009end else begin
  150. X`009`009persnum := 0;
  151. X`009`009parse_pers := false;
  152. X`009end;
  153. X`009if persnum > 0 then begin
  154. X`009`009if here.people`091persnum`093.hiding > 0 then
  155. X`009`009`009parse_pers := false
  156. X`009`009else begin
  157. X`009`009`009parse_pers := true;
  158. X`009`009`009pnum := persnum;
  159. X`009`009end;
  160. X-  910,  926
  161. X`091global`093 function lookup_level(var n: integer;s:string): boolean;
  162. Xvar
  163. X`009i,poss,maybe,num: integer;
  164. Xbegin
  165. X`009n := 0;
  166. X`009s := lowcase(s);
  167. X`009i := 1;
  168. X`009maybe := 0;
  169. X`009num := 0;
  170. X`009for i := 1 to levels do begin
  171. X`009`009if s = lowcase (leveltable`091i`093.name) then
  172. X`009`009`009num := i
  173. X`009`009else if index(lowcase (leveltable`091i`093.name),s) = 1 then begin
  174. X`009`009`009maybe := maybe + 1;
  175. X`009`009`009poss := i;
  176. X`009`009end;
  177. X`009end;
  178. X`009if num <> 0 then begin
  179. X`009`009n := num;
  180. X`009`009lookup_level := true;
  181. X`009end else if maybe = 1 then begin
  182. X`009`009n := poss;
  183. X`009`009lookup_level := true;
  184. X`009end else if maybe > 1 then begin
  185. X`009`009lookup_level := false;
  186. X`009end else begin
  187. X`009`009lookup_level := false;
  188. X`009end;
  189. Xend; `123 lookup_level `125
  190. X
  191. X
  192. X`123 custom ROOM -----------------------------------------------------------
  193. V---- `125
  194. X
  195. X
  196. Xfunction room_nameinuse(num: integer; newname: string): boolean;
  197. Xvar
  198. X`009dummy: integer;
  199. X
  200. Xbegin
  201. X`009if exact_room(dummy,newname) then begin
  202. X`009`009if dummy = num then
  203. X`009`009`009room_nameinuse := false
  204. X`009`009else
  205. X`009`009`009room_nameinuse := true;
  206. X`009end else
  207. X`009`009room_nameinuse := false;
  208. Xend;
  209. X
  210. X
  211. X
  212. Xprocedure do_rename(param: string);
  213. Xlabel exit_label;
  214. Xvar
  215. X`009dummy: integer;
  216. X`009newname: string;
  217. X-  935,  944
  218. Xbegin
  219. X`009gethere;
  220. X`009if param > '' then newname := param
  221. X`009else begin
  222. X`009`009writeln('This room is named ',here.nicename);
  223. X`009`009writeln;
  224. X`009`009grab_line('New name? ',newname,eof_handler := leave);
  225. X`009end;
  226. X`009if (newname = '') or (newname = '**') then
  227. X`009`009writeln('No changes.')
  228. X`009else if length(newname) > shortlen then
  229. X`009`009writeln('Please limit your room name to ',shortlen:1,' characters.')
  230. X`009else if room_nameinuse(location,newname) then
  231. X`009`009writeln(newname,' is not a unique room name.')
  232. X`009else begin
  233. X`009`009getroom;
  234. X`009`009here.nicename := newname;
  235. X`009`009putroom;
  236. X
  237. X`009`009getnam;
  238. X`009`009nam.idents`091location`093 := lowcase(newname);
  239. X`009`009putnam;
  240. X`009`009writeln('Room name updated.');
  241. X-  949,  972
  242. X
  243. Xfunction obj_nameinuse(objnum: integer; newname: string): boolean;
  244. Xvar
  245. X`009dummy: integer;
  246. X
  247. Xbegin
  248. X`009if exact_obj(dummy,newname) then begin
  249. X`009`009if dummy = objnum then
  250. X`009`009`009obj_nameinuse := false
  251. X`009`009else
  252. X`009`009`009obj_nameinuse := true;
  253. X`009end else
  254. X`009`009obj_nameinuse := false;
  255. Xend;
  256. X
  257. X
  258. Xprocedure do_objrename(objnum: integer; param: string);
  259. Xlabel exit_label;
  260. Xvar
  261. X`009newname: string;
  262. X`009s: string;
  263. X-  980, 1016
  264. Xbegin
  265. X`009getobj(objnum);
  266. X`009freeobj;
  267. X
  268. X`009if param > '' then newname := param
  269. X`009else begin
  270. X`009`009writeln('This object is named ',obj.oname);
  271. X`009`009writeln;
  272. X`009`009grab_line('New name? ',newname,eof_handler := leave);
  273. X`009end;
  274. X`009if (newname = '') or (newname = '**') then
  275. X`009`009writeln('No changes.')
  276. X`009else if length(newname) > shortlen then
  277. X`009`009writeln('Please limit your object name to ',shortlen:1,' characters.
  278. V')
  279. X`009else if obj_nameinuse(objnum,newname) then
  280. X`009`009writeln(newname,' is not a unique object name.')
  281. X`009else begin
  282. X`009`009getobj(objnum);
  283. X`009`009obj.oname := newname;
  284. X`009`009putobj;
  285. X
  286. X`009`009getobjnam;
  287. X`009`009objnam.idents`091objnum`093 := lowcase(newname);
  288. X`009`009putobjnam;
  289. X`009`009writeln('Object name updated.');
  290. X`009end;
  291. X    exit_label:
  292. Xend;
  293. X
  294. X
  295. X
  296. Xprocedure view_room;
  297. Xvar
  298. X`009s: string;
  299. X- 1021, 1028
  300. X`009getnam;
  301. X`009freenam;
  302. X`009getobjnam;
  303. X`009freeobjnam;
  304. X
  305. X`009with here do begin
  306. X`009`009writeln('Room:        ',nicename);
  307. X`009`009case nameprint of
  308. X`009`009`0090: writeln('Room name not printed');
  309. X`009`009`0091: writeln('"You''re in" precedes room name');
  310. X`009`009`0092: writeln('"You''re at" precedes room name');
  311. X`009`009`0093: writeln('"You''re in the" precedes room name');
  312. X`009`009`0094: writeln('"You''re at the" precedes room name');
  313. X`009`009`0095: writeln('"You''re in a" precedes room name');
  314. X`009`009`0096: writeln('"You''re at a" precedes room name');
  315. X`009`009`0097: writeln('"You''re in an" precedes room name');
  316. X`009`009`0098: writeln('"You''re at an" precedes room name');
  317. X`009`009`009otherwise writeln('Room name printing is damaged.');
  318. X`009`009end;
  319. X
  320. X`009`009writeln('Room owner:    ',class_out(owner));
  321. X
  322. X`009`009if primary = 0 then
  323. X`009`009`009writeln('There is no primary description')
  324. X`009`009else
  325. X`009`009`009writeln('There is a primary description');
  326. X
  327. X`009`009if secondary = 0 then
  328. X`009`009`009writeln('There is no secondary description')
  329. X`009`009else
  330. X`009`009`009writeln('There is a secondary description');
  331. X
  332. X`009`009case which of
  333. X`009`009`0090: writeln('Only the primary description will print');
  334. X`009`009`0091: writeln('Only the secondary description will print');
  335. X`009`009`0092: writeln('Both the primary and secondary descriptions will pri
  336. Vnt');
  337. X`009`009`0093: begin
  338. X`009`009`009`009writeln('The primary description will print, followed by the
  339. V seconary description');
  340. X`009`009`009`009writeln('if the player is holding the magic object');
  341. X`009`009`009   end;
  342. X`009`009`0094: begin
  343. X`009`009`009`009writeln('If the player is holding the magic object, the seco
  344. Vndary description will print');
  345. X`009`009`009`009writeln('Otherwise, the primary description will print');
  346. X`009`009`009   end;
  347. X`009`009`009otherwise writeln('The way the room description prints is damage
  348. Vd');
  349. X`009`009end;
  350. X
  351. X`009`009writeln;
  352. X`009`009if magicobj = 0 then
  353. X`009`009`009writeln('There is no magic object for this room')
  354. X`009`009else
  355. X`009`009`009writeln('The magic object for this room is the ',objnam.idents`0
  356. V91magicobj`093,'.');
  357. X
  358. X`009`009if objdrop = 0 then
  359. X`009`009`009writeln('Dropped objects remain here')
  360. X`009`009else begin
  361. X`009`009`009writeln('Dropped objects go to ',nam.idents`091objdrop`093,'.');
  362. X`009`009`009if objdesc = 0 then
  363. X`009`009`009`009writeln('Dropped.')
  364. X`009`009`009else
  365. X`009`009`009`009print_line(objdesc);
  366. X`009`009`009if objdest = 0 then
  367. X`009`009`009`009writeln('Nothing is printed when object "bounces in" to targ
  368. Vet room')
  369. X`009`009`009else
  370. X`009`009`009`009print_line(objdest);
  371. X`009`009end;
  372. X`009`009writeln;
  373. X`009`009if trapto = 0 then
  374. X`009`009`009writeln('There is no trapdoor set')
  375. X`009`009else
  376. X`009`009`009writeln('The trapdoor sends players ',direct`091trapto`093,
  377. X`009`009`009`009' with a chance factor of ',trapchance:1,'%');
  378. X
  379. X`009`009if hook > 0 then writeln ('There is a hook in this room.');
  380. X`009`009for i := 1 to maxdetail do begin
  381. X`009`009`009if length(detail`091i`093) > 0 then begin
  382. X`009`009`009`009write('Detail "',detail`091i`093,'" ');
  383. X`009`009`009`009if detaildesc`091i`093 > 0 then
  384. X`009`009`009`009`009writeln('has a description')
  385. X`009`009`009`009else
  386. X`009`009`009`009`009writeln('has no description');
  387. X`009`009`009end;
  388. X`009`009end;
  389. X`009`009writeln;
  390. X- 1032, 1036
  391. X
  392. X`091global`093 procedure custom_room;
  393. Xlabel exit_label;
  394. Xvar
  395. X`009done: boolean;
  396. X`009prompt,param: string;
  397. X`009n: integer;
  398. X`009s: string;
  399. X`009newdsc: integer;
  400. X`009bool: boolean;
  401. X`009prevloc: integer;
  402. X- 1040, 1042
  403. X`009writeln('EXIT - no changes.');
  404. X`009goto exit_label;
  405. X- 1047, 1090
  406. X`009log_action(e_custroom,0);
  407. X`009writeln;
  408. X`009writeln('Customizing this room');
  409. X`009writeln('If you would rather be customizing an exit, type CUSTOM <direct
  410. Vion of exit>');
  411. X`009writeln('If you would rather be customizing an object, type CUSTOM <obje
  412. Vct name>');
  413. X`009writeln;
  414. X`009done := false;
  415. X`009prompt := 'Custom> ';
  416. X
  417. X`009repeat
  418. X`009`009repeat
  419. X`009`009`009grab_line(prompt,s,eof_handler := leave);
  420. X`009`009`009param := slead(s);
  421. X`009`009`009s := bite(param);
  422. X`009`009until length(s) > 0;`009`009
  423. X`009`009s := lowcase(s);`009`009
  424. X`009`009case s`0911`093 of
  425. X`009`009`009'c': begin
  426. X`009`009`009`009gethere;
  427. X`009`009`009`009n := here.hook;
  428. X`009`009`009`009prevloc := location;
  429. X`009`009`009`009custom_hook(n,here.owner,
  430. X`009`009`009`009    trim_filename(here.nicename));
  431. X`009`009`009`009if (prevloc <> location) then begin
  432. X`009`009`009`009`009writeln('You can no longer customize this room.');
  433. X                                        done := true;
  434. X`009`009`009`009end else begin
  435. X                   `009`009`009getroom;
  436. X`009`009`009`009`009here.hook := n;
  437. X`009`009`009`009`009putroom
  438. X`009`009`009`009end;
  439. X`009`009`009     end;
  440. X`009`009`009'e','q': done := true;
  441. X`009`009`009'?','h': command_help('*room help*');
  442. X`009`009`009'r': do_rename (param);
  443. X`009`009`009'v': view_room;
  444. X`123dir trapdoor goes`125`009't': begin
  445. X`009`009`009`009if param > '' then s := param
  446. X`009`009`009`009else grab_line('What direction does the trapdoor exit throug
  447. Vh? ',
  448. X`009`009`009`009    s,eof_handler := leave);
  449. X`009`009`009`009if length(s) > 0 then begin
  450. X`009`009`009`009`009if lookup_dir(n,s) then begin
  451. X`009`009`009`009`009`009getroom;
  452. X`009`009`009`009`009`009here.trapto := n;
  453. X`009`009`009`009`009`009putroom;
  454. X`009`009`009`009`009`009writeln('Room updated.');
  455. X`009`009`009`009`009end else
  456. X`009`009`009`009`009`009writeln('No such direction.');
  457. X`009`009`009`009end else
  458. X`009`009`009`009`009writeln('No changes.');
  459. X`009`009`009     end;
  460. X`123chance`125`009`009'f': begin
  461. X`009`009`009`009if param > '' then s := param
  462. X`009`009`009`009else begin
  463. X`009`009`009`009`009writeln('Enter the chance that in any given minute the p
  464. Vlayer will fall through');
  465. X`009`009`009`009`009writeln('the trapdoor (0-100) :');
  466. X`009`009`009`009`009writeln;
  467. X`009`009`009`009`009grab_line('? ',s,eof_handler := leave);
  468. X`009`009`009`009end;
  469. X`009`009`009`009if isnum(s) then begin
  470. X`009`009`009`009`009n := number(s);
  471. X`009`009`009`009`009if n in `0910..100`093 then begin
  472. X`009`009`009`009`009`009getroom;
  473. X`009`009`009`009`009`009here.trapchance := n;
  474. X`009`009`009`009`009`009putroom;
  475. X`009`009`009`009`009end else
  476. X`009`009`009`009`009`009writeln('Out of range.');
  477. X`009`009`009`009end else
  478. X`009`009`009`009`009writeln('No changes.');
  479. X`009`009`009     end;
  480. X`009`009`009's': begin
  481. X`009`009`009`009newdsc := here.secondary;
  482. X`009`009`009`009writeln('`091 Editing the secondary room description `093');
  483. X`009`009`009`009if edit_desc(newdsc) then begin
  484. X`009`009`009`009`009getroom;
  485. X`009`009`009`009`009here.secondary := newdsc;
  486. X`009`009`009`009`009putroom;
  487. X`009`009`009`009end;
  488. X`009`009`009     end;
  489. X`009`009`009'i': begin
  490. X`009`009`009`009newdsc := here.exitfail;
  491. X`009`009`009`009writeln('`091 Editing th default exit failure  description `
  492. V093');
  493. X`009`009`009`009if edit_desc(newdsc) then begin
  494. X`009`009`009`009`009getroom;
  495. X`009`009`009`009`009here.exitfail := newdsc;
  496. X`009`009`009`009`009putroom;
  497. X`009`009`009`009end;
  498. X`009`009`009     end;
  499. X`009`009 `009'p': begin
  500. X`123 same as desc `125`009`009newdsc := here.primary;
  501. X`009`009`009`009writeln('`091 Editing the primary room description `093');
  502. X`009`009`009`009if edit_desc(newdsc) then begin
  503. X`009`009`009`009`009getroom;
  504. X`009`009`009`009`009here.primary := newdsc;
  505. X`009`009`009`009`009putroom;
  506. X`009`009`009`009end;
  507. X`009`009`009     end;
  508. X`009`009`009'o': begin
  509. X`009`009`009`009writeln('Enter the line that will be printed when someone dr
  510. Vops an object here:');
  511. X`009`009`009`009writeln('If dropped objects do not stay here, you may use a
  512. V # for the object name.');
  513. X`009`009`009`009writeln('Right now it says:');
  514. X`009`009`009`009if here.objdesc = 0 then
  515. X`009`009`009`009`009writeln('Dropped. `091default`093')
  516. X`009`009`009`009else
  517. X`009`009`009`009`009print_line(here.objdesc);
  518. X
  519. X`009`009`009`009n := here.objdesc;
  520. X`009`009`009`009make_line(n);
  521. X`009`009`009`009getroom;
  522. X`009`009`009`009here.objdesc := n;
  523. X`009`009`009`009putroom;
  524. X`009`009`009     end;
  525. X`009  `009`009'x': begin
  526. X`009`009`009`009writeln('Enter a line that will be randomly shown.');
  527. X`009`009`009`009writeln('Right now it says:');
  528. X`009`009`009`009if here.rndmsg = 0 then
  529. X`009`009`009`009`009writeln('`091none defined`093')
  530. X`009`009`009`009else
  531. X`009`009`009`009`009print_line(here.rndmsg);
  532. X
  533. X`009`009`009`009n := here.rndmsg;
  534. X`009`009`009`009make_line(n);
  535. X`009`009`009`009getroom;
  536. X`009`009`009`009here.rndmsg := n;
  537. X`009`009`009`009putroom;
  538. X`009`009`009     end;
  539. X`123alternate mystery msg`125`009'a': do_y_altmsg;`032
  540. X`123bounced in desc`125`009'b': begin
  541. X`009`009`009`009writeln('Enter the line that will be displayed in the room w
  542. Vhere an object really');
  543. X`009`009`009`009writeln('goes when an object dropped here "bounces" there:')
  544. V;
  545. X`009`009`009`009writeln('Place a # where the object name should go.');
  546. X`009`009`009`009writeln;
  547. X`009`009`009`009writeln('Right now it says:');
  548. X`009`009`009`009if here.objdest = 0 then
  549. X`009`009`009`009`009writeln('Something has bounced into the room.')
  550. X`009`009`009`009else
  551. X`009`009`009`009`009print_line(here.objdest);
  552. X
  553. X`009`009`009`009n := here.objdest;
  554. X`009`009`009`009make_line(n);
  555. X`009`009`009`009getroom;
  556. X`009`009`009`009here.objdest := n;
  557. X`009`009`009`009putroom;
  558. X`009`009`009     end;
  559. X`123visual links`125`009`009'1': do_group1;
  560. X`009`009`009'2': do_group2;
  561. X`009`009`009'm': begin
  562. X`009`009`009`009getobjnam;
  563. X`009`009`009`009freeobjnam;
  564. X`009`009`009`009if param > '' then s := param
  565. X`009`009`009`009else begin
  566. X`009`009`009`009`009if here.magicobj = 0 then
  567. X`009`009`009`009`009`009writeln('There is currently no magic object for this
  568. V room.')
  569. X`009`009`009`009`009else
  570. X`009`009`009`009`009`009writeln(objnam.idents`091here.magicobj`093,
  571. X`009`009`009`009`009`009`009' is currently the magic object for this room.')
  572. V;
  573. X`009`009`009`009`009writeln;
  574. X`009`009`009`009`009grab_line('New magic object? ',s,
  575. X`009`009`009`009`009    eof_handler := leave);
  576. X`009`009`009`009end;
  577. X`009`009`009`009if s = '' then
  578. X`009`009`009`009`009writeln('No changes.')
  579. X`009`009`009`009else if lookup_obj(n,s) then begin
  580. X`009`009`009`009`009getroom;
  581. X`009`009`009`009`009here.magicobj := n;
  582. X`009`009`009`009`009putroom;
  583. X`009`009`009`009`009writeln('Room updated.');
  584. X`009`009`009`009end else
  585. X`009`009`009`009`009writeln('No such object found.');
  586. X`009`009`009     end;
  587. X`009`009`009'g': begin
  588. X`009`009`009`009getnam;
  589. X`009`009`009`009freenam;
  590. X`009`009`009`009if param > '' then s := param
  591. X`009`009`009`009else begin
  592. X`009`009`009`009`009if here.objdrop = 0 then
  593. X`009`009`009`009`009`009writeln('Objects dropped fall here.')
  594. X`009`009`009`009`009else
  595. X`009`009`009`009`009`009writeln('Objects dropped fall in ',nam.idents`091her
  596. Ve.objdrop`093,'.');
  597. X`009`009`009`009`009writeln;
  598. X`009`009`009`009`009writeln('Enter * for `091this room`093:');
  599. X`009`009`009`009`009grab_line('Room dropped objects go to? ',
  600. X`009`009`009`009`009    s,eof_handler := leave);
  601. X`009`009`009`009end;
  602. X`009`009`009`009if s = '' then
  603. X`009`009`009`009`009writeln('No changes.')
  604. X`009`009`009`009else if s = '*' then begin
  605. X`009`009`009`009`009getroom;
  606. X`009`009`009`009`009here.objdrop := 0;
  607. X`009`009`009`009`009putroom;
  608. X`009`009`009`009`009writeln('Room updated.');
  609. X`009`009`009`009end else if lookup_room(n,s) then begin
  610. X`009`009`009`009`009getroom;
  611. X`009`009`009`009`009here.objdrop := n;
  612. X`009`009`009`009`009putroom;
  613. X`009`009`009`009`009writeln('Room updated.');
  614. X`009`009`009`009end else
  615. X`009`009`009`009`009writeln('No such room found.');
  616. X`009`009`009     end;
  617. X`009`009`009'd': begin
  618. X`009`009`009`009writeln('Print room descriptions how?');
  619. X`009`009`009`009writeln;
  620. X`009`009`009`009writeln('0)  Print primary (main) description only `091defau
  621. Vlt`093');
  622. X`009`009`009`009writeln('1)  Print only secondary description.');
  623. X`009`009`009`009writeln('2)  Print both primary and secondary descriptions t
  624. Vogether.');
  625. X`009`009`009`009writeln('3)  Print primary description first; then print sec
  626. Vondary description only if');
  627. X`009`009`009`009writeln('    the player is holding the magic object for this
  628. V room.');
  629. X`009`009`009`009writeln('4)  Print secondary if holding the magic obj; print
  630. V primary otherwise');
  631. X`009`009`009`009writeln;
  632. X`009`009`009`009grab_line('? ',s,eof_handler := leave);
  633. X`009`009`009`009if isnum(s) then begin
  634. X`009`009`009`009`009n := number(s);
  635. X`009`009`009`009`009if n in `0910..4`093 then begin
  636. X`009`009`009`009`009`009getroom;
  637. X`009`009`009`009`009`009here.which := n;
  638. X`009`009`009`009`009`009putroom;
  639. X`009`009`009`009`009`009writeln('Room updated.');
  640. X`009`009`009`009`009end else
  641. X`009`009`009`009`009`009writeln('Out of range.');
  642. X`009`009`009`009end else
  643. X`009`009`009`009`009writeln('No changes.');
  644. X
  645. X`009`009`009     end;
  646. X`009`009`009'n': begin
  647. X`009`009`009`009writeln('How would you like the room name to print?');
  648. X`009`009`009`009writeln;
  649. X`009`009`009`009writeln('0) No room name is shown');
  650. X`009`009`009`009writeln('1) "You''re in ..."');
  651. X`009`009`009`009writeln('2) "You''re at ..."');
  652. X`009`009`009`009writeln('3) "You''re in the ..."');
  653. X`009`009`009`009writeln('4) "You''re at the ..."');
  654. X`009`009`009`009writeln('5) "You''re in a ..."');
  655. X`009`009`009`009writeln('6) "You''re at a ..."');
  656. X`009`009`009`009writeln('7) "You''re in an ..."');
  657. X`009`009`009`009writeln('8) "You''re at an ..."');
  658. X`009`009`009`009writeln;
  659. X`009`009`009`009grab_line('? ',s,eof_handler := leave);
  660. X`009`009`009`009if isnum(s) then begin
  661. X`009`009`009`009`009n := number(s);
  662. X`009`009`009`009`009if n in `0910..8`093 then begin
  663. X`009`009`009`009`009`009getroom;
  664. X`009`009`009`009`009`009here.nameprint := n;
  665. X`009`009`009`009`009`009putroom;
  666. X`009`009`009`009`009end else
  667. X`009`009`009`009`009`009writeln('Out of range.');
  668. X`009`009`009`009end else
  669. X`009`009`009`009`009writeln('No changes.');
  670. X`009`009`009     end;
  671. X`009`009`009otherwise writeln('Bad command, type ? for a list');
  672. X`009`009end;
  673. X`009until done;
  674. X`009exit_label:
  675. X`009log_event(myslot,E_ROOMDONE,0,0);
  676. Xend;
  677. X
  678. X`123 custom EXIT -----------------------------------------------------------
  679. V--- `125
  680. X
  681. X`091global`093 procedure exit_default(dir, kind: integer);
  682. Xbegin
  683. X`009case kind of
  684. X`0091: writeln('There is a passage leading ',direct`091dir`093,'.');
  685. X`0092: writeln('There is a locked door leading ',direct`091dir`093,'.');
  686. X`0095:`009case dir of
  687. X`009`009`009north,south,east,west:
  688. X`009`009`009`009writeln('A note on the ',direct`091dir`093,' wall says "Your
  689. V exit here."');
  690. X`009`009`009up: writeln('A note on the ceiling says "Your exit here."');
  691. X`009`009`009down: writeln('A note on the floor says "Your exit here."');
  692. X`009`009end;
  693. X`009otherwise writeln('There is an exit: ',direct`091dir`093);
  694. X- 1094, 1102
  695. Xprocedure analyze_exit(dir: integer);
  696. Xvar
  697. X`009s: string;
  698. X
  699. Xbegin
  700. X`009writeln;
  701. X`009getnam;
  702. X`009freenam;
  703. X`009getobjnam;
  704. X`009freeobjnam;
  705. X`009with here.exits`091dir`093 do begin
  706. X`009`009s := alias;
  707. X`009`009if s = '' then
  708. X`009`009`009s := '(no alias)'
  709. X`009`009else
  710. X`009`009`009s := '(alias ' + s + ')';
  711. X`009`009if here.exits`091dir`093.reqalias then
  712. X`009`009`009s := s + ' (required)'
  713. X`009`009else
  714. X`009`009`009s := s + ' (not required)';
  715. X
  716. X`009`009if toloc <> 0 then
  717. X`009`009`009writeln('The ',direct`091dir`093,' exit ',s,' goes to ',nam.iden
  718. Vts`091toloc`093)
  719. X`009`009else
  720. X`009`009`009writeln('The ',direct`091dir`093,' exit goes nowhere.');
  721. X`009`009if hidden <> 0 then
  722. X`009`009`009writeln('Concealed.');
  723. X`009`009write('Exit type: ');
  724. X`009`009case kind of
  725. X`009`009`0090: writeln('no exit.');
  726. X`009`009`0091: writeln('Open passage.');
  727. X`009`009`0092: writeln('Door, object required to pass.');
  728. X`009`009`0093: writeln('No passage if holding object.');
  729. X`009`009`0094: writeln('Randomly fails');
  730. X`009`009`0095: writeln('Potential exit.');
  731. X`009`009`0096: writeln('Only exists while holding the required object.');
  732. X`009`009`0097: writeln('Timed exit');
  733. X`009`009end;
  734. X`009`009if objreq = 0 then
  735. X`009`009`009writeln('No required object.')
  736. X`009`009else
  737. X`009`009`009writeln('Required object is: ',objnam.idents`091objreq`093);
  738. X
  739. X`009`009writeln;
  740. X`009`009if exitdesc = DEFAULT_LINE then
  741. X`009`009`009exit_default(dir,kind)
  742. X`009`009else
  743. X`009`009`009print_line(exitdesc);
  744. X
  745. X`009`009if success = 0 then
  746. X`009`009`009writeln('(no success message)')
  747. X`009`009else
  748. X`009`009`009print_desc(success);
  749. X
  750. X`009`009if fail = DEFAULT_LINE then begin
  751. X`009`009`009if kind = 5 then
  752. X`009`009`009`009writeln('There isn'' an exit there yet.')
  753. X`009`009`009else
  754. X`009`009`009`009writeln('You can''t that.');
  755. X`009`009end else
  756. X`009`009`009print_desc(fail);
  757. X
  758. X`009`009if comeout = DEFAULT_LINE then
  759. X`009`009`009writeln('# has come into the room from ',direct`091dir`093)
  760. X`009`009else
  761. X`009`009`009print_desc(comeout);
  762. X`009`009if goin = DEFAULT_LINE then
  763. X`009`009`009writeln('# has gone ',direct`091dir`093)
  764. X`009`009else
  765. X`009`009`009print_desc(goin);
  766. X
  767. X`009`009writeln;
  768. X`009`009if autolook then
  769. X`009`009`009writeln('LOOK automatically done after exit used')
  770. X`009`009else
  771. X`009`009`009writeln('LOOK supressed on exit use');
  772. X`009`009if reqverb then
  773. X`009`009`009writeln('The alias is required to be a verb for exit use')
  774. X`009`009else
  775. X`009`009`009writeln('The exit can be used with GO or as a verb');
  776. X`009end;
  777. X`009writeln;
  778. X- 1106, 1110
  779. Xprocedure get_key(dir: integer; param: string := '');
  780. Xlabel exit_label;
  781. Xvar
  782. X`009s: string;
  783. X- 1115, 1116
  784. X`009writeln('EXIT - no changes.');
  785. X`009goto exit_label;
  786. X    end;
  787. X
  788. X
  789. Xbegin
  790. X`009getobjnam;
  791. X`009freeobjnam;
  792. X`009if param > '' then s := param
  793. X`009else begin
  794. X`009`009if here.exits`091dir`093.objreq = 0 then
  795. X`009`009`009writeln('Currently there is no key set for this exit.')
  796. X`009`009else
  797. X`009`009`009writeln(objnam.idents`091here.exits`091dir`093.objreq`093,' is t
  798. Vhe current key for this exit.');
  799. X`009`009writeln('Enter * for `091no key`093');
  800. X`009`009writeln;
  801. X`009
  802. X`009`009grab_line('What object is the door key? ',s,
  803. X`009`009    eof_handler := leave);
  804. X`009end;
  805. X`009if length(s) > 0 then begin
  806. X`009`009if s = '*' then begin
  807. X`009`009`009getroom;
  808. X`009`009`009here.exits`091dir`093.objreq := 0;
  809. X`009`009`009putroom;
  810. X`009`009`009writeln('Exit updated.');
  811. X`009`009end else if lookup_obj(n,s) then begin
  812. X`009`009`009getroom;
  813. X`009`009`009here.exits`091dir`093.objreq := n;
  814. X`009`009`009putroom;
  815. X`009`009`009writeln('Exit updated.');
  816. X`009`009end else
  817. X`009`009`009writeln('There is no object by that name.');
  818. X`009end else
  819. X`009`009writeln('No changes.');
  820. X    exit_label:
  821. Xend;
  822. X
  823. Xprocedure custom_exit(dirnam: string);
  824. Xlabel exit_label;
  825. Xvar
  826. X`009prompt: string;
  827. X`009done : boolean;
  828. X`009s,param: string;
  829. X`009dir,n: integer;
  830. X
  831. X    procedure leave;
  832. X    begin
  833. X`009writeln('EXIT - no changes.');
  834. X`009log_event(myslot,E_CUSTDONE,0,0);
  835. X`009goto exit_label;
  836. X- 1120, 1308
  837. X`009if lookup_dir(dir,dirnam) then begin
  838. X`009   if can_alter(dir) then begin
  839. X
  840. X`009`009log_action(c_custom,0);
  841. X
  842. X`009`009writeln('Customizing ',direct`091dir`093,' exit');
  843. X`009`009writeln('If you would rather be customizing this room, type CUSTOM w
  844. Vith no arguments');
  845. X`009`009writeln('If you would rather be customizing an object, type CUSTOM <
  846. Vobject name>');
  847. X`009`009writeln('If you would rather be customizing a monster, type CUSTOM <
  848. Vmonster name>');
  849. X`009`009writeln;
  850. X`009`009writeln('Type ** for any line to leave it unchanged.');
  851. X`009`009writeln('Type return for any line to select the default.');
  852. X`009`009writeln;
  853. X`009`009writev(prompt,'Custom ',direct`091dir`093,'> ');
  854. X`009`009done := false;
  855. X`009`009repeat
  856. X`009`009`009repeat
  857. X`009`009`009`009grab_line(prompt,s,eof_handler := leave);
  858. X`009`009`009`009param := slead(s);
  859. X`009`009`009`009s := bite(param);
  860. X`009`009`009until length(s) > 0;
  861. X`009`009`009s := lowcase(s);
  862. X`009`009`009case s`0911`093 of
  863. X`009`009`009`009'?','h': command_help('*custom help*');
  864. X`009`009`009`009'q','e': done := true;
  865. X`009`009`009`009'k': get_key(dir,param);
  866. X`009`009`009`009'c': begin
  867. X`009`009`009`009`009writeln('Type the description that a player will see whe
  868. Vn the exit is found.');
  869. X`009`009`009`009`009writeln('Make no text for description to unconceal the e
  870. Vxit.');
  871. X`009`009`009`009`009writeln;
  872. X`009`009`009`009`009writeln('`091 Editing the "hidden exit found" descriptio
  873. Vn `093');
  874. X`009  `009`009`009`009n := here.exits`091dir`093.hidden;
  875. X`009`009`009`009`009if edit_desc(n) then begin
  876. X`009`009`009`009`009`009getroom;
  877. X`009`009`009`009`009`009here.exits`091dir`093.hidden := n;
  878. X`009`009`009`009`009`009putroom;
  879. X`009`009`009`009`009end;
  880. X`009`009`009`009     end;
  881. X`123req alias`125`009`009`009'r': begin
  882. X`009`009`009`009`009getroom;
  883. X`009`009`009`009`009here.exits`091dir`093.reqalias :=
  884. X`009`009`009`009`009`009not(here.exits`091dir`093.reqalias);
  885. X`009`009`009`009`009putroom;
  886. X
  887. X`009`009`009`009`009if here.exits`091dir`093.reqalias then
  888. X`009`009`009`009`009`009writeln('The alias for this exit will be required to
  889. V reference it.')
  890. X`009`009`009`009`009else
  891. X`009`009`009`009`009`009writeln('The alias will not be required to reference
  892. V this exit.');
  893. X`009`009`009`009     end;
  894. X`123req verb`125`009`009`009'x': begin
  895. X`009`009`009`009`009getroom;
  896. X`009`009`009`009`009here.exits`091dir`093.reqverb :=
  897. X`009`009`009`009`009`009not(here.exits`091dir`093.reqverb);
  898. X`009`009`009`009`009putroom;
  899. X
  900. X`009`009`009`009`009if here.exits`091dir`093.reqverb then
  901. X`009`009`009`009`009`009writeln('The exit name will be required to be used a
  902. Vs a verb to use the exit')
  903. X`009`009`009`009`009else
  904. X`009`009`009`009`009`009writeln('The exit name may be used with GO or as a v
  905. Verb to use the exit');
  906. X`009`009`009`009     end;
  907. X`123autolook`125`009`009`009'l': begin
  908. X`009`009`009`009`009getroom;
  909. X`009`009`009`009`009here.exits`091dir`093.autolook :=
  910. X`009`009`009`009`009`009not(here.exits`091dir`093.autolook);
  911. X`009`009`009`009`009putroom;
  912. X
  913. X`009`009`009`009`009if here.exits`091dir`093.autolook then
  914. X`009`009`009`009`009`009writeln('A LOOK will be done after the player travel
  915. Vs through this exit.')
  916. X`009`009`009`009`009else
  917. X`009`009`009`009`009`009writeln('The automatic LOOK will not be done when a
  918. V player uses this exit.');
  919. X`009`009`009`009     end;
  920. X`009`009`009`009'a': begin
  921. X`009`009`009`009`009if param > '' then s := param
  922. X`009  `009`009`009`009else grab_line('Alternate name for the exit? ',
  923. X`009`009`009`009`009    s,eof_handler := leave);
  924. X`009`009`009`009`009if length(s) > veryshortlen then
  925. X`009`009`009`009`009`009writeln('Your alias must be less than ',veryshortlen
  926. V:1,' characters.')
  927. X`009`009`009`009`009else begin
  928. X`009`009`009`009`009`009getroom;
  929. X`009`009`009`009`009`009here.exits`091dir`093.alias := lowcase(s);
  930. X`009`009`009`009`009`009putroom;
  931. X`009`009`009`009`009end;
  932. X`009`009`009`009     end;
  933. X`009`009`009`009'v': analyze_exit(dir);
  934. X`009`009`009`009't': begin
  935. X`009`009`009`009`009writeln;
  936. X`009`009`009`009`009writeln('Select the type of your exit:');
  937. X`009`009`009`009`009writeln;
  938. X`009`009`009`009`009writeln('0) No exit');
  939. X`009`009`009`009`009writeln('1) Open passage');
  940. X`009`009`009`009`009writeln('2) Door (object required to pass)');
  941. X`009`009`009`009`009writeln('3) No passage if holding key');
  942. X`009`009`009`009`009if special_priv then `123 minor change by leino@finuha `
  943. V125
  944. X`009`009`009`009`009`009writeln('4) exit randomly fails');
  945. X`009`009`009`009`009writeln('6) Exit exists only when holding object');
  946. X`009`009`009`009`009if special_priv then `123 minor change by leino@finuha `
  947. V125
  948. X`009`009`009`009`009`009writeln('7) exit opens/closes invisibly every minute
  949. V');
  950. X`009`009`009`009`009writeln;
  951. X`009`009`009`009`009grab_line('Which type? ',s,
  952. X`009`009`009`009`009    eof_handler := leave);
  953. X`009`009`009`009`009if isnum(s) then begin
  954. X`009`009`009`009`009`009n := number(s);
  955. X`009`009`009`009`009`009if ((n in `0914,7`093) and special_priv)
  956. X`009`009`009`009`009`009or (n in `0910..3,6`093) then begin `123 minor hack
  957. V by jlaiho@finuha `125
  958. X`009`009`009`009`009`009`009getroom;
  959. X`009`009`009`009`009`009`009here.exits`091dir`093.kind := n;
  960. X`009`009`009`009`009`009`009putroom;
  961. X`009`009`009`009`009`009`009writeln('Exit type updated.');
  962. X`009`009`009`009`009`009`009writeln;
  963. X`009`009`009`009`009`009`009if n in `0912,6`093 then
  964. X`009`009`009`009`009`009`009`009get_key(dir);
  965. X`009`009`009`009`009`009end else
  966. X`009`009`009`009`009`009`009writeln('Bad exit type.');
  967. X`009`009`009`009`009end else
  968. X`009`009`009`009`009`009writeln('Exit type not changed.');
  969. X`009`009`009`009     end;
  970. X`009`009`009`009'f': begin
  971. X`009`009`009`009`009writeln('The failure description will print if the playe
  972. Vr attempts to go through the');
  973. X`009`009`009`009`009writeln('the exit but cannot for any reason.');
  974. X`009`009`009`009`009writeln;
  975. X`009  `009`009`009`009writeln('`091 Editing the exit failure description `09
  976. V3');
  977. X
  978. X`009`009`009`009`009n := here.exits`091dir`093.fail;
  979. X`009`009`009`009`009if edit_desc(n) then begin
  980. X`009`009`009`009`009`009getroom;
  981. X`009`009`009`009`009`009here.exits`091dir`093.fail := n;
  982. X`009`009`009`009`009`009putroom;
  983. X`009`009`009`009`009end;
  984. X`009`009`009`009     end;
  985. X`009`009`009`009'i': begin
  986. X`009`009`009`009`009writeln('Edit the description that other players see whe
  987. Vn someone goes into');
  988. X`009`009`009`009`009writeln('the exit.  Place a # where the player''s name s
  989. Vhould appear.');
  990. X`009`009`009`009`009writeln;
  991. X`009`009`009`009`009writeln('`091 Editing the exit "go in" description `093'
  992. V);
  993. X`009`009`009`009`009n := here.exits`091dir`093.goin;
  994. X`009`009`009`009`009if edit_desc(n) then begin
  995. X`009`009`009`009`009`009getroom;
  996. X`009`009`009`009`009`009here.exits`091dir`093.goin := n;
  997. X`009`009`009`009`009`009putroom;
  998. X`009`009`009`009`009end;
  999. X`009`009`009`009     end;
  1000. X`009`009`009`009'o': begin
  1001. X`009`009`009`009`009writeln('Edit the description that other players see whe
  1002. Vn someone comes out of');
  1003. X`009`009`009`009`009writeln('the exit.  Place a # where the player''s name s
  1004. Vhould appear.');
  1005. X`009`009`009`009`009writeln;
  1006. X`009`009`009`009`009writeln('`091 Editing the exit "come out of" description
  1007. V `093');
  1008. X`009`009`009`009`009n := here.exits`091dir`093.comeout;
  1009. X`009`009`009`009`009if edit_desc(n) then begin
  1010. X`009`009`009`009`009`009getroom;
  1011. X`009`009`009`009`009`009here.exits`091dir`093.comeout := n;
  1012. X`009`009`009`009`009`009putroom;
  1013. X`009`009`009`009`009end;
  1014. X`009`009`009`009     end;
  1015. X`123 main exit desc `125`009`009'd': begin
  1016. X`009`009`009`009`009writeln('Enter a one line description of the exit.');
  1017. X`009`009`009`009`009writeln;
  1018. X`009`009`009`009`009n := here.exits`091dir`093.exitdesc;
  1019. X`009`009`009`009`009make_line(n);
  1020. X`009`009`009`009`009getroom;
  1021. X`009`009`009`009`009here.exits`091dir`093.exitdesc := n;
  1022. X`009`009`009`009`009putroom;
  1023. X`009`009`009`009     end;
  1024. X`009`009`009`009's': begin
  1025. X`009`009`009`009`009writeln('The success description will print when the pla
  1026. Vyer goes through the exit.');
  1027. X`009`009`009`009`009writeln;
  1028. X`009`009`009`009`009writeln('`091 Editing the exit success description `093'
  1029. V);
  1030. X
  1031. X`009`009`009`009`009n := here.exits`091dir`093.success;
  1032. X`009`009`009`009`009if edit_desc(n) then begin
  1033. X`009`009`009`009`009`009getroom;
  1034. X`009`009`009`009`009`009here.exits`091dir`093.success := n;
  1035. X`009`009`009`009`009`009putroom;
  1036. X`009`009`009`009`009end;
  1037. X`009`009`009`009     end;
  1038. X`009`009`009`009otherwise writeln('-- Bad command, type ? for a list');
  1039. X`009`009`009end;
  1040. X`009`009until done;
  1041. X`009   end else
  1042. X`009`009writeln('You are not allowed to alter that exit.');
  1043. X
  1044. X`009`009log_event(myslot,E_CUSTDONE,0,0);
  1045. X`009end else writeln('Unknown direction.');
  1046. X    exit_label:
  1047. X
  1048. Xend;
  1049. X
  1050. X`091global`093 PROCEDURE do_custom(dirnam: string);
  1051. Xvar`009n: integer;
  1052. X`009t: o_type;
  1053. X`009fi,ta: string; `123 first and tail `125
  1054. Xbegin
  1055. X    gethere;
  1056. X    if checkhide then begin
  1057. X`009ta := dirnam;
  1058. X`009fi := bite(ta);
  1059. X
  1060. X`009if length(dirnam) = 0 then begin
  1061. X`009    if is_owner(location,TRUE) then
  1062. X`009`009custom_room
  1063. X`009    else begin
  1064. X`009`009writeln('You are not the owner of this room; you cannot customize it
  1065. V.');
  1066. X`009`009writeln('However, you may be able to customize some of the exits.  T
  1067. Vo customize an');
  1068. X`009`009writeln('exit, type CUSTOM <direction of exit>');
  1069. X`009    end;
  1070. X`009end else if lookup_dir(n,dirnam) then`032
  1071. X`009    custom_exit(dirnam)
  1072. X`009else if lookup_type(t,fi,pl := FALSE) then begin
  1073. X`009    case t of`032
  1074. X`009`009t_none: writeln('%Error in DO_CUSTOM. Notify Monster Manager.');
  1075. X`009`009t_room: begin
  1076. X`009`009    if ta > '' then writeln('You can only custom this room.')
  1077. X`009`009    else if is_owner(location,TRUE) then custom_room
  1078. X`009`009    else writeln('You are not the owner of this room; you cannot cus
  1079. Vtomize it.');
  1080. X`009`009end;
  1081. X`009`009t_object: do_program(ta);
  1082. X`009`009t_spell:  writeln('Use SET SPELL <spell name> to customize spell.');
  1083. X`009`009t_monster: custom_monster(ta);
  1084. X`009`009t_player: begin
  1085. X`009`009    if manager_priv then writeln('Use SYSTEM to customize player.')
  1086. X`009`009    else writeln('You can''t customize player.');
  1087. X`009`009end;
  1088. X`009    end; `123 case `125
  1089. X`009end else if lookup_obj(n,dirnam) then
  1090. X`123 if lookup_obj returns TRUE then dirnam is name of object to customize `
  1091. V125
  1092. X`009    do_program(dirnam)`009`123 customize the object `125
  1093. X        else if lookup_pers(n,dirnam) then
  1094. X`009    custom_monster(dirnam)
  1095. X`009else begin
  1096. X`009    writeln('To customize this room, type CUSTOM');
  1097. X`009    writeln('To customize an exits, type CUSTOM <direction>');
  1098. X`009    writeln('To customize an object, type CUSTOM <object name>');
  1099. X`009    writeln('To customize a monster, type CUSTOM <monster name>');
  1100. X`009end;
  1101. X`123`009clear_command;`009`125
  1102. X- 1312, 1490
  1103. X`123 custom OBJECT ---------------------------------------------------------
  1104. V---- `125
  1105. X
  1106. X
  1107. X`123 support for do_program (customize an object)
  1108. X  Give the player a list of kinds of object he's allowed to make his object
  1109. X  and update it `125
  1110. X
  1111. Xprocedure prog_kind(objnum: integer);
  1112. Xlabel exit_label;
  1113. Xvar
  1114. X`009n: integer;
  1115. X`009s: string;
  1116. X`009p: integer;
  1117. X- 1499, 1520
  1118. X`009writeln('Select the type of your object:');
  1119. X`009writeln;
  1120. X`009writeln(O_BLAND:3,`009'    Ordinary object (good for door keys)');
  1121. X`009writeln(O_WEAPON:3,`009'    Weapon');
  1122. X`009writeln(O_ARMOR:3,`009'    Armor');
  1123. X`123`009writeln(O_THRUSTER:3,`009'    Exit thruster');`009`125
  1124. X`009writeln(O_DISGUISE:3,`009'    Disguise');
  1125. X`009writeln(O_BOOK:3,       '    Magic book.');
  1126. X             `032
  1127. X`009writeln(O_TRAP:3,`009'    Trap (bites if player fails to get it)'); `123
  1128. V O_TRAP `125
  1129. X`009if special_priv then begin `123 minor change by leino@finuha `125
  1130. X`009`009writeln;
  1131. X`123`009`009writeln(O_BAG:3,`009'    Bag');`009`125
  1132. X`009`009writeln(O_CRYSTAL:3,`009'    Crystal Ball');
  1133. X`123`009`009writeln(O_WAND:3,`009'    Wand of Power');`009`125
  1134. X`123`009`009writeln(O_HAND:3,`009'    Hand of Glory');`009`125
  1135. X`009`009writeln(O_TELEPORT_RING:3,'    Teleport Ring');
  1136. X`009`009writeln(O_HEALTH_RING:3,'    Health Ring');
  1137. X`009end;
  1138. X`009writeln;
  1139. X`009if wizard and special_priv then begin
  1140. X`009`009writeln(O_MAGIC_RING:3,`009'    Magic Ring');
  1141. X`009`009writeln;
  1142. X`009end;
  1143. X
  1144. X`009grab_line('Which kind? ',s,eof_handler := leave);
  1145. X
  1146. X`009if isnum(s) then begin
  1147. X`009`009n := number(s);
  1148. X`009`009if (n >= 100) and (not special_priv)`032
  1149. X`009`009`009or (n >= 200) and (not wizard) then
  1150. X`009`009`009writeln('Out of range.')
  1151. X`009`009else if n in `091O_BLAND,O_WEAPON,O_ARMOR,
  1152. X`009`009`009O_DISGUISE,O_CRYSTAL,O_MAGIC_RING,
  1153. X`009`009`009O_TELEPORT_RING,O_HEALTH_RING,
  1154. X`009`009`009O_BOOK, O_TRAP`093 then begin
  1155. X`009`009`009getobj(objnum);
  1156. X`009`009`009`123 clear parms `125
  1157. X`009`009`009for p := 1 to maxparm do obj.parms`091p`093 := 0;
  1158. X                        obj.kind := n;
  1159. X`009`009`009putobj;        `032
  1160. X         `032
  1161. X                        writeln('Object updated.');
  1162. X`009`009end else
  1163. X`009`009`009writeln('Out of range.');
  1164. X- 1524, 1545
  1165. X     `032
  1166. X
  1167. X`123 support for do_program (customize an object)
  1168. X  Based on the kind it is allow the
  1169. X  user to set the various parameters for the effects associated with that
  1170. X  kind `125
  1171. X
  1172. XProcedure program_weapon (objnum: integer);
  1173. Xlabel exit_label;
  1174. XVar attack_power: Integer;
  1175. X    required_experience: Integer;
  1176. X    n,top,lev: integer;
  1177. X    s: string;
  1178. X- 1554, 1688
  1179. X`123 getobj (objnum);
  1180. X   freeobj;  `125   `123 prog_obj do this already `125
  1181. X
  1182. X   writeln ('Use 3 to edit failure attack message');
  1183. X   writeln ('Use 4 to edit attack success message');
  1184. X   writeln ('Use x to edit attack success message, what victim sees.');
  1185. X   writeln ('Use 5 to edit attack success message, what others see.');
  1186. X   writeln;
  1187. X
  1188. X   attack_power := obj.ap;
  1189. X   required_experience := obj.exreq;
  1190. X   lev := level(myexperience);
  1191. X   top := leveltable`091lev`093.maxpower;
  1192. X
  1193. X   writeln ('Select attack power of this weapon: 0 - ',top:1);
  1194. X   writeln ('Current attack power is ',attack_power:1);
  1195. X   grab_line ('Power? ',s,eof_handler := leave);
  1196. X   if isnum (s) then begin
  1197. X     n := number (s);
  1198. X     if (n >= 0) and (n <=top) then`032
  1199. X       begin
  1200. X         attack_power := n;`032
  1201. X         getobj (objnum);
  1202. X         obj.ap := attack_power;
  1203. X         putobj;
  1204. X         writeln ('Updated.');
  1205. X
  1206. X       end
  1207. X     else writeln ('Out of range.'); `032
  1208. X   end else writeln('No such power.');
  1209. X   writeln;
  1210. X
  1211. X   writeln ('Select required experience to use this weapon: 0 - ',
  1212. X      maxexperience:1);
  1213. X   writeln ('Current required experience is ',required_experience:1);
  1214. X   grab_line ('Experience? ',s,eof_handler := leave);
  1215. X   if isnum (s) then begin
  1216. X     n := number (s);
  1217. X     if (n >=0) and (n <= maxexperience) then
  1218. X       begin
  1219. X         required_experience := n;
  1220. X         getobj (objnum);
  1221. X         obj.exreq := required_experience;
  1222. X         putobj;
  1223. X         writeln ('Updated.');
  1224. X       end else writeln ('Out of range.');
  1225. X   end else writeln ('No such experience.');
  1226. X   writeln;
  1227. X
  1228. X    exit_label:
  1229. X
  1230. Xend;                                `032
  1231. X
  1232. XProcedure program_book (objnum: integer);
  1233. Xlabel exit_label;
  1234. XVar spell: Integer;
  1235. X    required_experience: Integer;
  1236. X    n: integer;
  1237. X    s: string;
  1238. X- 1696, 2050
  1239. Xbegin
  1240. X`123 getobj (objnum);
  1241. X   freeobj;  `125   `123 prog_obj do this already `125
  1242. X
  1243. X   spell := obj.parms`091OP_SPELL`093;
  1244. X   required_experience := obj.exreq;
  1245. X   getspell_name;
  1246. X   freespell_name;
  1247. X
  1248. X
  1249. X   writeln ('Select spell for this magic book.');
  1250. X
  1251. X   if spell > 0 then`032
  1252. X      writeln ('Current spell is ',spell_name.idents`091spell`093)
  1253. X   else writeln('Current spell is <none>');
  1254. X   grab_line ('Spell? ',s,eof_handler := leave);
  1255. X   if lookup_spell(n,s) then begin
  1256. X       if is_spell_owner(n,public_ok := true) then
  1257. X       begin
  1258. X         spell := n;`032
  1259. X         getobj (objnum);
  1260. X         obj.parms`091OP_SPELL`093 := spell;
  1261. X         putobj;
  1262. X         writeln ('Updated.');
  1263. X       end
  1264. X     else writeln ('You aren''t owner of this spell.'); `032
  1265. X   end else writeln('No such spell.');
  1266. X   writeln;
  1267. X
  1268. X   writeln ('Select required experience to use this magic book: 0 - ',
  1269. X      maxexperience:1);
  1270. X   writeln ('Current required experience is ',required_experience:1);
  1271. X   grab_line ('Experience? ',s,eof_handler := leave);
  1272. X   if isnum (s) then begin
  1273. X     n := number (s);
  1274. X     if (n >=0) and (n <= maxexperience) then
  1275. X       begin
  1276. X         required_experience := n;
  1277. X         getobj (objnum);
  1278. X         obj.exreq := required_experience;
  1279. +-+-+-+-+-+-+-+-  END  OF PART 2 +-+-+-+-+-+-+-+-
  1280.