This is the code for the engine. Running it on its own won't quite work....
It needs to first be saved as a .pas file. Follow the instructions at the top of the 'Dungeon' game
file (which can also be found at 'www.iamafish.F2S.com') to utilise this engine.
This game was designed and made by Martin 'Fish' Hutchinson, 2001, and is not copyrighted in any way, shape of form.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you decide to use, amend or distribute this program, I just ask that you mention my name ('Martin "Fish" Hutchinson') as developer, leave this message in full here and also that you E-Mail me telling me what has been done and where on the internet it can be found. I also ask that no costs are charged other than costs of distribution to other users (without consulting me first to negotiate a cut that is.....).
Thank You.
P.S. This code is quite hard to follow, so if you can't quite follow it, E-Mail me ('[email protected]' or '[email protected]') and I will try to explain how to go about creating your own level.
I would also appreciate an E-Mail saying what you thought of this game, any-thing which could be improved
to make it more playable, or any bugs which you discover when playing. 
Copy and paste below line into Pascal to use.
------------------------------------------------------------------------------------------------
unit details;
interface
uses wincrt,strings,windos;
type
     room = record
          number:integer;
          name:string[25];
          description1,description2,description3,var_desc1,var_desc2:string[60];
          north:integer;
          NStat:char;
          south:integer;
          SStat:char;
          east:integer;
          EStat:char;
          west:integer;
          WStat:char;
          varshow:integer;
          item1:integer;
          Stat1:char;
          item2:integer;
          Stat2:char;
          item3:integer;
          Stat3:char;
          used:char;
          search1:integer;
          search2:integer;
          enemy:integer;
     end;
     item = record
          number:integer;
          name,name2,name3:string[20];
          description:string[80];
          usage:char;
          use1:shortint;
          use2:shortint;
          use_desc,use_desc2:string[80];
          attack_points:integer;
          defend_points:integer;
          arm_type:integer;
          affects:integer;
          oneuse:char;
     end;
    enemy = record
          number:integer;
          name:string[20];
          health:integer;
          attack:integer;
          defend:integer;
    end;
    search_item = record
                number:integer;
                name,name2,name3:string[20];
                description:string[50];
                item1:shortint;
                item2:shortint;
    end;
var
   rooms:array[1..60] of room;
   items:array[0..20] of item;
   search_items:array[1..10] of search_item;
   next_room:integer;
   command: string[79];
   inventory:array[1..10] of integer;
   wielding:integer;
   wearing:array[1..3] of integer;
   input:array[0..79] of Char;
   counter:integer;
   health:integer;
   player_damage:integer;
   player_armour:integer;
   enemies:array[0..40] of enemy;
   current_enemy,no_exits:integer;
   reinitialise:char;
   continue:char;
procedure show_inventory;
procedure story;
procedure help;
procedure main_menu;
procedure use;
procedure look;
procedure get;
procedure wear;
procedure wield;
procedure entry;
procedure combat;
procedure display_screen;
implementation
procedure show_inventory;
var
loop,loop2:integer;
begin
     clrscr;
     writeln('Inventory');
     writeln('~~~~~~~~~');
     writeln;
     for loop:=0 to 20 do
     if inventory[1] = items[loop].number then writeln('Item 1  = ',items[loop].name);
     for loop:=0 to 20 do
     if inventory[2] = items[loop].number then writeln('Item 2  = ',items[loop].name);
     for loop:=0 to 20 do
     if inventory[3] = items[loop].number then writeln('Item 3  = ',items[loop].name);
     for loop:=0 to 20 do
     if inventory[4] = items[loop].number then writeln('Item 4  = ',items[loop].name);
     for loop:=0 to 20 do
     if inventory[5] = items[loop].number then writeln('Item 5  = ',items[loop].name);
     for loop:=0 to 20 do
     if inventory[6] = items[loop].number then writeln('Item 6  = ',items[loop].name);
     for loop:=0 to 20 do
     if inventory[7] = items[loop].number then writeln('Item 7  = ',items[loop].name);
     for loop:=0 to 20 do
     if inventory[8] = items[loop].number then writeln('Item 8  = ',items[loop].name);
     for loop:=0 to 20 do
     if inventory[9] = items[loop].number then writeln('Item 9  = ',items[loop].name);
     for loop:=0 to 20 do
     if inventory[10] = items[loop].number then writeln('Item 10 = ',items[loop].name);
     writeln;
     writeln('Stats');
     writeln('~~~~~');
     writeln;
     writeln('Health = ',health);
     writeln('Weapon = ',player_damage);
     writeln('Armour = ',player_armour);
     writeln;
     writeln('Current Weapon ==> ',items[wielding].name);
     writeln;
     writeln('Current Armour:');
     writeln('Head   ==> ',items[wearing[1]].name);
     writeln('Shield ==> ',items[wearing[2]].name);
     writeln('Body   ==> ',items[wearing[3]].name);
     readln;
