pascal can't find CTR.Tpu - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

pascal can't find CTR.Tpu

nikaotonikaoto Posts: 5Member
hi,
guys.


i have a little problem with B.P.(also known as Borand Pascal.)
i created a program which is an RPG game.every time i try to compile it, it writes'file not found CTR.Tpu'.i think i don't have the file which is needed to compile the program.i've searched everywhere for the file but i just couldn't find it.Can anybody help me please???
heres the program:

program RPG;
uses
ctr, sysutlis,
cthreads,
classes
type
creature = record
Name:string;
Armor,Health,Magic,Power:integer;
end;
var
Hero, Dragon, Spider, LargeSpider, Opponent:creature;
enemNum:integer;
selection:string;
score:integer;
procedure LoadSettings;
begin
score := 0;
with Hero do
begin
Name:= 'hero nika';
Armor := 2;
Health :=10;
Magic := 2;
Power := 5;
end;
with Dragon do
begin
Name:= 'Dragon';
Armor := 3;
Health := 5;
Magic := 2;
Power := 4;
end;
with Spider do
begin
Name:= 'Spider';
Armor :=0;
Health :=1;
Magic :=0;
Power :=2;
end;
with LargeSpider do
begin
Name:= 'LargeSpider';
Armor :=4;
Health :=2;
Magic :=1;
Power :=3
end;
end;
procedure GetEnemy;
begin
randomize;
enemNum := random(3) + 1;
if enemNum = 1 then opponent:=Spider else if enemNum =2 then opponent :=LargeSpider;
end;
procedure WriteStats;
begin
with Hero do
begin
writeln(Name, ' score = ', score);
writeln('Health = ', Health);
writeln('Armor = ', Armor);
writeln('Magic = ',Magic);
writeln('Power = ',Power);
end;
writeln;
writeln;
with opponent do
writeln('Opponent ', Name);
writeln('Health = ', Health);
writeln('Armor = ',Armor);
writeln('Magic = ',Magic);
writeln('Power = ',Power);
end;
end;
procedure Menu;
begin
repeat writeln;
writeln('(F)ight');
writeln('(M)agic');
write('Selection: ');
readln(selection);
selection := UpperCase(selection);
randomize;
if selection = 'F' then
begin
Hero.Health := Hero.Health - random(opponent.Power +1);
opponent.Health := opponent.Health - random(Hero.Power + 1);
end
else if (selection = 'M') and (Hero.Magic >0) then
begin
opponent.Health := opponent.Health - 10;
Hero.Magic := Hero.Magic - 1;
if opponenet.Health > 0 then Hero.Health := Hero.Health - random(Opponent.Power + 1);
end;
until (Selecction = 'F') of (Selection = 'M');
end;
procedure Battle;
begin
GetEnemy;
repeat
clrscr();
WriteStats;
Menu;
until (Hero.Health <= 0) of (Opponent.Health <= 0);
if Opponent.Health <= 0 then
begin
writeln(Opponent.name, ' Was Killed');
score := score + Opponent.Power;
sleep(2000);
end;
end;
begin
repeat
LoadSettings;
repeat
Battle;
until Hero.Health <=0;
clrscr();
writeln(Hero.Name , ' Wai Killed');
writeln('Final Score: ', score);
repeat
write('Play Again Y/N: ');
readln(selection);
selection := UpperCase(selection);
until (selection = 'Y') or (selection = 'N');
until selection = 'N';
end.

posted by:nikaoto(11 years old)

