home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Games 3 / cd.iso / games / dcg303xa / object.scr < prev    next >
Text File  |  1993-06-27  |  41KB  |  1,223 lines

  1. !
  2. ! Default script OBJECT.SCR.
  3. !
  4. ! This is the default script for handling objects.  It is invoked whenever
  5. ! an object is manipulated (Talk, Get, Drop, Wear, Remove, Look, Examine,
  6. ! Invoke, Use and Exit) under the following conditions:
  7. !
  8. ! a) If the object has a script assigned to it, that script is invoked
  9. !    first.
  10. ! b) If the object's script terminates with CONTINUE, or if the object
  11. !    does not have a script, then this script is invoked.
  12. !
  13. ! You may modify this script at will, but one thing to remember is that
  14. ! this script should NEVER terminate with CONTINUE.  The reason is that
  15. ! objects may explicitly state that their script is 'OBJECT', in which
  16. ! case a 'CONTINUE' would execute this script twice! (Once as the script
  17. ! assigned to the object, and another time because the script ended with
  18. ! continue).
  19. !
  20. ! (c) DC Software, 1992
  21. !
  22.  
  23. !------------------------------------------------------------------------!
  24. :@TALK ! Talk to the object or npc !
  25. !------------------------------------------------------------------------!
  26.   ! This script is called whenever the object or NPC you tried to talk
  27.   ! to does not have it's own script for handling talking. Thus, it just
  28.   ! prints a standard message.  Since nothing really happens here, we
  29.   ! omit the check to see if the player is alive.
  30.  
  31.   ! gosub STILLKICKING; - don't check !
  32.   if npc.count then
  33.     writeln( "The ", npc.type, " has nothing to say.." );
  34.   else
  35.     writeln( "How do you talk to an ", object.type, "?" );
  36.   endif;
  37.   STOP;
  38.  
  39. !------------------------------------------------------------------------!
  40. :@GET ! Get the object (pick it up) !
  41. !------------------------------------------------------------------------!
  42.   if npc.count then writeln( "You can't do that.." ); STOP; endif;
  43.   if object.endgame = END_ON_GET then  ! Game ends on a GET of this object !
  44.     if object.endtext > 0 then         ! .. this text is displayed first.. !
  45.       readtext( object.endtext );
  46.     endif;                             ! .. then the game ends. !
  47.     ENDGAME;
  48.   endif;
  49.   if object.type = CHEST and object.locktype then ! Locked !
  50.     writeln( "You must first UNLOCK the chest, then GET the gold!" );
  51.   elsif object.type = CHEST or object.type = GOLDSACK then
  52.     if object.value = 0 then
  53.       L(1) = object.count * player.hp * 10 + random( 100 ) + 1;
  54.     else
  55.       L(1) = object.value * object.count;
  56.       if L(1) <= 0 then
  57.         L(1) = object.value;
  58.       endif;
  59.     endif;
  60.     writeln( "Got ", $L1, " (gold pieces)."  );
  61.     group.gold = group.gold + L(1);
  62.     vanish( object );
  63.   elsif object.type = FOOD and object.class = 0 then
  64.     writeln( "Got ", object.count, " units of food." );
  65.     group.food = group.food + object.count;
  66.     vanish( object );
  67.   elsif object.weight = 999 then
  68.     writeln( "The ", object.name, " is much too heavy." );
  69.   elsif object.weight = 998 then
  70.     writeln( "The ", object.name, " is can't be moved." );
  71.   elsif object.weight = 997 then
  72.     writeln( "Why would you want to take the ", object.name, "?" );
  73.   elsif object.weight > 255 then
  74.     writeln( "You can't move it!" );
  75.   elsif object.weight > player.mload then
  76.     writeln( "You are not strong enough to carry it!" );
  77.   elsif object.weight > 1 and object.weight + player.load > player.mload then
  78.     writeln( "Your load is too heavy!" );
  79.   else
  80.     L(0) = object.count;
  81.     move( object, player.bp );  ! OBJECT does not exist after MOVE !
  82.     if success then
  83.       writeln("Got ", L(0), " ", player.bp.name );
  84.     elsif object.count = L(0) then
  85.       writeln("You couldn't carry it");
  86.     else
  87.       writeln("You could only carry ", L(0) - object.count, " of them." );
  88.     endif;
  89.   endif;
  90.   STOP;
  91.  
  92. !------------------------------------------------------------------------!
  93. :@DROP      ! Drop the object on the floor !
  94. !------------------------------------------------------------------------!
  95.   if curritem.count > 1 then
  96.     L(0) = getnum( "How many? ", 0, curritem.count );
  97.     if L(0) > 0 then 
  98.       writeln( "You drop ", L(0), " ", curritem.name, "(s)" );
  99.       drop( curritem, L(0) );  
  100.     endif;
  101.   else
  102.     writeln( "You drop the ", curritem.name );
  103.     drop( curritem );
  104.   endif;
  105.   STOP;
  106.  
  107. !------------------------------------------------------------------------!
  108. :@WEAR      ! Wear or Wield the object !
  109. !------------------------------------------------------------------------!
  110.  
  111.   L(0) = 0;  ! Hands needed to hold the item..
  112.  
  113.   on curritem.type goto
  114.    WR_FOOD,     WR_WEAPON,     WR_AMMO,      WR_ARMOR,      WR_SHIELD,
  115.    WR_AMULET,   WR_RING,       WR_POTION,    WR_SCROLL,     WR_STAFF;
  116. !
  117. ! the rest can't be worn, so no need to list them..
  118. !  WR_CHEST,    WR_KEYS,       WR_GEMS,      WR_BOOK,       WR_GOLDSACK,
  119. !  WR_TORCH,    WR_LANTERN,    WR_ROPE,      WR_HOOKS,      WR_MIRROR,
  120. !  WR_SIGN,     WR_VEHICLE
  121. !
  122.  
  123. :WR_FOOD
  124. :WR_AMMO
  125. :WR_POTION
  126. :WR_SCROLL
  127.    writeln( "How do you wear a ", curritem.type, "? " );
  128.    STOP;
  129.  
  130. :WR_WEAPON
  131.    gosub STILLKICKING;
  132.    if (player.class = ELF or player.class = WIZARD or player.class = ARCHER) 
  133.       and curritem.weight > 5 + adjustments(player.str) then
  134.      writeln( "This weapon is too heavy for this character class." );
  135.    elsif player.class = WIZARD and curritem.hands > 1 then
  136.      writeln( "Wizards can only use one-handed weapons" );
  137.    elsif (player.class = WIZARD or player.class = DWARF) and curritem.class = MISSILE then
  138.      writeln( "Wizards and dwarfs can't use non-magical missile weapons" );
  139.    elsif player.weapon.count > 0 then
  140.      writeln( "You must first remove the ", player.weapon.name );
  141.    else
  142.      L(0) = curritem.hands; ! Hands needed to hold the weapon !
  143.      S0 = "wielding";
  144.      goto WR_DOIT;
  145.    endif;
  146.    STOP;
  147.  
  148. :WR_ARMOR
  149.    gosub STILLKICKING;
  150.    if (player.class = ELF or player.class = WIZARD) and
  151.       curritem.weight > 5 + adjustments(player.str) then
  152.      writeln( "This armor is too heavy for an elf or a wizard" );
  153.    elsif player.class = ARCHER and
  154.       curritem.weight > 10 + adjustments(player.str) then
  155.      writeln( "This armor is too cumbersome for an archer" );
  156.    elsif player.armor.count > 0 then
  157.      writeln( "You must first remove the ", player.armor.name );
  158.    else
  159.      S0 = "wearing";
  160.      goto WR_DOIT;
  161.    endif;
  162.    STOP;
  163.  
  164. :WR_SHIELD
  165.    gosub STILLKICKING;
  166.    if player.class = WIZARD or player.class = ARCHER or player.class = DWARF then
  167.      writeln( player.class, "s cannot use a shield!" );
  168.    elsif player.class = ELF and curritem.weight > 5 + adjustments(player.str) then
  169.      writeln( "The shield is too heavy for an ELF." );
  170.    elsif player.shield.count > 0 then
  171.      writeln( "You must first remove the ", player.shield.name );
  172.    else
  173.      L(0) = 1;             ! A shield always needs 1 hand.. !
  174.      S0 = "using";
  175.      goto WR_DOIT;
  176.    endif;
  177.    STOP;
  178.  
  179. :WR_STAFF
  180.    gosub STILLKICKING;
  181.    L(0) = 1;             ! A staff always needs 1 hand.. !
  182.    if player.class = FIGHTER then
  183.      writeln( "Fighters can't use magic staffs." );
  184.    elsif curritem.charges = 0 then
  185.      writeln( "The staff has no charges left.." );
  186.    elsif player.staff.count > 0 then
  187.      writeln( "You must first remove the ", player.staff.name );
  188.    else
  189.      S0 = "holding";
  190.      goto WR_DOIT;
  191.    endif;
  192.    STOP;
  193.  
  194. :WR_AMULET
  195. :WR_RING
  196.    if player.class = FIGHTER then
  197.      writeln( "Fighters can't use magic ", curritem.type, "s." );
  198.    elsif curritem.charges = 0 then
  199.      writeln( "The ", curritem.type, " has no charges left.." );
  200.    elsif curritem.type = AMULET and player.amulet.count > 0 then
  201.      writeln( "You must first remove the ", player.amulet.name );
  202.    elsif curritem.type = RING and player.ring.count > 0 then
  203.      writeln( "You must first remove the ", player.ring.name );
  204.    else
  205.      S0 = "wearing";
  206.      goto WR_DOIT;
  207.    endif;
  208.    STOP;
  209.  
  210. :WR_DOIT
  211.   L(1) = 2; ! Player has 2 hands.. !
  212.   if player.weapon.count then dec( L(1), player.weapon.hands ); endif;
  213.   if player.shield.count then dec( L(1), 1 );                   endif;
  214.   if player.staff.count  then dec( L(1), 1 );                   endif;
  215.   if L(0) > L(1) then
  216.     writeln( "You don't have enough free hands!" );
  217.     STOP;
  218.   endif;
  219.   !
  220.   move( curritem, player.body, 1 );
  221.   if success then
  222.     writeln( "You are now ", s0, " the ", player.body.name );
  223.     if player.body.type = ARMOR or player.body.type = SHIELD then
  224.       if player.armor.cursed or player.shield.cursed then
  225.         player.ac = 0;
  226.       else
  227.         inc(player.ac,player.body.ac);
  228.       endif;
  229.     elsif player.body.type = RING or player.body.type = AMULET then
  230.       if( player.body.charges > 0 ) then
  231.         curritem = player.body;
  232.         gosub M1_INVOKE;
  233.         if curritem.charges < 255 then
  234.           dec( curritem.charges );
  235.         endif;
  236.       else
  237.         writeln( "The ", player.body.type, " has no charges." );
  238.       endif;
  239.     endif;
  240.   endif;
  241.   STOP;
  242.  
  243. !------------------------------------------------------------------------!
  244. :@REMOVE    ! Remove an object !
  245. !------------------------------------------------------------------------!
  246.   if curritem.cursed then
  247.     writeln( "The ", curritem.type, " is cursed and cannot be removed.." );
  248.     STOP;
  249.   endif;
  250.   move( curritem, player.bp, 1 );
  251.   if success then
  252.     if player.hp = 0 then
  253.       writeln( "You remove the ", player.bp.name, " from the body of ", player.name );
  254.     else
  255.       writeln( player.name, " removes the ", player.bp.name );
  256.     endif;
  257.   endif;
  258.   STOP;
  259.  
  260. !------------------------------------------------------------------------!
  261. :@LOOK      ! Look at an object                                          !
  262. !------------------------------------------------------------------------!
  263.   L(255) = FALSE;   ! Do not give DETAILED description !
  264.   gosub DESCRIBE;
  265.   STOP;
  266.  
  267. !------------------------------------------------------------------------!
  268. :@EXAMINE   ! Examine the object in detail                               !
  269. !------------------------------------------------------------------------!
  270.   L(255) = TRUE;   ! Give DETAILED description !
  271.   gosub DESCRIBE;
  272.   STOP;
  273.  
  274. !------------------------------------------------------------------------!
  275. :@INVOKE  ! Invoke an object we are carrying..
  276. !------------------------------------------------------------------------!
  277.  
  278. ! Called to use an an object in the current player's backpack.  The
  279. ! action varies depending on the type of object.  For example, food
  280. ! is consumed, potions, amulets, scrolls, etc.  have their magical
  281. ! effect invoked.
  282.  
  283.   gosub STILLKICKING;
  284.   if curritem.endgame = END_ON_USE then
  285.     if curritem.endtext > 0 then         ! .. this text is displayed first.. !
  286.       readtext( curritem.endtext );
  287.     endif;                             ! .. then the game ends. !
  288.     ENDGAME;
  289.   endif;
  290.   if curritem.type = FOOD or curritem.type = POTION then
  291.     player.energy = 255;     ! Not hungry any more.. 
  292.     gosub M1_INVOKE;
  293.     if curritem.type = POTION and curritem.count > 1 then
  294.       curritem.name = curritem.class;
  295.     endif;
  296.     dec( curritem.count );
  297.   elsif curritem.type = SCROLL or curritem.type = STAFF then
  298.     gosub M2_INVOKE;
  299.   elsif curritem.type = GEMS or curritem.type = RING or curritem.type = AMULET then
  300.     gosub M1_INVOKE;
  301.     if curritem.charges < 255 then
  302.       dec( curritem.charges );
  303.       if curritem.count > 1 then
  304.         curritem.name = curritem.class;
  305.       endif;
  306.       if curritem.type = GEMS and curritem.charges = 0 then
  307.         writeln( "The ", curritem.type, " vanishes after you use it." );
  308.         dec( curritem.count );
  309.       endif;
  310.     endif;
  311.   else
  312.     writeln( "The ", curritem.name, " has no magical properties.." );  
  313.   endif;
  314.   STOP;
  315.  
  316. !------------------------------------------------------------------------!
  317. :@USE ! Use an object laying on the ground before us..
  318. !------------------------------------------------------------------------!
  319. !
  320. ! Called when an object that is laying on the ground is 'used'.  Note that
  321. ! 'use' means different things for different object types, and that in 
  322. ! order to invoke an item you have 'get' it and sometimes 'wear' it.
  323. !
  324.   if object.endgame = END_ON_USE then
  325.     if object.endtext > 0 then         ! .. this text is displayed first.. !
  326.       readtext( object.endtext );
  327.     endif;                             ! .. then the game ends. !
  328.     ENDGAME;
  329.   endif;
  330.  
  331.   on object.type goto
  332.    USE_FOOD,     USE_WEAPON,     USE_AMMO,      USE_ARMOR,      USE_SHIELD,
  333.    USE_AMULET,   USE_RING,       USE_POTION,    USE_SCROLL,     USE_STAFF,
  334.    USE_CHEST,    USE_KEYS,       USE_GEMS,      USE_BOOK,       USE_GOLDSACK,
  335.    USE_TORCH,    USE_LANTERN,    USE_ROPE,      USE_HOOKS,      USE_MIRROR,
  336.    USE_SIGN,     USE_VEHICLE;
  337.  
  338.   writeln( "I don't know how to do that with the ", object.name );
  339.   STOP;
  340.  
  341.   :USE_FOOD
  342.   :USE_POTION
  343.      if object.class then
  344.        writeln( "You must 'get' it, then 'quaff' (eat) it.." );
  345.      else
  346.        writeln( "Just 'get' it.." );
  347.      endif;
  348.      STOP;
  349.  
  350.   :USE_GEMS
  351.   :USE_SCROLL
  352.      writeln( "You must first 'get' it, then 'invoke' it.." );
  353.      STOP;
  354.  
  355.   :USE_AMULET
  356.   :USE_RING
  357.   :USE_ARMOR
  358.   :USE_WEAPON
  359.   :USE_SHIELD
  360.   :USE_STAFF
  361.      writeln( "You must first 'get' it, then 'wear' or 'wield' it.." );
  362.      STOP;
  363.  
  364.   :USE_AMMO
  365.      writeln( "Just carry it in your backpack.  If you 'wield' a " );
  366.      writeln( "weapon that uses this type of ammo, it will get used" );
  367.      writeln( "automaticly." );
  368.      STOP;
  369.  
  370.   :USE_CHEST
  371.      ! Unlock the chest !
  372.      if object.locktype then
  373.        L(0) = 0;
  374.        :UCLOOP
  375.           setbp( player, L(0) );
  376.           if player.bp.type = KEYS and player.bp.keytype = object.locktype then
  377.             writeln( object.name, " unlocked.." );
  378.             object.locktype = 0;
  379.             STOP;
  380.           endif;
  381.           inc( L(0) );
  382.           if L(0) < 16 goto :UCLOOP;
  383.        writeln( "You don't have the right key!  Break the lock?" );
  384.        if getstr( "Yes", "No" ) = 0 then
  385.          if random( 2 + adjustments(player.str) ) > 0 then
  386.            write( "You broke the lock!" );
  387.            if object.traptype = 1 then
  388.              voice( "Argh", 1000 ); ! 1000 = DCSOUNDS.VFL !
  389.              writeln( "Argh.. Poison trap!" );
  390.              player.poisoned = 1;
  391.            elsif object.traptype > 1 then
  392.              voice( "Explode", 1000 ); ! Play standard sound effect !
  393.              writeln( "Bomb Trap!" );
  394.              dec( player.hp, object.damage );
  395.              if player.hp = 0 then
  396.                writeln( player.name, " has died.." );
  397.              endif;
  398.            endif;
  399.            object.locktype = 0;
  400.          else
  401.            writeln( "It doesn't break!" );
  402.          endif;
  403.        else
  404.           writeln( "Ok." );
  405.        endif;
  406.      else
  407.        writeln( "It is not locked.." );
  408.      endif;
  409.      STOP;
  410.  
  411.   :USE_KEYS
  412.      writeln( "Just 'Get' it and carry it in case you find a lock that" );
  413.      writeln( "the key can open!" );
  414.      STOP;
  415.  
  416.   :USE_BOOK
  417.      writeln( "To read it, just 'Look' at it.." );
  418.      STOP;
  419.  
  420.   :USE_GOLDSACK
  421.      L(1) = getnum("How many gold pieces do you want to put in it?",
  422.                          0, group.gold / 10) * 10;
  423.      if L(1) then
  424.        writeln( "You put ", $L1, " in the bag." );
  425.        inc( object.value, L(1) );
  426.        dec( group.gold, L(1) );
  427.      else
  428.        writeln( "Smart move.." );
  429.      endif;
  430.      STOP;
  431.  
  432.   :USE_TORCH
  433.   :USE_LANTERN
  434.      writeln( "Save your torches.. I haven't implemented LIGHT yet!" );
  435.      STOP;
  436.  
  437.   :USE_ROPE
  438.      writeln( "After fooling around with it for a while, you manage to" );
  439.      writeln( "get yourself tangled up..." );
  440.      STOP;
  441.  
  442.   :USE_HOOKS
  443.      voice( "Ouch", 1000 );
  444.      writeln( "Ouch! (it's sharp!)" );
  445.      STOP;
  446.  
  447.   :USE_MIRROR
  448.      writeln( "Yes, you are ugly, but that doesn't matter here.." );
  449.      STOP;
  450.  
  451.   :USE_SIGN
  452.      writeln( "It's not yours.  You can 'Read' it if you wish.." );
  453.      STOP;
  454.  
  455.   :USE_VEHICLE
  456.      if group.vehicle.count then
  457.        writeln( "You must first exit the one you are in!" );
  458.        STOP;
  459.      endif;
  460.      if object.x <> group.x and object.y <> group.y then
  461.        writeln( "You must be standing next to the ", object.name );
  462.      else
  463.        group.x = object.x;            ! Move over to it !
  464.        group.y = object.y;            
  465.        move( object, group.vehicle, 1 ); ! Now board the object !
  466.        if success then
  467.          writeln( "You are on riding the ", group.vehicle.name );
  468.        endif;
  469.      endif;
  470.      STOP;
  471.  
  472. !------------------------------------------------------------------------!
  473. :@EXIT ! Exit a VEHICLE (since this is an object we are talking about..)
  474. !------------------------------------------------------------------------!
  475.   if curritem.count = 0 then
  476.     writeln("You are already on foot!" );
  477.     STOP;
  478.   endif;
  479.   if curritem.type <> VEHICLE then
  480.     writeln("BUG: CURRITEM in :@EXIT in OBJECT.SCR is not a vehicle!" );
  481.   endif;
  482.   if group.vehicle.count = 0 then
  483.     writeln("BUG: CURRITEM is not GROUP.VEHICLE on @EXIT in OBJECT.SCR" );
  484.   endif;
  485.   drop( group.vehicle );
  486.   voice( "Exit", 1000 );
  487.   writeln( "You are now on foot.." );
  488.   STOP;
  489.  
  490. !------------------------------------------------------------------------!
  491. :@ATTACK ! Attack an object or a person !
  492. !------------------------------------------------------------------------!
  493.   if npc.count then
  494.     if npc.type = HOSTILE then
  495.       FIGHT;
  496.       !- Script ends when you 'FIGHT' -!
  497.     endif;
  498.     writeln( "Find some bad guys to fight!" );
  499.     STOP;
  500.   endif;
  501.   if object.type = CHEST then
  502.     if object.locktype then
  503.       writeln( "Instead of fighting it, try 'UNLOCK'!" );
  504.     else
  505.       writeln( "It's not even locked, why fight it?" );
  506.     endif;
  507.   else
  508.     writeln( "Why would you want to fight the ", object.name );
  509.   endif;
  510.   STOP;
  511.  
  512. !------------------------------------------------------------------------!
  513. !--  SCRIPT SUBROUTINES ARE GROUPED HERE AT THE END.  THIS IS A CHOICE --!
  514. !--  NOT A REQUIREMENT.  IT MAKES THE MAIN SCRIPT CODE ABOVE A LITTLE  --!
  515. !--  BIT EASIER TO FOLLOW.  ---------------------------------------------!
  516. !------------------------------------------------------------------------!
  517.  
  518.  
  519. !------------------------------------------------------------------------!
  520. ! STILLKICKING: Subroutine to verify that the player is alive before     !
  521. ! allowing him/her/it to perform an action.                              !
  522. !------------------------------------------------------------------------!
  523. :STILLKICKING
  524.   if player.hp = 0 then
  525.     writeln( player.name, " is dead!" );
  526.     STOP;
  527.   endif;
  528.   RETURN;
  529.  
  530. !------------------------------------------------------------------------!
  531. !
  532. ! SUBROUTINE: DESCRIBE
  533. !
  534. ! This routine is invoked from @LOOK, @EXAMINE and by the ANALYZE spell
  535. ! to describe a given item.
  536. !
  537. !------------------------------------------------------------------------!
  538. :DESCRIBE
  539. !------------------------------------------------------------------------!
  540.  
  541. ! First, handle the case where you are looking at a CHARACTER
  542.  
  543.   if npc.count then
  544.     if npc.picture >= 0 then
  545.       viewpcx( npc );
  546.       if success then
  547.         pause;
  548.       endif;
  549.       paint(window); ! Assumes the picture fits in the window !
  550.     endif;
  551.     write( "Name: ", npc.name, ", Type: ", npc.type );
  552.     if npc.type = HOSTILE and npc.weapon.count then
  553.       write( ", Weapon: ", npc.weapon.name, ", Damage: ", npc.weapon.damage, ", Range: ", npc.weapon.range );
  554.     endif;
  555.     if L(255) then
  556.       write( ", Class: ", npc.class, ", Lvl: ", npc.level, ", AC: ", npc.ac, ", HP: ", npc.hp );
  557.     endif;
  558.     writeln(".");
  559.     STOP;
  560.   endif;
  561.   if object.picture >= 0 then
  562.     viewpcx( object );
  563.     if success then
  564.       pause;
  565.     endif;
  566.     paint(window); ! Assumes the picture fits in the window !
  567.   elsif object.type = SIGN or object.type = BOOK then
  568.     readtext( object.text );
  569.     STOP;
  570.   endif;
  571.   write( "You see a ", object.name );
  572.   if NOT L(255) then
  573.     writeln;
  574.     STOP;
  575.   endif;
  576.   write( ", Type: ", object.type );
  577. !
  578. ! The following is a 'cascading if..then..elsif..elsif.....else..endif' 
  579. ! statement.  It is used here to illustrate it's usefulness.  The same
  580. ! code could have been written with a 'ON object.type GOTO' statement.
  581. !
  582.   if object.type = FOOD or object.type = POTION  then
  583.     if object.class then
  584.       write( ", Class: ", object.class );
  585.       if object.class <> CURE then
  586.         write( ", Units: ", object.units );
  587.       endif;
  588.     endif;
  589.   elsif object.type = WEAPON then
  590.     write( ", Class: ", object.class, 
  591.            ", Hands: ", object.hands, 
  592.            ", Range: ", object.range, 
  593.            ", Damage: ", object.damage );
  594.     if object.ammoneeded then
  595.       write( ", Needs ammo type: ", object.ammo_type );
  596.     endif;
  597.   elsif object.type = AMMO then
  598.     write( ", Ammo Type: ", object.ammotype );
  599.     if object.traptype then
  600.       write( ", Poisoned" );
  601.     endif;
  602.     if object.damage then
  603.       write( ", Extra Damage: ", object.damage );
  604.     endif;
  605.   elsif object.type = ARMOR or object.type = SHIELD then
  606.     write( ", Armor Class: ", object.ac );
  607.     if object.cursed then
  608.       write( " Cursed!" );
  609.     endif;
  610.   elsif object.type = AMULET or object.type = RING or object.type = GEMS then
  611.     if object.class then
  612.       write( ", Class: ", object.class );
  613.       write( ", Charges: ", object.charges );
  614.       if object.class <> CURE then
  615.         write( ", Units: ", object.units );
  616.         if object.permanent then
  617.           write( ", Permanent!" );
  618.         else
  619.           write( ", Temporary" );
  620.         endif;
  621.       endif;
  622.       if object.cursed then
  623.         write( ", Cursed!" );
  624.       endif;
  625.     endif;
  626.   elsif object.type = SCROLL then
  627.     write( ", Class: ", object.class );
  628.   elsif object.type = STAFF then
  629.     write( ", Class: ", object.class, ", Charges: ", object.charges );
  630.   elsif object.type = CHEST then
  631.     if object.locktype then
  632.       write( ", Locked!" );
  633.       if object.traptype = 0 then
  634.         write( ", no traps" );
  635.       elsif object.traptype = 1 then
  636.         write( ", poison trap" );
  637.       else
  638.         write( ", bomb damage: ", object.traptype );
  639.       endif;
  640.     endif;
  641. ! elsif object.type = KEYS     then
  642. !   nothing special about it
  643. ! elsif object.type = BOOK     then
  644. !   nothing special about it
  645. ! elsif object.type = GOLDSACK then
  646. !   nothing special about it
  647. ! elsif object.type = TORCH    then
  648. !   nothing special about it
  649. ! elsif object.type = LANTERN  then
  650. !   nothing special about it
  651. ! elsif object.type = ROPE     then
  652. !   nothing special about it
  653. ! elsif object.type = HOOKS    then
  654. !   nothing special about it
  655. ! elsif object.type = MIRROR   then
  656. !   nothing special about it
  657. ! elsif object.type = SIGN     then
  658. !   nothing special about it
  659.   elsif object.type = VEHICLE then
  660.     write( ", Class: ", object.class );
  661. ! else
  662. !   user defined type?
  663.   endif;
  664.   if object.weight > 1 and object.weight < 256 then
  665.     write( ", Weight: ", object.weight );
  666.   endif;
  667.   writeln( "." );
  668.   return;
  669.  
  670. !------------------------------------------------------------------------!
  671. !
  672. ! SUBROUTINE: M1_INVOKE
  673. !
  674. ! Type 1 Magic - Affects the person invoking the magic..
  675. !
  676. ! This portion of the script is invoked whenever an individual in the
  677. ! adventurer's group:
  678. !
  679. !  a) Eats food that has a magical effect
  680. !  b) Drinks a potion with a magical effect
  681. !  c) Successfully wears a ring or an amulet with a magical effect
  682. !  d) Uses a GEM that has a magical effect.
  683. !
  684. ! When invoked, PLAYER is the person that will be affected, and CURRITEM
  685. ! is the item that has the magical effect, and which is either being
  686. ! worn or in the character's backpack.  OBJECT and NPC are not defined.
  687. !
  688. !------------------------------------------------------------------------!
  689. :M1_INVOKE
  690. !------------------------------------------------------------------------!
  691.  
  692.   if curritem.cursed and curritem.permanent then
  693.     curritem.permanent = FALSE;
  694.     writeln( "WARNING: This object was 'cursed' and had 'permanent' effect!" );
  695.     writeln( "WARNING: The effect has been made 'temporary' by OBJECT.SCR" );
  696.   endif;
  697.  
  698.   on curritem.class goto
  699.     M1_NONE,    M1_CURE,    M1_HEAL,    M1_POISON,    M1_RESTORE,
  700.     M1_STR,     M1_DEX,     M1_SPD,     M1_AIM,       M1_AC,
  701.     M1_HP,      M1_IQ,      M1_PWR;
  702.  
  703. :M1_NONE
  704.   writeln( "Nothing happens.." );
  705.   return;
  706.  
  707. :M1_CURE
  708.   if player.poisoned then
  709.     player.poisoned = 0;
  710.     writeln( player.name, " is now cured." );
  711.   else
  712.     writeln( "Nothing happens.." );
  713.   endif;
  714.   return;
  715.  
  716. :M1_HEAL
  717.   if player.hp >= player.mhp then
  718.     writeln( "Nothing happens.." );
  719.   elsif player.hp = 0 then
  720.     writeln( player.name, " is beyond help.." );
  721.   else
  722.     if curritem.units > 0 then
  723.       L(0) = curritem.units;                   ! always heals the same points !
  724.     else
  725.       L(0) = random(player.mhp - player.hp)+1; ! heal a random number of points !
  726.     endif;
  727.     voice( "Tada", 1000 );
  728.     if player.hp + L(0) < player.mhp then
  729.       writeln( player.name, " heals ", L(0), " hit points.." );
  730.       inc( player.hp, L(0) );
  731.     else
  732.       writeln( player.name, " has been completely healed!" );
  733.       player.hp = player.mhp;
  734.     endif;
  735.   endif;
  736.   return;
  737.  
  738. :M1_POISON
  739.   if NOT player.poisoned then
  740.     player.poisoned = 1;
  741.     voice( "DudSpell", 1000 );
  742.     writeln( "You feel sick.." );
  743.   else
  744.     voice( "Boing", 1000 );
  745.     writeln( "You feel worse.." );
  746.   endif;
  747.   return;
  748.  
  749. :M1_RESTORE
  750.   if player.hp >= player.mhp then
  751.     writeln( "Nothing happens.." );
  752.   elsif player.hp = 0 then
  753.     writeln( player.name, " is beyond help.." );
  754.   else
  755.     voice( "OkSpell", 1000 );
  756.     player.hp = player.mhp;
  757.     writeln( player.name, " is completely healed!" );
  758.   endif;
  759.   return;
  760.  
  761. :M1_STR
  762.   if curritem.cursed then
  763.     player.str = 0;
  764.     voice( "DudSpell", 1000 );
  765.     writeln( "Something went wrong.." );
  766.   else
  767.     voice( "OkSpell", 1000 );
  768.     inc( player.str, curritem.units );
  769.     if curritem.permanent then
  770.       inc( player.mstr, curritem.units );
  771.     endif;
  772.     writeln( player.name, "'s strength increased by ", curritem.units, "!" );
  773.   endif;
  774.   return;
  775.  
  776. :M1_DEX
  777.   if curritem.cursed then
  778.     player.dex = 0;
  779.     voice( "DudSpell", 1000 );
  780.     writeln( "Something went wrong.." );
  781.   else
  782.     voice( "OkSpell", 1000 );
  783.     inc( player.dex, curritem.units );
  784.     if curritem.permanent then
  785.       inc( player.mdex, curritem.units );
  786.     endif;
  787.     writeln( player.name, "'s dexterity increased by ", curritem.units, "!" );
  788.   endif;
  789.   return;
  790.  
  791. :M1_SPD
  792.   if curritem.cursed then
  793.     player.spd = 0;
  794.     voice( "DudSpell", 1000 );
  795.     writeln( "Something went wrong.." );
  796.   else
  797.     voice( "OkSpell", 1000 );
  798.     inc( player.spd, curritem.units );
  799.     if curritem.permanent then
  800.       inc( player.mspd, curritem.units );
  801.     endif;
  802.     writeln( player.name, "'s speed increased by ", curritem.units, "!" );
  803.   endif;
  804.   return;
  805.  
  806. :M1_AIM
  807.   if curritem.cursed then
  808.     player.aim = 0;
  809.     voice( "DudSpell", 1000 );
  810.     writeln( "Something went wrong.." );
  811.   else
  812.     voice( "OkSpell", 1000 );
  813.     inc( player.aim, curritem.units );
  814.     if curritem.permanent then
  815.       inc( player.maim, curritem.units );
  816.     endif;
  817.     writeln( player.name, "'s aim increased by ", curritem.units, "!" );
  818.   endif;
  819.   return;
  820.  
  821. :M1_AC
  822.   if curritem.cursed then
  823.     player.ac = 0;
  824.     voice( "DudSpell", 1000 );
  825.     writeln( "Something went wrong.." );
  826.   else
  827.     voice( "OkSpell", 1000 );
  828.     inc( player.ac, curritem.units );
  829.     if curritem.permanent then
  830.       inc( player.mac, curritem.units );
  831.     endif;
  832.     writeln( player.name, "'s armor class increased by ", curritem.units, "!" );
  833.   endif;
  834.   return;
  835.  
  836. :M1_HP
  837.   if curritem.cursed then
  838.     player.hp = player.hp / 3 + 1;
  839.     writeln( player.name, " has been seriously injured!" );
  840.   else
  841.     voice( "OkSpell", 1000 );
  842.     inc( player.hp, curritem.units );
  843.     if curritem.permanent then
  844.       inc( player.mhp, curritem.units );
  845.     endif;
  846.     writeln( player.name, "'s hit points increased by ", curritem.units, "!" );
  847.   endif;
  848.   return;
  849.  
  850. :M1_IQ
  851.   if curritem.cursed then
  852.     player.iq = 0;
  853.     voice( "DudSpell", 1000 );
  854.     writeln( "Something went wrong.." );
  855.   else
  856.     voice( "OkSpell", 1000 );
  857.     inc( player.iq, curritem.units );
  858.     if curritem.permanent then
  859.       inc( player.miq, curritem.units );
  860.     endif;
  861.     writeln( player.name, "'s i.q. increased by ", curritem.units, "!" );
  862.   endif;
  863.   return;
  864.  
  865. :M1_PWR
  866.   if player.class = ELF or player.class = WIZARD then
  867.     if curritem.cursed then
  868.       player.pwr = 0;
  869.       voice( "DudSpell", 1000 );
  870.       writeln( "Something went wrong.." );
  871.     else
  872.       inc( player.pwr, curritem.units );
  873.       if curritem.permanent then
  874.         inc( player.mpwr, curritem.units );
  875.       endif;
  876.       voice( "OkSpell", 1000 );
  877.       writeln( player.name, "'s power increased by ", curritem.units, "!" );
  878.     endif;
  879.   else
  880.     voice( "Argh", 1000 );
  881.     write( player.name, " screams and falls to the ground, " );
  882.     if player.hp < 3 then
  883.       writeln( "dead!" );
  884.       player.hp = 0;
  885.     else
  886.       writeln( "holding his head.." );
  887.       dec( player.hp, 2 );
  888.     endif;
  889.   endif;
  890.   return;
  891.     
  892. !------------------------------------------------------------------------!
  893. !
  894. ! SUBROUTINE: M2_INVOKE
  895. !
  896. ! Type 2 Magic - Affects an object or a another person
  897. !
  898. ! This portion of the script handles magic spells which affect objects
  899. ! or persons other than the caster.  When invoked, the PLAYER is the
  900. ! person that invoked the spell and CURRITEM is the object that was used
  901. ! to invoke the spell (which is either being worn or carried by the
  902. ! player).
  903. !
  904. ! The OBJECT and NPC are undefined.  If the spell requires a target,
  905. ! the 'LOCATE' function can be used to select an object or character
  906. ! to cast the spell on.  The locate function returns the distance in blocks
  907. ! to the selected target.  If none is selected, the value is -1, and FAILURE
  908. ! is set.
  909. !
  910. ! After a LOCATE, either OBJECT or NPC will be set depending on whether the
  911. ! user selected an object or a character (or monster, during a fight).
  912. !
  913. ! To figure out which one was selected, check if NPC.COUNT is greater than
  914. ! 0.  If it is, a character was selected.  If it is not, then an object was
  915. ! selected.
  916. !
  917. !------------------------------------------------------------------------!
  918. :M2_INVOKE
  919. !------------------------------------------------------------------------!
  920.  
  921.   if curritem.class = NONE then
  922.     writeln( "Nothing happens.." );
  923.     return;
  924.   endif;
  925.  
  926.   if curritem.count = 0 then
  927.     writeln( "Oops, no object in OBJECT.SCR, m2 invoke" );
  928.     stop;
  929.   endif;
  930.  
  931.   if curritem.class = DAMAGE or curritem.class = CONFUSE or
  932.      curritem.class = SCARE  or curritem.class = PARALYZE or
  933.      curritem.class = KILL then
  934.     if not fighting then
  935.       writeln( "This spell can only be used during a fight.." );
  936.       return;
  937.     endif;
  938.     !
  939.     ! L(5) will contain the TOTAL experience points gained when done..
  940.     ! L(6) is the maximum damage that will be done to a single monster..
  941.     ! L(8) is the maximum total damage that can be done to a group of monsters..
  942.     ! L(9) is the TOTAL number of monsters affected AFTER the spell
  943.     !
  944.     L(5) = 0;
  945.     L(6) = player.level + adjustments(player.pwr) / 2 + 1;
  946.     if L(6) <= 0 then
  947.       writeln( "The spell failed.." );
  948.       STOP;
  949.     endif;
  950.     if curritem.units then
  951.       L(8) = curritem.units;
  952.     else
  953.       L(8) = player.iq + adjustments(player.iq);
  954.     endif;
  955.     L(9) = 0;
  956.   endif;
  957.  
  958.   if curritem.type = STAFF and curritem.charges = 0 then
  959.     writeln( "The ", curritem.name, " doesn't work.." );
  960.     return;
  961.   endif;
  962.      
  963.   if curritem.class <> LEAVE  and
  964.      curritem.class <> ZOOM   and
  965.      curritem.class <> INFORM and
  966.      curritem.class <> DOORS  and
  967.      curritem.class <> RESURRECT then
  968.     write( curritem.class, " what:" );
  969.     L(1) = locate;  ! SETS THE TARGET FOR THE SPELL ! 
  970.     if L(1) = 0 then
  971.       writeln( "nothing.." );
  972.       return;
  973.     endif;
  974.     ! Either NPC.COUNT or OBJECT.COUNT identifies selected object/char !
  975.     if npc.count then ! It's a character, not an object..
  976.       if npc.type = HOSTILE then
  977.         writeln( npc.name );  ! monster's don't have classes.. !
  978.       else
  979.         writeln( npc.class ); ! Human, elf, dwarf, etc..       !
  980.       endif;
  981.       if curritem.class = DESTROY  or curritem.class = DUPLICATE or
  982.          curritem.class = RECHARGE or curritem.class = FLOAT then
  983.         writeln( "This spell only work's on objects!" );
  984.         goto M2_EXIT;
  985.       endif;
  986.     else
  987.       writeln( object.type );  ! Food, weapon, ring, etc..      !
  988.     endif;
  989.   endif;
  990.  
  991.   on curritem.class goto 
  992.     M2_EXIT,     M2_DESTROY,  M2_DUPLICATE, M2_LEAVE,
  993.     M2_RESURRECT,M2_INFORM,   M2_LOCATE,    M2_KILL, 
  994.     M2_CONFUSE,  M2_SCARE,    M2_DAMAGE,    M2_PARALYZE,
  995.     M2_RECHARGE, M2_FLOAT,    M2_ANALYZE,   M2_ZOOM;
  996.  
  997. :M2_NONE      ! No magic..
  998.   writeln( "Nothing happens.." );
  999.   goto M2_EXIT;
  1000.  
  1001. :M2_DESTROY   ! Destroy an object                      pwr = 5, rng=10
  1002.   ! if player.pwr < 5 goto M2_NOPOWER; ! No power check needed
  1003.   if L(1) > 10 goto M2_OUTOFRANGE;
  1004.   voice( "Explode", 1000 );
  1005.   writeln( "The ", object.type, " is destroyed.." );
  1006.   vanish( object );
  1007.   L(4) = 5;
  1008.   goto M2_EXIT;
  1009.  
  1010. :M2_DUPLICATE ! Duplicates an object                   pwr = 40, rng=1
  1011.   ! if player.pwr < 40 goto M2_NOPOWER; ! No power check needed
  1012.   if L(1) > 1 goto M2_OUTOFRANGE;
  1013.   inc( object.count, 1 ); ! Creates an identical copy ! 
  1014.   L(4) = 40;
  1015.   goto M2_EXIT;
  1016.  
  1017. :M2_LEAVE     ! Exit through the 'exit' door from anywhere...  
  1018.   if world.type <> DUNGEON then
  1019.     voice( "Boing", 1000 );
  1020.     writeln( "This spell only work's in dungeons.." );
  1021.     return;
  1022.   endif;
  1023.   ! if player.pwr < 5 goto M2_NOPOWER; ! No power check needed
  1024.   enter( world.edgedoor );
  1025.   voice( "OkSpell", 1000 );
  1026.   writeln( "You leave this level of the dungeon.." );
  1027.   L(4) = 5;
  1028.   goto M2_EXIT;
  1029.  
  1030. :M2_RESURRECT ! Revive a DEAD person                   pwr = 50, rng=1
  1031.   ! if player.pwr < 50 goto M2_NOPOWER; ! No power check needed
  1032.   if L(1) > 1 goto M2_OUTOFRANGE;
  1033.   write( "Resurrect: " );
  1034.   L(0) = select( group );
  1035.   if player.hp > 0 then
  1036.     voice( "Boing", 1000 );
  1037.     writeln( "This player is NOT dead!" );
  1038.     return;
  1039.   endif;
  1040.   voice( "OkSpell", 1000 );
  1041.   writeln( player.name );
  1042.   player.hp  = 2;
  1043.   writeln( player.name, " is alive, but weak.." );
  1044.   L(4) = 50;
  1045.   goto M2_EXIT;
  1046.   
  1047. :M2_INFORM    ! Displays some text                     pwr =  5
  1048.   ! if player.pwr < 5 goto M2_NOPOWER; ! No power check needed
  1049.   if L(1) > 5 goto M2_OUTOFRANGE;
  1050.   loadhint;
  1051.   writeln( "The wind seems to carry a random phrase to your ears.." );
  1052.   writeln( s0 );
  1053.   L(4) = 5;
  1054.   goto M2_EXIT;
  1055.  
  1056. :M2_LOCATE    ! Locate doors                           pwr = 10
  1057.   ! if player.pwr < 10 goto M2_NOPOWER; ! No power check needed
  1058.   if L(1) > 10 goto M2_OUTOFRANGE;
  1059.   L(0) = 0;
  1060.   :LDLOOP
  1061.     if world.doorx(L0) > 0 and world.doory(L0) > 0 then
  1062.       frame( world.doorx(L0), world.doory(L0), SYS_FRAME );
  1063.     endif;
  1064.     inc(L0);
  1065.   if L(0) < 16 goto LDLOOP;
  1066.   L(4) = 10;
  1067.   goto M2_EXIT;
  1068.  
  1069. :M2_KILL      ! Kill 1 enemy during battle             pwr = 20, rng=6
  1070.   writeln( npc.name, " killed. +", npc.hp, " exp." );
  1071.   inc( player.exp, npc.hp );
  1072.   npc.hp = 0;
  1073.   STOP;
  1074.  
  1075. :M2_DAMAGE    ! Causes damage to monsters              pwr =  5, rng=12
  1076.   S0 = "hit";
  1077.   foreach npc do
  1078.     L(7) = min( npc.hp, random(L6) );  ! How much damage to this one monster?
  1079.     if L(7) > 0 then
  1080.       frame(npc.x, npc.y, SYS_SPLAT); wait(1); frame(npc.x, npc.y, SYS_SPLAT);
  1081.       write( npc.name );
  1082.       if L(7) < npc.hp then
  1083.         write( " hit." );
  1084.         dec( npc.hp, L(7) );           ! Hit the monster..
  1085.       else
  1086.         write( " killed!" );
  1087.         npc.hp = 0;
  1088.       endif;
  1089.       writeln( " +", L(7), " exp." );
  1090.       inc(L9);                       ! Count of affected npcs
  1091.       inc( L(5), L(7) );                 ! Accumulate experience..
  1092.       if L(5) > L(8) goto DCSPEXIT;      ! Stop when total of L(8) points used
  1093.     endif;
  1094.   endfor;  
  1095.   goto DCSPEXIT;
  1096.  
  1097. :M2_CONFUSE   ! Makes monsters shoot at other monsters pwr =  1, rng=12
  1098.   S0 = "confused";
  1099.   foreach npc do
  1100.     L(7) = min( npc.hp, random(L6) );  ! How much confusion to this one monster?
  1101.     if L(7) > 0 and npc.confused = 0 then
  1102.       frame(npc.x, npc.y, SYS_SPLAT); wait(1); frame(npc.x, npc.y, SYS_SPLAT);
  1103.       inc(L9);                       ! Count of affected npcs
  1104.       npc.confused = L(7);             ! Confuse for 'n' units
  1105.       inc( L(5), L(7) );                 ! Accumulate experience..
  1106.       if L(5) > L(8) goto DCSPEXIT;      ! Stop when total of L(8) points used
  1107.     endif;
  1108.   endfor;  
  1109.   goto DCSPEXIT;
  1110.  
  1111. :M2_SCARE     ! Scares monsters                        pwr =  2, rng=12
  1112.   S0 = "scared";
  1113.   foreach npc do
  1114.     L(7) = min( npc.hp, random(L6) );  ! How much 'fright' to this one monster?
  1115.     if L(7) > 0 and npc.scared = 0 then
  1116.       frame(npc.x, npc.y, SYS_SPLAT); wait(1); frame(npc.x, npc.y, SYS_SPLAT);
  1117.       inc(L9);
  1118.       npc.scared = L(7);               ! Frighten for 'n' units
  1119.       inc( L(5), L(7) );                 ! Accumulate experience..
  1120.       if L(5) > L(8) goto DCSPEXIT;      ! Stop when total of L(8) points used
  1121.     endif;
  1122.   endfor;  
  1123.   goto DCSPEXIT;
  1124.  
  1125. :M2_PARALYZE  ! Monster can't move                     pwr =  5, rng=12
  1126.   S0 = "paralyzed";
  1127.   foreach npc do
  1128.     L(7) = min( npc.hp, random(L6) );  ! How much paralysis to this one monster?
  1129.     if L(7) > 0 and npc.paralyzed = 0 then
  1130.       frame(npc.x, npc.y, SYS_SPLAT); wait(1); frame(npc.x, npc.y, SYS_SPLAT);
  1131.       inc(L9);
  1132.       npc.paralyzed = L(7);            ! Paralyze for 'n' units
  1133.       inc( L(5), L(7) );                 ! Accumulate experience..
  1134.       if L(5) > L(8) goto DCSPEXIT;      ! Stop when total of L(8) points used
  1135.     endif;
  1136.   endfor;  
  1137.   goto DCSPEXIT;
  1138.  
  1139. :M2_RECHARGE  ! Recharge an ITEM                       pwr = 25, rng=1
  1140.   ! if player.pwr < 25 goto M2_NOPOWER; ! No power check needed
  1141.   if L(1) > 1 goto M2_OUTOFRANGE;
  1142.   if object.type = RING or object.type = AMULET or object.type = STAFF then
  1143.     inc( object.charges, random(player.level)+1 );
  1144.     voice( "OkSpell", 1000 );
  1145.     writeln( "The ", object.type, " now has ", object.charges, " charges." );
  1146.   else
  1147.     voice( "Boing", 1000 );
  1148.     writeln( "The smell of rotten eggs fills the air.." );
  1149.   endif;
  1150.   L(4) = 25;
  1151.   goto M2_EXIT;
  1152.  
  1153. :M2_FLOAT     ! Remove an object's weight              pwr = 10, rng=1
  1154.   ! if player.pwr < 10 goto M2_NOPOWER; ! No power check needed
  1155.   if L(1) > 1 goto M2_OUTOFRANGE;
  1156.   if object.weight < 255 then
  1157.     object.weight = object.weight / 2 + 1;
  1158.     voice( "OkSpell", 1000 );
  1159.     writeln( "The ", object.type, " is now much lighter.." );
  1160.   else
  1161.     voice( "Boing", 1000 );
  1162.     writeln( "It's didn't work.  The ", object.type, " is too heavy." );
  1163.   endif;
  1164.   L(4) = 10;
  1165.   goto M2_EXIT;
  1166.  
  1167. :M2_ANALYZE   ! Discover object's properties           pwr = 10, rng=1
  1168.   ! if player.pwr < 10 goto M2_NOPOWER; ! No power check needed
  1169.   if L(1) > 1  goto M2_OUTOFRANGE;
  1170.   L(255) = TRUE;   ! Give DETAILED description !
  1171.   gosub DESCRIBE;
  1172.   L(4) = 10;
  1173.   goto M2_EXIT;
  1174.  
  1175. :M2_ZOOM      ! View the world.. 
  1176.   ! if player.pwr < 25 goto M2_NOPOWER; ! No power check needed
  1177.   viewpcx( world );
  1178.   if success then
  1179.     pause;
  1180.   endif;
  1181.   paint( screen ); ! If you don't have any WORLD###.PCX files, you can use !
  1182.                    ! paint( WINDOW ) instead of paint( SCREEN) !
  1183.   L(4) = 25;
  1184.   goto M2_EXIT;
  1185.  
  1186. :M2_NOPOWER
  1187.   writeln( "You don't have enough power!" );
  1188.   return;
  1189.  
  1190. :M2_OUTOFRANGE
  1191.   writeln( "You are too far away from the ", object.name );
  1192.   return;
  1193.  
  1194. :DCSPEXIT
  1195.   if L(9) then
  1196.     write( L(9), " foes were ", S0 );
  1197.     if L(5) then  
  1198.       writeln( " for a total of +", L(5), " experience!" );
  1199.       inc( player.exp, L(5) );           ! Grant experience..
  1200.     else
  1201.       writeln( " With no effect" );
  1202.     endif;
  1203.   else
  1204.     writeln( "No effect.." );
  1205.   endif;
  1206.   goto M2_EXIT;
  1207.  
  1208. :M2_EXIT
  1209.   if curritem.count > 0 then
  1210.     if curritem.count > 1 then
  1211.       curritem.name = curritem.class;
  1212.     endif;
  1213.     if curritem.type = SCROLL then
  1214.       dec( curritem.count ); ! Item disapears if count reaches 0 !
  1215.     elsif curritem.type = STAFF then
  1216.       dec( curritem.charges ); ! One less !
  1217.     endif;
  1218.   else
  1219.     dec( player.pwr, L(4) );   ! A spell !
  1220.   endif;
  1221.   return;
  1222.  
  1223.