end;
procedure story;
begin
     clrscr;
     write('I am a mole and I live in a hole!');
     readln;
end;
procedure help;
begin
     clrscr;
     writeln('This help file is designed for people who:');
     writeln;
     writeln('* Have never played this type of game before');
     writeln('* Have the memory span of a gnat');
     writeln('* Are just plain stupid and can`t work it out anyway!');
     readln;
     clrscr;
     writeln('There are only a few commands in this game:');
     writeln;
     writeln('* `north` or `n` - directs player north');
     writeln;
     writeln('* `east`, `e`, `south`, `s`, `west` or `w` - work it out...');
     writeln;
     writeln('* `get <item>` - pick up item, where <item> is mentioned in text');
     writeln;
     writeln('* `inv` - views current inventory');
     writeln;
     writeln('* `look <item>` - similar to `get` command');
     writeln;
     writeln('* `drop <item>` - opposite to `get` command.');
     writeln;
     writeln('* `wield <item>` - if you have a weapon in your inventory, this command');
     writeln('                   equips it, so increasing your attack score');
     writeln;
     writeln('* `wear <item>` - similar to `wield`, but for use with armour and shields');
     writeln;
     writeln('* `use <item>` - uses an item from your inventory if possible');
     writeln;
     writeln('* `search <item>` - lets you nosy through an item mentioned in text');
     writeln;
     writeln('* `remove <item>` - stop wielding/wearing <item>, allowing you to make');
     writeln('                    use of better weponry/armour');
     readln;
end;
procedure main_menu;
var
   choice:shortint;
begin
     repeat
     clrscr;
     writeln('Hello and Welcome to my little game!');
     writeln;
     writeln('Choose your option:');
     writeln;
     writeln('1..........Play Game');
     writeln('2..........Read Story');
     writeln('3..........View Help');
     writeln;
     write('Option ==> ');
     readln(choice);
     if choice=2 then story;
     if choice=3 then help;
     until choice=1;
end;
procedure drink;
var
   loop,loop2,loop3:integer;
   search:PChar;
   LookFor:array[0..20] of Char;
   found:char;