Comments

  • quikcarlquikcarl Posts: 59Member
    It's always in the details and the details have to be right or it just won't work.

    : uses
    : ctr, sysutlis,
    : cthreads,
    : classes

    Try this to get it going again.
    [code] uses
    [color=Red]crt[/color], [color=Red]sysutils[/color],
    cthreads,
    classes[color=Red];[/color][/code]
  • nikaotonikaoto Posts: 5Member
    thank you for helping.i was trying to find the mistakes for weeks and you found it just in 10 minutes.


    thx for all!!!
    :)
  • nikaotonikaoto Posts: 5Member
    i tried to correct it but it wrote that it needed an identifier(this means that you couldn't solve the problem[SORRY])
  • _Atex__Atex_ Posts: 163Member
    : i tried to correct it but it wrote that it needed an identifier(this
    : means that you couldn't solve the problem[SORRY])
    :
    There were quite a few errors, mostly spelling ones, did you copy this from somewhere ? Anyway here's your code patched up:[code][color=Blue]program RPG;
    uses
    crt;


    type
    creature = record
    Name:string;
    Armor,Health,Magic,Power:integer;
    end;
    var Hero, Dragon, Spider, LargeSpider, Opponent:creature;
    enemNum:integer;
    selection:string;
    score:integer;

    procedure LoadSettings;
    begin
    score := 0;
    with Hero do begin
    Name:= 'hero nika';
    Armor := 2;
    Health :=10;
    Magic := 2;
    Power := 5;
    end;
    with Dragon do begin
    Name:= 'Dragon';
    Armor := 3;
    Health := 5;
    Magic := 2;
    Power := 4;
    end;
    with Spider do begin
    Name:= 'Spider';
    Armor :=0;
    Health :=1;
    Magic :=0;
    Power :=2;
    end;
    with LargeSpider do begin
    Name:= 'LargeSpider';
    Armor :=4;
    Health :=2;
    Magic :=1;
    Power :=3
    end;
    end;

    procedure GetEnemy;
    begin
    randomize;
    enemNum := random(3);
    case enemnum of
    0:opponent:=dragon;
    1:opponent:=spider;
    2:opponent:=largespider;
    end;
    end;


    procedure WriteStats;
    begin
    with Hero do begin
    writeln(Name, ' score = ', score);
    writeln('Health = ',Health);
    writeln('Armor = ',Armor);
    writeln('Magic = ',Magic);
    writeln('Power = ',Power);
    end;
    writeln;
    writeln;
    with opponent do begin
    writeln('Opponent ',Name);
    writeln('Health = ',Health);
    writeln('Armor = ',Armor);
    writeln('Magic = ',Magic);
    writeln('Power = ',Power);
    end;
    end;

    function uppercase(s:string):string;
    var i:byte;sl:byte absolute s;
    begin for i:=1 to sl do s[i]:=upcase(s[i]);uppercase:=s;end;


    procedure Menu;
    begin
    repeat
    writeln;
    writeln('(F)ight');
    writeln('(M)agic');
    write('Selection: ');
    readln(selection);
    selection := UpperCase(selection);
    randomize;
    if selection = 'F' then begin
    Hero.Health := Hero.Health - random(opponent.Power +1);
    opponent.Health := opponent.Health - random(Hero.Power + 1);
    end else if (selection = 'M') and (Hero.Magic >0) then begin
    opponent.Health := opponent.Health - 10;
    Hero.Magic := Hero.Magic - 1;
    if opponent.Health > 0 then Hero.Health := Hero.Health - random(Opponent.Power + 1);
    end;
    until ((Selection = 'F') or (Selection = 'M'));
    end;

    procedure Battle;
    begin
    GetEnemy;
    repeat
    clrscr;
    WriteStats;
    Menu;
    until ((Hero.Health <= 0) or (Opponent.Health <= 0));
    if Opponent.Health <= 0 then begin
    writeln(Opponent.name, ' Was Killed');
    score := score + Opponent.Power;
    delay(2000);
    end;
    end;


    begin
    repeat
    LoadSettings;
    repeat
    Battle;
    until Hero.Health <=0;
    clrscr();
    writeln(Hero.Name , ' Wai Killed');
    writeln('Final Score: ', score);
    repeat
    write('Play Again Y/N: ');
    readln(selection);
    selection := UpperCase(selection);
    until ((selection = 'Y') or (selection = 'N'));
    until selection = 'N';
    end.
    [/color][/code]When you post a code don't forget to put it in between the "<>", it's on the top of the editor window...
  • yiga194yiga194 Posts: 1Member
    That helped me too.

    Thanks alot.
Sign In or Register to comment.