home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #7 / amigamamagazinepolishissue1998.iso / rozrywka / rpg / amigamud / src / scenario / streets.m < prev    next >
Text File  |  1997-07-05  |  29KB  |  828 lines

  1. /*
  2.  * Amiga MUD
  3.  *
  4.  * Copyright (c) 1997 by Chris Gray
  5.  */
  6.  
  7. /*
  8.  * streets.m - define the outside streets in the starter dungeon.
  9.  */
  10.  
  11. private tp_streets CreateTable()$
  12. use tp_streets
  13.  
  14. define tp_streets STREETS_ID NextEffectId()$
  15.  
  16. define tp_streets proc drawStreets()void:
  17.  
  18.     if not KnowsEffect(nil, STREETS_ID) then
  19.     DefineEffect(nil, STREETS_ID);
  20.     GSetImage(nil, "Town/streets");
  21.     IfFound(nil);
  22.         ShowCurrentImage();
  23.     Else(nil);
  24.         GSetPen(nil, C_DARK_GREY);
  25.         GAMove(nil, 0.0, 0.0);
  26.         GRectangle(nil, 0.4995, 1.0, true);
  27.  
  28.         GSetPen(nil, C_LIGHT_GREY);
  29.         GAMove(nil, 0.0, 0.0);
  30.         GRectangle(nil, 0.217, 0.415, true);
  31.         GAMove(nil, 0.277, 0.0);
  32.         GRectangle(nil, 0.2235, 0.415, true);
  33.         GAMove(nil, 0.0, 0.57);
  34.         GRectangle(nil, 0.217, 0.44, true);
  35.         GAMove(nil, 0.277, 0.57);
  36.         GRectangle(nil, 0.2235, 0.44, true);
  37.  
  38.         GSetPen(nil, C_DARK_BROWN);
  39.         GAMove(nil, 0.0, 0.0);
  40.         GRectangle(nil, 0.193, 0.35, true);
  41.         GAMove(nil, 0.3, 0.0);
  42.         GRectangle(nil, 0.202, 0.35, true);
  43.         GAMove(nil, 0.0, 0.63);
  44.         GRectangle(nil, 0.193, 0.38, true);
  45.  
  46.         GSetPen(nil, C_WHITE);
  47.         GAMove(nil, 0.246, 0.0);
  48.         GADraw(nil, 0.246, 0.35);
  49.         GAMove(nil, 0.0, 0.49);
  50.         GADraw(nil, 0.194, 0.49);
  51.         GAMove(nil, 0.303, 0.49);
  52.         GADraw(nil, 0.499, 0.49);
  53.         GAMove(nil, 0.246, 0.63);
  54.         GADraw(nil, 0.246, 0.997);
  55.  
  56.         GSetPen(nil, C_BLACK);
  57.         GAMove(nil, 0.193, 0.13);
  58.         VerticalDoor();
  59.         GAMove(nil, 0.3, 0.01);
  60.         VerticalDoor();
  61.         GAMove(nil, 0.3, 0.13);
  62.         VerticalDoor();
  63.         GAMove(nil, 0.3, 0.245);
  64.         VerticalDoor();
  65.         GAMove(nil, 0.31562, 0.35);
  66.         HorizontalDoor();
  67.         GAMove(nil, 0.38125, 0.35);
  68.         HorizontalDoor();
  69.         GAMove(nil, 0.44687, 0.35);
  70.         HorizontalDoor();
  71.         GAMove(nil, 0.193, 0.65);
  72.         VerticalDoor();
  73.         GAMove(nil, 0.193, 0.77);
  74.         VerticalDoor();
  75.         GAMove(nil, 0.193, 0.89);
  76.         VerticalDoor();
  77.         GAMove(nil, 0.01563, 0.63);
  78.         HorizontalDoor();
  79.         GAMove(nil, 0.08124, 0.63);
  80.         HorizontalDoor();
  81.         GAMove(nil, 0.14687, 0.63);
  82.         HorizontalDoor();
  83.  
  84.         GAMove(nil, 0.085, 0.35);
  85.         GADraw(nil, 0.106, 0.35);
  86.  
  87.         GSetPen(nil, C_LIGHT_GREEN);
  88.         GAMove(nil, 0.3, 0.64);
  89.         GRectangle(nil, 0.18, 0.3, true);
  90.         GSetPen(nil, C_LIGHT_GREY);
  91.         GAMove(nil, 0.378, 0.63);
  92.         GRectangle(nil, 0.0155, 0.36, true);
  93.         GAMove(nil, 0.345, 0.69);
  94.         GRectangle(nil, 0.079, 0.19, true);
  95.         GSetPen(nil, C_BLUE);
  96.         GAMove(nil, 0.36875, 0.74);
  97.         GRectangle(nil, 0.03437, 0.09, true);
  98.         GSetPen(nil, C_GOLD);
  99.         GAMove(nil, 0.38437, 0.78);
  100.         GEllipse(nil, 0.01, 0.02, true);
  101.  
  102.         GSetPen(nil, C_DARK_BROWN);
  103.         GAMove(nil, 0.32, 0.72);
  104.         GRectangle(nil, 0.025, 0.13, true);
  105.         GAMove(nil, 0.425, 0.72);
  106.         GRectangle(nil, 0.025, 0.13, true);
  107.         GSetPen(nil, C_BLACK);
  108.         GAMove(nil, 0.3437, 0.74);
  109.         VerticalDoor();
  110.         GAMove(nil, 0.425, 0.74);
  111.         VerticalDoor();
  112.  
  113.         GSetPen(nil, C_FOREST_GREEN);
  114.         GAMove(nil, 0.3125, 0.67);
  115.         GCircle(nil, 0.01563, true);
  116.         GAMove(nil, 0.42188, 0.67);
  117.         GCircle(nil, 0.0125, true);
  118.         GAMove(nil, 0.45313, 0.68);
  119.         GCircle(nil, 0.01563, true);
  120.         GAMove(nil, 0.35625, 0.91);
  121.         GCircle(nil, 0.00937, true);
  122.         GAMove(nil, 0.33437, 0.9);
  123.         GCircle(nil, 0.00937, true);
  124.         GAMove(nil, 0.30938, 0.91);
  125.         GCircle(nil, 0.00937, true);
  126.         GAMove(nil, 0.46563, 0.8);
  127.         GCircle(nil, 0.00937, true);
  128.         GAMove(nil, 0.4625, 0.87);
  129.         GCircle(nil, 0.00937, true);
  130.         GAMove(nil, 0.44375, 0.91);
  131.         GCircle(nil, 0.00937, true);
  132.         GAMove(nil, 0.41562, 0.9);
  133.         GCircle(nil, 0.00937, true);
  134.     Fi(nil);
  135.     EndEffect();
  136.     fi;
  137.     CallEffect(nil, STREETS_ID);
  138. corp;
  139.  
  140. define tp_streets STREETS_MAP_GROUP NextMapGroup()$
  141.  
  142. define tp_streets proc streetPos(thing room; fixed x, y)void:
  143.  
  144.     RoomGraphics(room, "Street", "", STREETS_MAP_GROUP, x, y, drawStreets);
  145. corp;
  146.  
  147. define tp_streets proc makeStreet(thing parent; fixed x, y)thing:
  148.     thing newStreet;
  149.  
  150.     newStreet := CreateThing(parent);
  151.     newStreet@p_rContents := CreateThingList();
  152.     SetThingStatus(newStreet, ts_readonly);
  153.     streetPos(newStreet, x, y);
  154.     newStreet
  155. corp;
  156.  
  157. define tp_streets proc makeStreetP(thing parent; fixed x, y)thing:
  158.     thing newStreet;
  159.  
  160.     newStreet := CreateThing(parent);
  161.     newStreet@p_rContents := CreateThingList();
  162.     SetThingStatus(newStreet, ts_public);
  163.     streetPos(newStreet, x, y);
  164.     newStreet
  165. corp;
  166.  
  167. define tp_streets BIRDS_SING_ID NextSoundEffectId()$
  168.  
  169. define tp_streets proc birdsSingOnce(thing client)void:
  170.     if SOn(client) then
  171.     SPlaySound(client, "birds2", 1, BIRDS_SING_ID);
  172.     IfFound(client);
  173.     Else(client);
  174.         FailText(client, "Some birds sing.");
  175.     Fi(client);
  176.     else
  177.     SPrint(client, "Some birds sing.\n");
  178.     fi;
  179. corp;
  180.  
  181. define tp_streets proc parkBirds()status:
  182.     if Random(5) = 0 then
  183.     ForEachAgent(Here(), birdsSingOnce);
  184.     birdsSingOnce(Me());
  185.     fi;
  186.     continue
  187. corp;
  188.  
  189. define tp_streets proc makePark(string name, desc; fixed x, y)thing:
  190.     thing newPark;
  191.  
  192.     newPark := CreateThing(r_park);
  193.     newPark@p_rName := name;
  194.     if desc ~= "" then
  195.     newPark@p_rDesc := desc;
  196.     fi;
  197.     newPark@p_rContents := CreateThingList();
  198.     SetThingStatus(newPark, ts_readonly);
  199.     RoomGraphics(newPark, "Park", "", STREETS_MAP_GROUP, x, y, drawStreets);
  200.     AddAnyEnterChecker(newPark, parkBirds, false);
  201.     newPark
  202. corp;
  203.  
  204. define tp_streets proc makeParkP(string name, desc; fixed x, y)thing:
  205.     thing newPark;
  206.  
  207.     newPark := CreateThing(r_park);
  208.     newPark@p_rName := name;
  209.     if desc ~= "" then
  210.     newPark@p_rDesc := desc;
  211.     fi;
  212.     newPark@p_rContents := CreateThingList();
  213.     SetThingStatus(newPark, ts_public);
  214.     RoomGraphics(newPark, "Park", "", STREETS_MAP_GROUP, x, y, drawStreets);
  215.     AddAnyEnterChecker(newPark, parkBirds, false);
  216.     newPark
  217. corp;
  218.  
  219. define tp_streets proc makeDingy(string name, desc; fixed x, y)thing:
  220.     thing newDingy;
  221.  
  222.     newDingy := CreateThing(r_park);
  223.     newDingy@p_rName := name;
  224.     if desc ~= "" then
  225.     newDingy@p_rDesc := desc;
  226.     fi;
  227.     newDingy@p_rContents := CreateThingList();
  228.     SetThingStatus(newDingy, ts_public);
  229.     RoomGraphics(newDingy, "Dingy", "Sidewalk", STREETS_MAP_GROUP, x, y,
  230.          drawStreets);
  231.     newDingy
  232. corp;
  233.  
  234. define tp_streets r_crossNE CreateThing(r_sidewalk)$
  235. SetupRoom(r_crossNE, "on the north-east corner of the main intersection",
  236.     "Handy sidewalks head north and east, and you can cross the streets "
  237.     "to the south and west.")$
  238. streetPos(r_crossNE, 0.2875, 0.38)$
  239.  
  240. define tp_streets r_crossNW CreateThing(r_sidewalk)$
  241. SetupRoom(r_crossNW, "on the north-west corner of the main intersection",
  242.     "Handy sidewalks head north and west, and you can cross the streets "
  243.     "to the south and east.")$
  244. streetPos(r_crossNW, 0.20624, 0.38)$
  245.  
  246. define tp_streets r_crossSE CreateThing(r_sidewalk)$
  247. SetupRoom(r_crossSE, "on the south-east corner of the main intersection",
  248.     "Handy sidewalks head south and east alongside the park, and you can "
  249.     "cross the streets to the north and west.")$
  250. streetPos(r_crossSE, 0.2875, 0.6)$
  251.  
  252. /* put r_crossSW in tp_misc, since is needed in machines.m */
  253. define tp_misc r_crossSW CreateThing(r_sidewalk)$
  254. SetupRoom(r_crossSW, "on the south-west corner of the main intersection",
  255.     "Handy sidewalks head south and west, and you can cross the streets "
  256.     "to the north and east.")$
  257. streetPos(r_crossSW, 0.20624, 0.6)$
  258.  
  259. Connect(r_crossNE, r_crossNW, D_WEST)$
  260. Connect(r_crossNE, r_crossSE, D_SOUTH)$
  261. Connect(r_crossSW, r_crossSE, D_EAST)$
  262. Connect(r_crossSW, r_crossNW, D_NORTH)$
  263.  
  264. define tp_streets r_nw CreateThing(r_sidewalk)$
  265. SetThingStatus(r_nw, ts_readonly)$
  266. r_nw@p_rName := "on the west sidewalk, north of the main intersection"$
  267. define tp_streets r_nw1 makeStreet(r_nw, 0.20624, 0.29)$
  268. Connect(r_crossNW, r_nw1, D_NORTH)$
  269. define tp_streets r_nw2 makeStreet(r_nw, 0.20624, 0.17)$
  270. Connect(r_nw1, r_nw2, D_NORTH)$
  271. define tp_streets r_nw3 makeStreet(r_nw, 0.20624, 0.05)$
  272. r_nw3@p_rDesc := "You can cross the street to the east."$
  273. Connect(r_nw2, r_nw3, D_NORTH)$
  274. define tp_streets r_ne CreateThing(r_sidewalk)$
  275. SetThingStatus(r_ne, ts_readonly)$
  276. r_ne@p_rName := "on the east sidewalk, north of the main intersection"$
  277. define t_streets r_ne1 makeStreetP(r_ne, 0.2875, 0.29)$
  278. Connect(r_crossNE, r_ne1, D_NORTH)$
  279. define t_streets r_ne2 makeStreetP(r_ne, 0.2875, 0.17)$
  280. Connect(r_ne1, r_ne2, D_NORTH)$
  281. define t_streets r_ne3 makeStreetP(r_ne, 0.2875, 0.05)$
  282. r_ne3@p_rDesc := "You can cross the street to the west."$
  283. Connect(r_ne2, r_ne3, D_NORTH)$
  284. Connect(r_nw3, r_ne3, D_EAST)$
  285.  
  286. define tp_streets r_en CreateThing(r_sidewalk)$
  287. SetThingStatus(r_en, ts_readonly)$
  288. r_en@p_rName := "on the north sidewalk, east of the main intersection"$
  289. define t_streets r_en1 makeStreetP(r_en, 0.33124, 0.38)$
  290. Connect(r_crossNE, r_en1, D_EAST)$
  291. define t_streets r_en2 makeStreetP(r_en, 0.39687, 0.38)$
  292. Connect(r_en1, r_en2, D_EAST)$
  293. define t_streets r_en3 makeStreetP(r_en, 0.4625, 0.38)$
  294. Connect(r_en2, r_en3, D_EAST)$
  295. r_en3@p_rDesc := "You can cross the street to the south."$
  296. define tp_streets r_es CreateThing(r_sidewalk)$
  297. SetThingStatus(r_es, ts_readonly)$
  298. r_es@p_rName := "on the south sidewalk, east of the main intersection"$
  299. r_es@p_rDesc := "The rail fence around the park is to your south."$
  300. Scenery(r_es, "fence;rail.railing,rail")$
  301. define tp_streets r_es1 makeStreet(r_es, 0.33437, 0.6)$
  302. Connect(r_crossSE, r_es1, D_EAST)$
  303. /* put r_es2 in tp_misc, since it is needed in machine.m */
  304. define tp_misc r_es2 makeStreet(r_es, 0.383, 0.6)$
  305. r_es2@p_rDesc := "The north park entrance is to your south."$
  306. Connect(r_es1, r_es2, D_EAST)$
  307. define tp_streets r_es3 makeStreet(r_es, 0.43438, 0.6)$
  308. Connect(r_es2, r_es3, D_EAST)$
  309. define t_streets r_es4 makeStreetP(r_es, 0.488, 0.6)$
  310. r_es4@p_rDesc :=
  311.     "You can cross the street to the north or go south alongside the park."$
  312. Connect(r_es3, r_es4, D_EAST)$
  313. Connect(r_en3, r_es4, D_SOUTH)$
  314.  
  315. define tp_streets r_wn CreateThing(r_sidewalk)$
  316. SetThingStatus(r_wn, ts_readonly)$
  317. r_wn@p_rName := "on the north sidewalk, west of the main intersection"$
  318. define tp_streets r_wn1 makeStreet(r_wn, 0.1625, 0.38)$
  319. Connect(r_crossNW, r_wn1, D_WEST)$
  320. define t_streets r_wn2 makeStreet(r_wn, 0.09687, 0.38)$
  321. Connect(r_wn1, r_wn2, D_WEST)$
  322. define t_streets r_wn3 makeStreet(r_wn, 0.03125, 0.38)$
  323. r_wn3@p_rDesc := "You can cross the street to the south."$
  324. Connect(r_wn2, r_wn3, D_WEST)$
  325. define tp_streets r_ws CreateThing(r_sidewalk)$
  326. SetThingStatus(r_ws, ts_readonly)$
  327. r_ws@p_rName := "on the south sidewalk, west of the main intersection"$
  328. define t_streets r_ws1 makeStreetP(r_ws, 0.1625, 0.6)$
  329. Connect(r_crossSW, r_ws1, D_WEST)$
  330. define t_streets r_ws2 makeStreetP(r_ws, 0.09687, 0.6)$
  331. Connect(r_ws1, r_ws2, D_WEST)$
  332. define t_streets r_ws3 makeStreetP(r_ws, 0.03125, 0.6)$
  333. r_ws3@p_rDesc := "You can cross the street to the north."$
  334. Connect(r_ws2, r_ws3, D_WEST)$
  335. Connect(r_wn3, r_ws3, D_SOUTH)$
  336.  
  337. define tp_streets r_sw CreateThing(r_sidewalk)$
  338. SetThingStatus(r_sw, ts_readonly)$
  339. r_sw@p_rName := "on the west sidewalk, south of the main intersection"$
  340. define tp_streets r_sw1 makeStreetP(r_sw, 0.20624, 0.69)$
  341. Connect(r_crossSW, r_sw1, D_SOUTH)$
  342. /* r_sw2 is in tp_misc, since it is needed in bguild.m */
  343. define tp_misc r_sw2 makeStreet(r_sw, 0.20624, 0.81)$
  344. Connect(r_sw1, r_sw2, D_SOUTH)$
  345. define t_streets r_sw3 makeStreetP(r_sw, 0.20624, 0.93)$
  346. r_sw3@p_rDesc := "You can cross the street to the east."$
  347. Connect(r_sw2, r_sw3, D_SOUTH)$
  348. define tp_streets r_se CreateThing(r_sidewalk)$
  349. SetThingStatus(r_se, ts_readonly)$
  350. r_se@p_rName := "on the east sidewalk, south of the main intersection"$
  351. r_se@p_rDesc := "The rail fence around the park is to your east."$
  352. Scenery(r_se, "fence;rail.railing,rail")$
  353. define tp_streets r_se1 makeStreet(r_se, 0.2875, 0.78)$
  354. Connect(r_crossSE, r_se1, D_SOUTH)$
  355. define t_streets r_se2 makeStreetP(r_se, 0.2875, 0.97)$
  356. r_se2@p_rDesc :=
  357.     "You can cross the street to the west or go east alongside the park."$
  358. Connect(r_se1, r_se2, D_SOUTH)$
  359. Connect(r_sw3, r_se2, D_EAST)$
  360.  
  361. /* The park: */
  362.  
  363. define tp_streets FOUNTAIN_SOUND_ID NextSoundEffectId()$
  364. define tp_streets proc doStartFountainSound()void:
  365.     if SOn(nil) then
  366.     SVolume(nil, 4000);
  367.     SPlaySound(nil, "stream", 0, FOUNTAIN_SOUND_ID);
  368.     SVolume(nil, 10000);
  369.     fi;
  370. corp;
  371. define tp_streets proc startFountainSound()status:
  372.     if Character(Me()@p_pName) ~= nil then
  373.     if FindElement(Me()@p_pEnterActions, doStartFountainSound) = -1 then
  374.         /* Check is just paranoia - poofing may mess things up. */
  375.         AddTail(Me()@p_pEnterActions, doStartFountainSound);
  376.     fi;
  377.     doStartFountainSound();
  378.     fi;
  379.     continue
  380. corp;
  381. define tp_streets proc stopFountainSound()status:
  382.     if Character(Me()@p_pName) ~= nil then
  383.     if SOn(nil) then
  384.         AbortEffect(nil, EFFECT_SOUND, FOUNTAIN_SOUND_ID);
  385.     fi;
  386.     DelElement(Me()@p_pEnterActions, doStartFountainSound);
  387.     fi;
  388.     continue
  389. corp;
  390. define tp_streets r_parkNorth makePark("at the north entrance to the park",
  391.     "The street is to the north and park walks head east and west. Directly "
  392.     "south of you is the park's central fountain.", 0.383, 0.705)$
  393. Connect(r_es2, r_parkNorth, D_SOUTH)$
  394. AddSouthChecker(r_es2, startFountainSound, false)$
  395. AddNorthChecker(r_parkNorth, stopFountainSound, false)$
  396. define tp_streets o_fountainWater CreateThing(nil)$
  397. FakeObject(o_fountainWater, r_parkNorth,
  398.     "water;central,fountain.fountain;water,in,from,the.mermaid;ugly,bronze",
  399.     "The fountain is a square hole in the sidewalk, filled with water. An "
  400.     "ugly bronze mermaid dribbles water into it. The water has a slightly "
  401.     "greenish tinge, and smells of too much chlorine.")$
  402. o_fountainWater@p_oEatString :=
  403.     "Drink the water from that fountain? Ick! No way!"$
  404. o_fountainWater@p_oTouchString :=
  405.     "You can't reach the bronze mermaid, "
  406.     "and the water is merely tepid and wet."$
  407. o_fountainWater@p_oSmellString := "You can smell the acrid tang of chlorine."$
  408. o_fountainWater@p_oListenString := "You can hear the fountain splashing."$
  409. define tp_streets r_parkNorthEast makePark(
  410.     "at the northeast corner of the park walk", "", 0.41, 0.715)$
  411. Connect(r_parkNorth, r_parkNorthEast, D_EAST)$
  412. AddTail(r_parkNorthEast@p_rContents, o_fountainWater)$
  413. define tp_streets r_parkNorthWest makePark(
  414.     "at the northwest corner of the park walk", "", 0.356, 0.715)$
  415. Connect(r_parkNorth, r_parkNorthWest, D_WEST)$
  416. AddTail(r_parkNorthWest@p_rContents, o_fountainWater)$
  417. define tp_streets r_parkEast makeParkP("east of the fountain", "",
  418.     0.412, 0.7775)$
  419. Connect(r_parkNorthEast, r_parkEast, D_SOUTH)$
  420. AddTail(r_parkEast@p_rContents, o_fountainWater)$
  421. define tp_streets r_parkWest makeParkP("west of the fountain", "",
  422.     0.356, 0.7775)$
  423. Connect(r_parkNorthWest, r_parkWest, D_SOUTH)$
  424. AddTail(r_parkWest@p_rContents, o_fountainWater)$
  425. define tp_streets r_parkSouthEast makePark(
  426.     "at the southeast corner of the park walk", "", 0.41, 0.85)$
  427. Connect(r_parkEast, r_parkSouthEast, D_SOUTH)$
  428. AddTail(r_parkSouthEast@p_rContents, o_fountainWater)$
  429. define tp_streets r_parkSouthWest makePark(
  430.     "at the southwest corner of the park walk", "", 0.356, 0.85)$
  431. Connect(r_parkWest, r_parkSouthWest, D_SOUTH)$
  432. AddTail(r_parkSouthWest@p_rContents, o_fountainWater)$
  433. define tp_streets r_parkSouth makePark("at the south entrance to the park",
  434.     "A dingy sidewalk is to the south and park walks head east and west. "
  435.     "Directly north of you is the park's central fountain.", 0.383, 0.85)$
  436. Connect(r_parkSouthEast, r_parkSouth, D_WEST)$
  437. Connect(r_parkSouthWest, r_parkSouth, D_EAST)$
  438. AddTail(r_parkSouth@p_rContents, o_fountainWater)$
  439. AddSouthChecker(r_parkSouth, stopFountainSound, false)$
  440. define t_streets r_dingySouth makeDingy(
  441.     "on a dingy east-west sidewalk",
  442.     "The south park entrance is to your north", 0.383, 0.97)$
  443. Connect(r_se2, r_dingySouth, D_EAST)$
  444. Connect(r_parkSouth, r_dingySouth, D_SOUTH)$
  445. AddNorthChecker(r_dingySouth, startFountainSound, false)$
  446. define t_streets r_dingyCorner makeDingy(
  447.     "on a corner of dingy sidewalks",
  448.     "You can go north or west, both alongside the fenced-off park.",
  449.     0.488, 0.97)$
  450. Connect(r_dingySouth, r_dingyCorner, D_EAST)$
  451. Scenery(r_dingySouth, "park,fence,railing,rail;rail,fenced,off,fenced-off")$
  452. define t_streets r_dingyEast makeDingy(
  453.     "on a dingy north-south sidewalk east of the park", "", 0.488, 0.79)$
  454. Connect(r_dingyCorner, r_dingyEast, D_NORTH)$
  455. Connect(r_es4, r_dingyEast, D_SOUTH)$
  456.  
  457. /* connect the street to the minimall */
  458.  
  459. ExtendDesc(r_nw2,
  460.     "A passageway heads to the west. The walls and floor of the passageway "
  461.     "are of brown tile, with a simple pattern of white tiles thrown in. The "
  462.     "ceiling of the passageway is painted concrete, and fluorescent "
  463.     "striplights (half of which don't work at all) cast intermittant light on "
  464.     "the rubbish-strewn floor.")$
  465. r_nw2@p_rWestDesc :=
  466.     "The passageway is fairly large, and is poorly lit. It is obviously well "
  467.     "used however. It is fairly long, but you can see a large open area at "
  468.     "the far end."$
  469. r_nw2@p_rWestMessage := "You head into the gloom of the passageway."$
  470. r_nw2@p_rWestOMessage := "heads into the passageway."$
  471. r_nw2@p_rWestEMessage := "comes out of the passageway."$
  472. r_nw2@p_rEnterDesc :=
  473.     "The passageway is fairly large, and is poorly lit. It is obviously well "
  474.     "used however. It is fairly long, but you can see a large open area at "
  475.     "the far end."$
  476. r_nw2@p_rEnterMessage := "You head into the gloom of the passageway."$
  477. r_nw2@p_rEnterOMessage := "heads into the passageway."$
  478. Connect(r_nw2, r_mallEntrance, D_WEST)$
  479. Connect(r_nw2, r_mallEntrance, D_ENTER)$
  480. Scenery(r_nw2,
  481.     "passageway,passage,floor,wall,ceiling;rubbish,strewn,rubbish-strewn."
  482.     "tile;brown,white,patterned."
  483.     "pattern;simple."
  484.     "concrete,painted."
  485.     "light,striplight;strip,fluorescent."
  486.     "rubbish")$
  487.  
  488. /* Connect Questor's office to r_ws2 */
  489.  
  490. SetupQuestorOffice(r_ws2, D_SOUTH)$
  491.  
  492. /* Build a ring road around the town. */
  493. /* I deliberately did not inherit from anything other than 'r_road' here,
  494.    to make it easier for others to modify the roads. */
  495.  
  496. define tp_streets TOWN_ROAD_NORTH_ID NextEffectId()$
  497. define tp_streets proc drawRoadNorth()void:
  498.  
  499.     if not KnowsEffect(nil, TOWN_ROAD_NORTH_ID) then
  500.     DefineEffect(nil, TOWN_ROAD_NORTH_ID);
  501.     GSetImage(nil, "Town/roadNorth");
  502.     IfFound(nil);
  503.         ShowCurrentImage();
  504.     Else(nil);
  505.         GSetPen(nil, C_DARK_GREEN);
  506.         GAMove(nil, 0.0, 0.0);
  507.         GRectangle(nil, 0.5, 1.0, true);
  508.         GSetPen(nil, C_TAN);
  509.         GAMove(nil, 0.0, 0.38);
  510.         GRectangle(nil, 0.5, 0.24, true);
  511.         GAMove(nil, 0.20313, 0.5);
  512.         GRectangle(nil, 0.09375, 0.499, true);
  513.         GAMove(nil, 0.23438, 0.0);
  514.         GRectangle(nil, 0.03125, 0.5, true);
  515.     Fi(nil);
  516.     EndEffect();
  517.     fi;
  518.     CallEffect(nil, TOWN_ROAD_NORTH_ID);
  519. corp;
  520. define tp_streets r_roadNorth CreateThing(r_road)$
  521. SetupRoomP(r_roadNorth, "at a junction",
  522.     "The town is to the south. A pathway leads to the north.")$
  523. Connect(r_ne3, r_roadNorth, D_NORTH)$
  524. UniConnect(r_nw3, r_roadNorth, D_NORTH)$
  525. Scenery(r_roadNorth, "path.pathway")$
  526. AutoGraphics(r_roadNorth, drawRoadNorth)$
  527.  
  528. define t_streets r_roadNorthEast CreateThing(r_road)$
  529. SetupRoomP(r_roadNorthEast, "at a corner in the road", "")$
  530. Connect(r_roadNorth, r_roadNorthEast, D_EAST)$
  531. AutoGraphics(r_roadNorthEast, AutoRoads)$
  532.  
  533. define t_streets r_roadEast CreateThing(r_road)$
  534. SetupRoomP(r_roadEast, "at a junction", "The town is to the west.")$
  535. Connect(r_roadNorthEast, r_roadEast, D_SOUTH)$
  536. Connect(r_es4, r_roadEast, D_EAST)$
  537. UniConnect(r_en3, r_roadEast, D_EAST)$
  538. AutoGraphics(r_roadEast, AutoRoads)$
  539.  
  540. define t_streets r_roadSouthEast CreateThing(r_road)$
  541. SetupRoomP(r_roadSouthEast, "at a corner in the road", "")$
  542. Connect(r_roadEast, r_roadSouthEast, D_SOUTH)$
  543. AutoGraphics(r_roadSouthEast, AutoRoads)$
  544.  
  545. define t_streets r_roadSouth CreateThing(r_road)$
  546. SetupRoomP(r_roadSouth, "at a junction", "The town is to the north.")$
  547. Connect(r_roadSouthEast, r_roadSouth, D_WEST)$
  548. Connect(r_se2, r_roadSouth, D_SOUTH)$
  549. UniConnect(r_sw3, r_roadSouth, D_SOUTH)$
  550. AutoGraphics(r_roadSouth, AutoRoads)$
  551.  
  552. define t_streets r_roadSouthWest CreateThing(r_road)$
  553. SetupRoomP(r_roadSouthWest, "at a corner in the road", "")$
  554. Connect(r_roadSouth, r_roadSouthWest, D_WEST)$
  555. AutoGraphics(r_roadSouthWest, AutoRoads)$
  556.  
  557. define t_streets r_roadWest CreateThing(r_road)$
  558. SetupRoomP(r_roadWest, "at a junction", "The town is to the east.")$
  559. Connect(r_roadSouthWest, r_roadWest, D_NORTH)$
  560. Connect(r_ws3, r_roadWest, D_WEST)$
  561. UniConnect(r_wn3, r_roadWest, D_WEST)$
  562. AutoGraphics(r_roadWest, AutoRoads)$
  563.  
  564. define t_streets r_roadNorthWest CreateThing(r_road)$
  565. SetupRoomP(r_roadNorthWest, "at a corner in the road", "")$
  566. Connect(r_roadWest, r_roadNorthWest, D_NORTH)$
  567. Connect(r_roadNorth, r_roadNorthWest, D_WEST)$
  568. AutoGraphics(r_roadNorthWest, AutoRoads)$
  569.  
  570. /* a bit of the great outdoors */
  571.  
  572. define t_streets r_path1 CreateThing(r_path)$
  573. SetupRoomP(r_path1, "on a north-south pathway", "The town is to the south.")$
  574. Connect(r_roadNorth, r_path1, D_NORTH)$
  575. Scenery(r_path1, "town")$
  576. AutoGraphics(r_path1, AutoPaths)$
  577.  
  578. define t_streets r_path2 CreateThing(r_path)$
  579. SetupRoomP(r_path2, "on a north-south pathway",
  580.     "A small trail heads to the east.")$
  581. SetThingStatus(r_path2, ts_public)$
  582. Connect(r_path1, r_path2, D_NORTH)$
  583. AutoGraphics(r_path2, AutoPaths)$
  584.  
  585. define t_streets r_path3 CreateThing(r_path)$
  586. SetupRoomP(r_path3, "at a dead-end",
  587.     "A large billboard reads: Castle lots for sale - apply with SysAdmin.")$
  588. Connect(r_path2, r_path3, D_NORTH)$
  589. AutoGraphics(r_path3, AutoPaths)$
  590. Sign(r_path3, "billboard,bill-board;large.board,large,bill", "",
  591.     "Castle lots for sale - apply with SysAdmin")$
  592.  
  593. /* and now a connecting trail */
  594.  
  595. define t_streets r_ewTrail1 CreateThing(r_path)$
  596. SetupRoomP(r_ewTrail1, "on an east-west trail", "")$
  597. Connect(r_path2, r_ewTrail1, D_EAST)$
  598. AutoGraphics(r_ewTrail1, AutoPaths)$
  599.  
  600. define t_streets r_ewTrail2 CreateThing(r_path)$
  601. SetupRoomP(r_ewTrail2, "on an east-west trail",
  602.     "The trail continues to the east and the west. A line of trees starts "
  603.     "just north of here and continues to the east. You can see the town to "
  604.     "the south, but you can't get there from here.")$
  605. Connect(r_ewTrail1, r_ewTrail2, D_EAST)$
  606. Scenery(r_ewTrail2, "tree,line;line,of.town")$
  607. r_ewTrail2@p_rNorthDesc :=
  608.     "You can see trees and bushes to the north. You might be able to push "
  609.     "your way through them."$
  610. r_ewTrail2@p_rSouthDesc := "You can see the town in the distance."$
  611. AutoGraphics(r_ewTrail2, AutoPaths)$
  612.  
  613. define t_streets r_ewTrail3 CreateThing(r_outdoors)$
  614. SetupRoomP(r_ewTrail3, "on an east-west trail",
  615.     "The line of trees continues to the north, and you can see an open field "
  616.     "to the east.")$
  617. Scenery(r_ewTrail3, "trail.field.tree,line;line,of")$
  618. Connect(r_ewTrail2, r_ewTrail3, D_EAST)$
  619. r_ewTrail3@p_rNorthDesc := "You can see trees and bushes to the north."$
  620. r_ewTrail3@p_rEastDesc :=
  621.     "You can see an open field to the east. There is a large tree in it."$
  622. AutoGraphics(r_ewTrail3, AutoPaths)$
  623.  
  624. /* here for the next little while is the field with the pear tree */
  625.  
  626. define t_streets r_pearField CreateThing(r_field)$
  627. SetupRoomP(r_pearField, "in a field",
  628.     "There is a large pear tree here, full of pears. "
  629.     "A small trail heads west.")$
  630. Connect(r_ewTrail3, r_pearField, D_EAST)$
  631. Scenery(r_pearField, "trail")$
  632. r_pearField@p_rNorthDesc :=
  633.     "You can see the edge of a bushy gully to the north."$
  634. AutoGraphics(r_pearField, AutoPaths)$
  635. r_pearField@p_oSmellString := "The air here smells quite fresh and clean!"$
  636. r_pearField@p_Image := "Town/pearField"$
  637.  
  638. define tp_streets o_pearTree CreateThing(nil)$
  639. SetupObject(o_pearTree, r_pearField, "tree;large,pear.branch;loaded",
  640.     "The tree is quite large, with many long branches loaded with pears. "
  641.     "It stands by itself in the center of this small field. Many of the "
  642.     "branches come within easy reach.")$
  643. o_pearTree@p_oInvisible := true$
  644. o_pearTree@p_oSmellString := "The pear tree smells somewhat woody."$
  645. o_pearTree@p_Image := "Town/pearTree"$
  646.  
  647. define tp_streets o_pearOnTree CreateThing(nil)$
  648. SetupObject(o_pearOnTree, r_pearField, "pear;plump,juicy",
  649.     "The pears on the tree look quite delicious.")$
  650. o_pearOnTree@p_oInvisible := true$
  651. o_pearOnTree@p_oEatString := "You should pick a pear from the tree first."$
  652. o_pearOnTree@p_oSmellString := o_pearOnTree@p_oEatString$
  653. o_pearOnTree@p_oTouchString := o_pearOnTree@p_oEatString$
  654.  
  655. /* Special procs for the pears. Note the lack of 'utility', since we
  656.    make the pears belong to whoever sources this file */
  657.  
  658. define tp_streets proc pearDrop(thing pear)status:
  659.     thing carryer, here;
  660.  
  661.     carryer := pear@p_oCarryer;
  662.     ClearThing(pear);
  663.     SPrint(carryer, "The pear drops and is pulped!\n");
  664.     here := Here();
  665.     if CanSee(here, carryer) and not carryer@p_pHidden then
  666.     ABPrint(here, carryer, carryer,
  667.         Capitalize(CharacterNameG(carryer)) +
  668.         " drops a pear which sploops.\n");
  669.     else
  670.     ABPrint(here, carryer, carryer, "You hear a smack! sound.\n");
  671.     fi;
  672.     DelElement(carryer@p_pCarrying, pear);
  673.     /* we have just destroyed the pear and already dropped it, we do NOT
  674.        want to continue with normal drop processing */
  675.     succeed
  676. corp;
  677.  
  678. define tp_streets proc pearEat()status:
  679.     thing th, me;
  680.  
  681.     th := It();
  682.     me := Me();
  683.     if th@p_oCreator = me then
  684.     Print("You eat the pear. It was really good.\n");
  685.     if CanSee(Here(), me) and not me@p_pHidden then
  686.         OPrint(Capitalize(CharacterNameG(me)) + " eats a pear.\n");
  687.     else
  688.         OPrint("You hear some slurping noises.\n");
  689.     fi;
  690.     ClearThing(th);
  691.     DelElement(me@p_pCarrying, th);
  692.     else
  693.     Print("That's not your pear!\n");
  694.     fi;
  695.     /* do NOT continue with normal 'eat' processing */
  696.     succeed
  697. corp;
  698.  
  699. define tp_streets proc pearGive(thing target)status:
  700.     thing me, pear;
  701.  
  702.     me := Me();
  703.     pear := It();
  704.     if pear@p_oCreator = me then
  705.     Print("You fumble when trying to give away the pear, and drop it!\n");
  706.     if CanSee(Here(), me) and not me@p_pHidden then
  707.         OPrint(Capitalize(CharacterNameG(me)) +
  708.         " drops a pear which sploops.\n");
  709.     else
  710.         OPrint("You hear a smack! sound.\n");
  711.     fi;
  712.     ClearThing(pear);
  713.     DelElement(me@p_pCarrying, pear);
  714.     else
  715.     Print("That's not your pear!\n");
  716.     fi;
  717.     /* the give never works */
  718.     fail
  719. corp;
  720.  
  721. define tp_streets proc pearPutIn(thing pear, container)status:
  722.     string containerName;
  723.  
  724.     containerName := FormatName(container@p_oName);
  725.     Print("You drop the pear into the " + containerName +
  726.     ". Unfortunately, the pear doesn't survive the dropping - it is "
  727.     "squished. You shake out the pieces and clean the mess out of the " +
  728.     containerName + ".\n");
  729.     ClearThing(pear);
  730.     DelElement(Me()@p_pCarrying, pear);
  731.     succeed
  732. corp;
  733.  
  734. define tp_streets o_pearInHand CreateThing(nil)$
  735. o_pearInHand@p_oName := "pear;plump,juicy"$
  736. o_pearInHand@p_oDesc := "The pear looks exceedingly delicious!"$
  737. o_pearInHand@p_oEatChecker := pearEat$
  738. o_pearInHand@p_oDropChecker := pearDrop$
  739. o_pearInHand@p_oPutMeInChecker := pearPutIn$
  740. o_pearInHand@p_oSmellString := "The pear smells like a pear."$
  741. o_pearInHand@p_oTouchString := "Surprise! The pear feels like a pear."$
  742. o_pearInHand@p_Image := "Town/pear"$
  743. SetThingStatus(o_pearInHand, ts_public)$
  744.  
  745. define tp_streets proc pearGet(thing th)status:
  746.     thing me;
  747.  
  748.     me := Me();
  749.     if FindChildOnList(me@p_pCarrying, o_pearInHand) then
  750.     Print("Don't be greedy! You already have a pear.\n");
  751.     else
  752.     /* will be owned by the real player */
  753.     th := CreateThing(o_pearInHand);
  754.     th@p_oCreator := me;
  755.     SetThingStatus(th, ts_public);
  756.     if CarryItem(th) then
  757.         /* This is put directly on the individual pears, so that it can
  758.            be removed in 'questPearGive'. */
  759.         th@p_oGiveChecker := pearGive;
  760.         Print("You pick a pear from the tree.\n");
  761.         /* assume it is not dark */
  762.         if not me@p_pHidden then
  763.         OPrint(Capitalize(CharacterNameG(me)) +
  764.                " picks a pear from the tree.\n");
  765.         fi;
  766.     else
  767.         ClearThing(th);
  768.     fi;
  769.     fi;
  770.     /* do not want to continue with normal get processing */
  771.     succeed
  772. corp;
  773.  
  774. o_pearOnTree@p_oGetChecker := pearGet$
  775.  
  776. define tp_streets proc questPearDesc()string:
  777.  
  778.     "Bring me two pears."
  779. corp;
  780.  
  781. define tp_streets proc questPearGive()status:
  782.     thing pear;
  783.     bool hadOne;
  784.  
  785.     pear := It();
  786.     if Parent(pear) = o_pearInHand then
  787.     /* make it not sploop */
  788.     hadOne :=
  789.         FindChildOnList(FindAgent("Questor")@p_pCarrying, o_pearInHand);
  790.     pear -- p_oGiveChecker;
  791.     if hadOne then
  792.         GiveToQuestor("plump juicy pear");
  793.         succeed
  794.     else
  795.         continue
  796.     fi
  797.     elif pear@p_oName = "pear;plump,juicy" then
  798.     GiveToQuestor("plump juicy pear");
  799.     SPrint(TrueMe(), "Questor is not impressed.\n");
  800.     fail
  801.     else
  802.     continue
  803.     fi
  804. corp;
  805.  
  806. define tp_streets proc questPearHint()string:
  807.  
  808.     "Perhaps you need help from a friendly flower."
  809. corp;
  810.  
  811. QuestGive("Pear", questPearDesc, questPearGive, questPearHint)$
  812.  
  813. define tp_streets proc pearTreeGet(thing th)status:
  814.     Print("The tree is far too large for you to carry, and in any event, "
  815.         "it is securely rooted to the ground.\n");
  816.     if Me()@p_pHidden then
  817.     OPrint("The tree shakes slightly.\n");
  818.     else
  819.     OPrint(Capitalize(CharacterNameG(Me())) +
  820.            " seems to be embracing the tree.\n");
  821.     fi;
  822.     succeed
  823. corp;
  824.  
  825. o_pearTree@p_oGetChecker := pearTreeGet$
  826.  
  827. unuse tp_streets
  828.