begin
     found:='n';
     for loop:=1 to 10 do
     begin
          StrPCopy(LookFor,items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if (search<>nil) and (items[loop].usage='p') then for loop2:=1 to 10 do
          begin
               if (inventory[loop2]=items[loop].number) then
               begin
                    health:=health+items[loop].defend_points;
                    if health>50 then health:=50;
                    inventory[loop2]:=0;
                    writeln('You drink the ',items[loop].name,'.');
                    readln;
                    for loop3:=loop2 to counter-1 do
                    inventory[loop3]:=inventory[loop3+1];
                    counter:=counter-1;
               end;
          if (search<>nil) and (items[loop].usage<>'p') then
          begin
               writeln('You can`t drink that!');
               readln;
          end;
          end;
     end;
end;
procedure use;
var
   loop,loop2,loop3,roomloop:integer;
   search:PChar;
   LookFor:array[0..30] of Char;
   found,used:char;
begin
     used:='n';
     found:='n';
     for loop:=1 to 20 do
     begin
          StrPCopy(LookFor,items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          with items[loop] do
if (search<>nil) and ((usage='i') or (usage='k') or (usage='r') or (usage='1') or (usage='2')) then for loop2:=1 to 10 do
               if inventory[loop2]=items[loop].number then with items[loop] do
               begin
                    found:='y';
                    if use1=next_room then
                    begin
                         used:='y';
                         writeln('You use the ',name);
                         writeln(use_desc);
                         writeln(use_desc2);
                         readln;
                         if oneuse='y' then
                         begin
                              for loop3:=loop2 to counter-1 do
                              inventory[loop3]:=inventory[loop3+1];
                              counter:=counter-1;
                         end;
                         if oneuse='p' then
                         begin
                              with rooms[next_room] do
                              begin
                                   if item1=0 then item1:=inventory[loop2] else
                                   if item2=0 then item1:=inventory[loop2] else
                                   if item3=0 then item1:=inventory[loop2];
                              end;
                              for loop3:=loop2 to counter-1 do
                              inventory[loop3]:=inventory[loop3+1];
                              counter:=counter-1;
                         end;
                         
                         if (usage='k') then with rooms[next_room] do
                         begin
                              NStat:='o';
                              EStat:='o';
                              SStat:='o';
                              WStat:='o';
                              varshow:=2;
                         end
                         else
                         if (usage='1') then with rooms[next_room] do
                         begin
                              used:='y';
                         end
                         else
                         if (usage='2') then with rooms[next_room] do
                         begin
                              if used='y' then
                              begin
                                   NStat:='o';
                                   EStat:='o';
                                   SStat:='o';
                                   WStat:='o';
                                   varshow:=2;
                              end;
                         end
                         else
                         if (usage='i') then with rooms[next_room] do
                         begin
                              stat1:='u';
                              stat2:='u';
                              stat3:='u';
                              varshow:=2;
                         end
                         else
                         if (usage='r') then with rooms[affects] do
                         begin
                              NStat:='o';
                              EStat:='o';
                              SStat:='o';
                              WStat:='o';
                              rooms[next_room].varshow:=2;
                         end;
                    end
                    else
                    if use2=next_room then
                    begin
                         used:='y';
                         writeln('You use the ',name);
                         writeln(use_desc);
                         writeln(use_desc2);
                         readln;
                         
                         if (usage='k') then with rooms[next_room] do
                         begin
                              NStat:='o';
                              EStat:='o';
                              SStat:='o';
                              WStat:='o';
                              varshow:=2;
                         end
                         else
                         if (usage='r') then with rooms[affects] do
                         begin
                              NStat:='o';
                              EStat:='o';
                              SStat:='o';
                              WStat:='o';
                              varshow:=2;
                         end
                         else
                         if (usage='i') then with rooms[next_room] do
                         begin
                              stat1:='u';
                              stat2:='u';
                              stat3:='u';
                              varshow:=2;
                         end;
                    end;                    
               end;         


          if (search<>nil) and (items[loop].usage='a') then
          begin
               write('You WIELD a ',items[loop].name,'!');
               found:='y';
               readln;
          end;
          if (search<>nil) and (items[loop].usage='d') then
          begin
               write('You WEAR a ',items[loop].name,'!');
               found:='y';
               readln;
          end;
     end;
     if found='n' then
     begin
     write('You don`t have one of those to use!');
     readln;
     end;
     if (found='y') and (used='n') then
          begin
          write('You can`t use that here!');
          readln;
     end;
end;
procedure look;
var
   loop,loop2:integer;
   search:PChar;
   LookFor:array[0..30] of Char;
   found:char;
begin
     found:='n';
     for loop:=1 to 20 do
     begin
          StrPCopy(LookFor,items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if (search<>nil) then with rooms[next_room] do
       begin
          if item1=items[loop].number then
          begin
          write(items[loop].description);
          readln;
          found:='y';
          end;
          if item2=items[loop].number then
          begin
          write(items[loop].description);
          readln;
          found:='y';
          end;
          if item3=items[loop].number then
          begin
          write(items[loop].description);
          readln;
          found:='y';
          end;
          for loop2:=1 to 10 do
          begin
               if inventory[loop2]=items[loop].number then
               begin
               write(items[loop].description);
               readln;
               found:='y';
               end;
          end;
       end;
     end;
    if found='n' then
    for loop:=1 to 10 do
    begin
          StrPCopy(LookFor,search_items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,search_items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,search_items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if (search<>nil) then with rooms[next_room] do
          begin
          if search1=search_items[loop].number then
          begin
          write(search_items[loop].description);
          readln;
          found:='y';
          end;
          if search2=search_items[loop].number then
          begin
          write(search_items[loop].description);
          readln;
          found:='y';
          end;        
          end;
    end;
    if found='n' then
     begin
          write('This item is not here');
          readln;
     end;
end;
procedure get;
var
   loop,loop2:integer;
   search:PChar;
   LookFor:array[0..20] of Char;
   found,found2:char;
begin
     found:='n';
     if inventory[10]<>0 then
     begin
          writeln('You haven`t got enough room!');
          readln;
     end;
     if inventory[10]=0 then
     for loop:=1 to 20 do
     begin
          StrPCopy(LookFor,items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if (search<>nil) then with rooms[next_room] do
          begin
          if item1=items[loop].number then
          begin
          writeln('You got the ',items[loop].name);
          inventory[counter]:=item1;
          item1:=0;
          found:='y';
          counter:=counter+1;
          end;
          if item2=items[loop].number then
          begin
          writeln('You got the ',items[loop].name);
          inventory[counter]:=item2;
          item2:=0;
          found:='y';
          counter:=counter+1;
          end;
          if item3=items[loop].number then
          begin
          writeln('You got the ',items[loop].name);
          inventory[counter]:=item3;
          item3:=0;
          found:='y';
          counter:=counter+1;
          end;
          end;
     end;
     if found='n' then
     begin
          for loop:=1 to 10 do
     begin
          StrPCopy(LookFor,search_items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,search_items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,search_items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if (search<>nil) then with rooms[next_room] do
          begin
          if search1=search_items[loop].number then
          begin
          writeln('You can`t get that!');
          found:='y';
          end;
          if search2=search_items[loop].number then
          begin
          writeln('You can`t get that!');
          found:='y';
          end;
          end;
     end;
     end;
              
     if found='n' then
     write('This item is not here');
     readln;
end;
procedure wear;
var
   loop,loop2,loop3:integer;
   search:PChar;
   LookFor:array[0..20] of Char;
   found:char;
begin
     found:='n';
     for loop:=1 to 10 do
     begin
          StrPCopy(LookFor,items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if (search<>nil) and (items[loop].usage='d') then for loop2:=1 to 10 do
          begin
               if (inventory[loop2]=items[loop].number) and (wearing[items[loop].arm_type]=0) then
               begin
                    player_armour:=player_armour+items[loop].defend_points;
                    wearing[items[loop].arm_type]:=items[loop].number;
                    inventory[loop2]:=0;
                    writeln('You use the ',items[loop].name,' as armour');
                    readln;
                    for loop3:=loop2 to counter-1 do
                    inventory[loop3]:=inventory[loop3+1];
                    counter:=counter-1;
               end;
               if (inventory[loop2]=items[loop].number) and (wearing[items[loop].arm_type]<>0) then
               begin
                    writeln('You need to remove the ',items[wearing[items[loop].arm_type]].name,' first!');
                    readln;
               end;
          end;
          if (search<>nil) and (items[loop].usage<>'d') then
          begin
               writeln('You can`t wear that!');
               readln;
          end;
     end;
end;
procedure drop;
var
   loop,loop2,loop3:integer;
   search:PChar;
   LookFor:array[0..20] of Char;
   found:char;
   dropped:char;
begin
     dropped:='y';
     found:='n';
     for loop:=1 to 20 do
     begin
          StrPCopy(LookFor,items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if (search<>nil) then with rooms[next_room] do
          for loop2:=1 to 10 do
          if inventory[loop2]=items[loop].number then
          begin
          if item1=0 then item1:=inventory[loop2] else
          if item2=0 then item2:=inventory[loop2] else
          if item3=0 then item3:=inventory[loop2] else
          begin
               write('You can`t drop any more in this room');
               dropped:='n';
          end;
          found:='y';
          if dropped='y' then
          begin
          for loop3:=loop2 to counter-1 do
                    inventory[loop3]:=inventory[loop3+1];
          counter:=counter-1;
          write('You drop the ',LookFor);
          end;
          end;
    end;
    if found='n' then write('You don`t have this item to drop!');
    readln;
end;
procedure wield;
var
   loop,loop2,loop3:integer;
   search:PChar;
   LookFor:array[0..20] of Char;
   found:char;
begin
     found:='n';
     for loop:=1 to 20 do
     begin
          StrPCopy(LookFor,items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if (search<>nil) and (items[loop].usage='a') then for loop2:=1 to 10 do
          begin
               if (inventory[loop2]=items[loop].number) and (wielding=0) then
               begin
                    player_damage:=player_damage+items[loop].attack_points;
                    wielding:=items[loop].number;
                    writeln('You wield the ',items[loop].name);
                    readln;
                    for loop3:=loop2 to counter-1 do
                    inventory[loop3]:=inventory[loop3+1];
                    counter:=counter-1;
               end;
               if (inventory[loop2]=items[loop].number) and (wielding<>0) then
               begin
               writeln('You`re already wielding something!');
               readln;
               end;
          end;
          if (search<>nil) and (items[loop].usage<>'a') then
          begin
               writeln('You can`t wield that!');
               readln;
          end;
     end;
end;
procedure remove;
var
   loop,loop2,loop3:integer;
   search:PChar;
   LookFor:array[0..20] of Char;
   found:char;
begin
     found:='n';
     for loop:=1 to 20 do
     begin
          StrPCopy(LookFor,items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if (search<>nil) and (items[loop].usage='a') then for loop2:=1 to 10 do
          begin
               if wielding=items[loop].number then
               begin
                    player_damage:=player_damage-items[loop].attack_points;
                    wielding:=0;
                    writeln('You remove the ',items[loop].name);
                    readln;
                    inventory[counter]:=items[loop].number;
                    counter:=counter+1;
               end;          
          end;
          if (search<>nil) and (items[loop].usage='d') then for loop2:=1 to 3 do
          begin
               if wearing[loop2]=items[loop].number then
               begin
                    player_armour:=player_armour-items[loop].defend_points;
                    wearing[loop2]:=0;
                    writeln('You remove the ',items[loop].name);
                    readln;
                    inventory[counter]:=items[loop].number;
                    counter:=counter+1;
               end;          
          end;
     end;
end;
procedure search;
var
   loop:integer;
   search:PChar;
   LookFor:array[0..20] of Char;
   found:char;
begin
     found:='n';
     for loop:=1 to 10 do
     begin
          StrPCopy(LookFor,search_items[loop].name);
          search:=StrPos(input,LookFor);
          if search=nil then
          begin
               StrPCopy(LookFor,search_items[loop].name2);
               search:=StrPos(input,LookFor);
          end;
          if search=nil then
          begin
               StrPCopy(LookFor,search_items[loop].name3);
               search:=StrPos(input,LookFor);
          end;
          if search<>nil then with rooms[next_room] do
          begin
               if (search1=loop) and (search_items[loop].item1=0) then
               begin
                    writeln('The ',search_items[loop].name,' contains nothing');
                    readln;
                    found:='y';
               end;
               if (search1=loop) and (search_items[loop].item1>0) then
               begin
                    found:='y';
                    writeln('The ',search_items[loop].name,' contains the following:');
                    writeln;
                    writeln('* ',items[search_items[loop].item1].name);
                    if search_items[loop].item2>0 then writeln('* ',items[search_items[loop].item2].name);
                    writeln;
                    write('Do you wish to get the item(s)? ');
                    if readkey='y' then
                    begin
                         clrscr;
                         inventory[counter]:=search_items[loop].item1;
                         search_items[loop].item1:=0;
                         counter:=counter+1;
                         if search_items[loop].item2>0 then
                         begin
                              inventory[counter]:=search_items[loop].item1;
                              search_items[loop].item1:=0;
                              counter:=counter+1;
                         end;
                    end;                       
               end;
               if (search2=loop) and (search_items[loop].item1=0) then
               begin
                    writeln('The ',search_items[loop].name,' contains nothing');
                    readln;
                    found:='y';
               end;
               if (search2=loop) and (search_items[loop].item1>0) then
               begin
                    found:='y';
                    writeln('The ',search_items[loop].name,' contains the following:');
                    writeln;
                    writeln('* ',items[search_items[loop].item1].name);
                    if search_items[loop].item2>0 then writeln('* ',items[search_items[loop].item2].name);
                    writeln;
                    write('Do you wish to get the item(s)? ');
                    if readkey='y' then
                    begin
                         clrscr;
                         inventory[counter]:=search_items[loop].item1;
                         search_items[loop].item1:=0;
                         counter:=counter+1;
                         if search_items[loop].item2>0 then
                         begin
                              inventory[counter]:=search_items[loop].item1;
                              search_items[loop].item1:=0;
                              counter:=counter+1;
                         end;
                    end;                       
               end;
          end;               
     end;
     if found='n' then begin
     write('This isn`t here!');
     readln;
     end;
end;
procedure dead;
begin
     repeat
     clrscr;
     if health<=0 then
     begin
     writeln('Unlucky, you have died');
     writeln;
     end;
     write('Do you wish to play again? ');
     continue:=readkey;
     if continue='y' then
     begin
          reinitialise:='y';
          next_room:=1;
     end;
     until (continue='y') or (continue='n');
end;
procedure entry;
var
   get_check,use_check,drop_check:Pchar;
   look_check,wield_check,wear_check:Pchar;
   check:array[0..10] of char;
   check1:string;
begin
     if command='n' then command:='north';
     if command='e' then command:='east';
     if command='s' then command:='south';
     if command='w' then command:='west';
     if command='North' then command:='north';
     if command='East' then command:='east';
     if command='South' then command:='south';
     if command='West' then command:='west';
     if command='N' then command:='north';
     if command='E' then command:='east';
     if command='S' then command:='south';
     if command='W' then command:='west';
     if (command='inv') or (command='inventory') then show_inventory;
     check1:='get ';
     strpcopy(check,check1);
     StrPCopy(input,command);
     get_check:=StrPos(input,check);
     if get_check<>nil then get;
     if get_check=nil then
     begin
     check1:='look ';
     StrPCopy(check,check1);
     StrPCopy(input,command);
     look_check:=StrPos(input,check);
     if look_check<>nil then look;
     if look_check=nil then
     begin
     check1:='wield ';
     StrPCopy(check,check1);
     StrPCopy(input,command);
     wield_check:=StrPos(input,check);
     if wield_check<>nil then wield;
     if wield_check=nil then
     begin
     check1:='wear ';
     StrPCopy(check,check1);
     StrPCopy(input,command);
     wear_check:=StrPos(input,check);
     if wear_check<>nil then wear;
     if wield_check=nil then
     begin
     check1:='use ';
     StrPCopy(check,check1);
     StrPCopy(input,command);
     use_check:=StrPos(input,check);
     if use_check<>nil then use;
     if use_check=nil then
     begin
     check1:='drop ';
     StrPCopy(check,check1);
     StrPCopy(input,command);
     drop_check:=StrPos(input,check);
     if drop_check<>nil then drop;
     if drop_check=nil then
     begin
     check1:='search ';
     StrPCopy(check,check1);
     StrPCopy(input,command);
     drop_check:=StrPos(input,check);
     if drop_check<>nil then search;
     if drop_check=nil then
     begin
     check1:='remove ';
     StrPCopy(check,check1);
     StrPCopy(input,command);
     drop_check:=StrPos(input,check);
     if drop_check<>nil then remove;
     if drop_check=nil then
     begin
     check1:='drink ';
     StrPCopy(check,check1);
     StrPCopy(input,command);
     drop_check:=StrPos(input,check);
     if drop_check<>nil then drink;
     if drop_check=nil then
     begin
     check1:='quit';
     StrPCopy(check,check1);
     StrPCopy(input,command);
     drop_check:=StrPos(input,check);
     if drop_check<>nil then dead;
     end;
     end;
     end;
     end;
     end;
     end;
     end;
     end;
     end;     
end;
procedure combat;
var
   loop:integer;
   enemy_health:integer;
   damage:integer;
begin
     enemy_health:=enemies[current_enemy].health;
     randomize;
     clrscr;
     repeat
     clrscr;
     writeln('You hit the ',enemies[current_enemy].name);
     damage:=random(player_damage)-enemies[current_enemy].defend;
     if damage>0 then
        enemy_health:=enemy_health-damage;
     if damage<0 then damage:=0;
     writeln('You inflict ',damage,' damage, it now has ',enemy_health,' health.');
     writeln;
     if enemy_health>0 then
     begin
          writeln('The ',enemies[current_enemy].name,' hits you!');
          damage:=random(enemies[current_enemy].attack)-player_armour;
          if damage>0 then
             health:=health-damage;
          if damage<0 then damage:=0;
          writeln('The ',enemies[current_enemy].name,' inflicts ',damage,' damage, you now have ',health,' health.');
     end;
     readln;
     until (enemy_health<=0) or (health<=0);
     rooms[next_room].enemy:=0;
     if health<=0 then dead;
end;
procedure count_exits;
begin
     with rooms[next_room] do
     begin
          no_exits:=0;
          if (north<>0) and (Nstat<>'l') then no_exits:=no_exits+1;
          if (east<>0) and (Estat<>'l') then no_exits:=no_exits+1;
          if (south<>0) and (Sstat<>'l') then no_exits:=no_exits+1;
          if (west<>0) and (Wstat<>'l') then no_exits:=no_exits+1;
     end;
end;
procedure display_screen;
var
   direction:string;
   current_room,count:integer;
begin
     repeat
     with rooms[next_room] do
     begin
          count:=0;
          current_room:=next_room;
          if enemy>0 then
          begin
          writeln('WATCH OUT! A ',enemies[enemy].name,' is coming towards you!');
          writeln('You will have to fight...');
          readln;
          current_enemy:=enemy;
          combat;
          end;
          if (continue='y') or (continue='n') then
          begin
          writeln;
          writeln('Thank you for playing!');
          if continue='n' then readln;
          end
          else
          begin
          clrscr;
          writeln(Name);
          writeln('~~~~~~~~~~~~~~~~~~~~~~~~~');
          writeln;
          writeln(description1);
          writeln(description2);
          writeln(description3);
          writeln;
          if varshow=1 then writeln(var_desc1);
          if varshow=2 then writeln(var_desc2);
          if (item1>0) and (stat1<>'h') then
          begin
          write('There is a ');
          write(items[item1].name);
          writeln(' here.');
          end;
          if (item2>0) and (stat2<>'h') then
          begin
          write('There is a ');
          write(items[item2].name);
          writeln(' here.');
          end;
          if (item3>0) and (stat3<>'h') then
          begin
          write('There is a ');
          write(items[item3].name);
          writeln(' here.');
          end;
          if (search1>0) then
          begin
          write('There is a ');
          write(search_items[search1].name);
          writeln(' here.');
          end;
          count_exits;
          if (search2>0) then
          begin
          write('There is a ');
          write(search_items[search2].name);
          writeln(' here.');
          end;
          count_exits;
          if no_exits=0 then write('There are no exits');
          if no_exits=1 then
          begin
               write('There is an exit to the ');
               if (north<>0) and (Nstat<>'l') then write('North');
               if (east<>0) and (Estat<>'l') then write('East');
               if (south<>0) and (sstat<>'l') then write('South');
               if (west<>0) and (wstat<>'l') then write('West');
          end;
          if no_exits=2 then
          begin
               write('There are exits to the ');
               if (north<>0) and (Nstat<>'l') then
               begin
               write('North and ');
               count:=count+1;
               end;
               if (east<>0) and (Estat<>'l') then
               begin
               write('East');
               count:=count+1;
               if count<2 then write(' and ');
               end;
               if (south<>0) and (sstat<>'l') then
               begin
               write('South');
               count:=count+1;
               if count<2 then write(' and ');
               end; 
               if (west<>0) and (wstat<>'l') then write('West');
          end;
          if no_exits=3 then
          begin
               write('There are exits to the ');
               if (north<>0) and (Nstat<>'l') then
               begin
               write('North and ');
               count:=count+1;
               end;
               if (east<>0) and (Estat<>'l') then
               begin
               write('East');
               count:=count+1;
               if count=2 then write(' and ');
               if count=1 then write(', ');
               end;
               if (south<>0) and (sstat<>'l') then
               begin
               write('South');
               count:=count+1;
               if count=2 then write(' and ');
               end; 
               if (west<>0) and (wstat<>'l') then write('West');
          end;
          if no_exits=4 then
          begin
               write('There are exits to the ');
               if (north<>0) and (Nstat<>'l') then
               begin
               write('North, ');
               count:=count+1;
               end;
               if (east<>0) and (Estat<>'l') then
               begin
               write('East');
               count:=count+1;
               if (count=1) or (count=2) then write(', ');
               if count=3 then write(' and ');
               end;
               if (south<>0) and (sstat<>'l') then
               begin
               write('South');
               count:=count+1;
               if (count=1) or (count=2) then write(', ');
               if count=3 then write(' and ');
               end; 
               if (west<>0) and (wstat<>'l') then write('West');
          end;
          writeln;
          if nstat='l' then writeln('There is a locked door to the North');
          if estat='l' then writeln('There is a locked door to the East');
          if sstat='l' then writeln('There is a locked door to the South');
          if wstat='l' then writeln('There is a locked door to the West');
          writeln;
          writeln('What do you want to do? ');
          readln(command);
          entry;
          if (command='north') and (NStat<>'l') then next_room:=north;
          if (command='north') and (NStat='l') then
          begin
          writeln('There is a locked door there!');
          readln;
          end;
          if (command='east') and (EStat<>'l') then next_room:=east;
          if (command='east') and (eStat='l') then
          begin
          writeln('There is a locked door there!');
          readln;
          end;
          if (command='west') and (WStat<>'l') then next_room:=west;
          if (command='west') and (wStat='l') then
          begin
          writeln('There is a locked door there!');
          readln;
          end;
          if (command='south') and (SStat<>'l') then next_room:=south;
          if (command='west') and (sStat='l') then
          begin
          writeln('There is a locked door there!');
          readln;
          end;
          if next_room=0 then
          begin
          writeln('There is a wall in that direction!');
          readln;
          next_room:=current_room;
          end;
          end;
     end;
     until (next_room=100) or (continue='n') or (continue='y');
end;
end.
Hosted by www.Geocities.ws

1