Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Error 77 : File variable expected ???

[es] :: Pascal / Delphi / Kylix :: Error 77 : File variable expected ???

[ Pregleda: 3506 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

reiser

Član broj: 7895
Poruke: 2314



+102 Profil

icon Error 77 : File variable expected ???09.06.2003. u 22:32 - pre 253 meseci
Pisem arkanoid u pascalu, i jedna od procedura glasi :
Code:

Procedure SprRead;
 Begin
  Assign(Fil1, 'ODB.SPR');
  Reset(Fil1);
   While Not Eof(Fil1) Do Begin
    ReadLn(Fil1, Odb.SprRed);
    For C1 := 1 to Length(Odb.SprRed) Do
     Inc(Odb.SprVisina);
     Odb.Spr[C1, Odb.SprVisina] := Copy(Odb.SprRed, C1, 1);
   End;
  Close(Fil1);
 End;



Evo kako su definisane promenljive :

Code:

Type
 Odbijac = Record
            X         : Integer;
            X1        : Integer;
            Y         : Integer;
            Y1        : Integer;
            Spr       : Array[1..100, 1..30] Of Word;
            SprVisina : ShortInt;
           End;

Fil1 : Text
C1   : Integer;


Prilikom pokretanja programa izbaci gresku : 'Error 77 : File variable expected', i
pomeri pointer na liniju 'Assign(Fil1, 'ODB.SPR);'

Kada Fil1 definisem kao File, hoce, ali nece da cita fajl sa readln. Ranije je sve
radilo kako treba sa Fil1 : Text. Moze li neko da pomogne ?
 
Odgovor na temu

silverglider

Član broj: 651
Poruke: 218
*.batalpha.de

Sajt: www.benchmark.co.yu


Profil

icon Re: Error 77 : File variable expected ???10.06.2003. u 13:53 - pre 253 meseci
Ako je file Text tipa, koristi ReadLn, a ako je file of record, koristi Read, a ne Readln, jer se ne radi o tekstu, pa da imas CR+LF kao delimiter.

 
Odgovor na temu

reiser

Član broj: 7895
Poruke: 2314



+102 Profil

icon Re: Error 77 : File variable expected ???10.06.2003. u 17:42 - pre 253 meseci
Fajl se zove odb.spr, i sadrzi nesto slicno ovome :

00001111111111111111111111111111111111111111110000
00077777777777777777777777777777777777777777777000
00211111111111111111111111111111111111111111111200
...

Sa ReadLn, bi trebalo da hoce, kada izdvojim samo taj potrprogram, on bez problema radi, ali kada ga ubacim u ceo program, nece - izbaci gresku vec navedenu...
 
Odgovor na temu

voj@
Vojislav Babic
Sarajevo

Član broj: 9200
Poruke: 72
*.ppp-01.sa.lol.ba.

Sajt: www.paradajz.cjb.net


Profil

icon Re: Error 77 : File variable expected ???11.06.2003. u 00:09 - pre 253 meseci
i ja se malo zezam sa pascalom pa me zanima kako si pravio zidove,da li si koristio graficki mod ili si radio ono i ja kako koristis pointere u takvom tipu igrice,a jos nisam dorastao da ti dam odgovor na pitanje sorry,pozdrav
voj@
cOOl
 
Odgovor na temu

reiser

Član broj: 7895
Poruke: 2314



+102 Profil

icon Re: Error 77 : File variable expected ???11.06.2003. u 13:59 - pre 253 meseci
Zidove sam prosto nacrtao sa Rectangle, stim sto donja stranica rectanglea prelazi vidljivi deo, tako da se vidi samo gornja, leva i desna strana. Loptica se odbija tako sto se isituje da li ima X ili Y koordinatu vecu (manju) od koordinate zida, itd, itd...

Evo CELOG source coda (moras da imas Fade2.tpu i Mouse.tpu ako zelis da program radi)

Code:

Program Arkanoid(Input, Output);

Uses Crt, Graph, Fade2, Mouse;

Type
 Screen  = Record
            Driver    : Integer;
            Mode      : Integer;
            Level     : Integer;
            LevelS    : String;
            NextLevel : Boolean;
           End;

 Walls   = Record
            LeftC      : Integer;
            RightC     : Integer;
            UpperC     : Integer;
            UnderC     : Integer;
           End;

 Text    = Record
            PoenaX     : Integer;
            PoenaY     : Integer;
            NivoX      : Integer;
            NivoY      : Integer;
           End;

 SoundT  = Record
            Freq       : Integer;
            Delay      : ShortInt;
           End;

 Color   = Record
            TxtPoena   : Word;
            IntPoena   : Word;
            TxtNivo    : Word;
            IntNivo    : Word;
            Wall       : Word;
            Bulb       : Word;
            Odb        : Word;
           End;

 Lives   = Record
            Number     : ShortInt;
            MaxNumber  : ShortInt;
            X          : Integer;
            X1         : Integer;
            Y          : Integer;
            Space      : ShortInt;
           End;

 Odbijac = Record
            X          : Integer;
            X1         : Integer;
            Y          : Integer;
            Y1         : Integer;
           End;

 BulbT   = Record
            X          : Integer;
            XMove      : ShortInt;
            Y          : Integer;
            YMove      : ShortInt;
            Radius     : Integer;
            Delay      : ShortInt;
            OnOdb      : Boolean;
            Dead       : Boolean;
            MaxXMove   : Integer;
            MinXMove   : Integer;
           End;


const
 Gray50 : FillPatternType = ($AA, $55, $AA, $55, $AA, $55, $AA, $55);


var
 Scr  : Screen;
 Wall : Walls;
 Txt  : Text;
 Col  : Color;
 Liv  : Lives;
 Odb  : Odbijac;
 Bulb : BulbT;
 Snd  : SoundT;

 C1   : Integer;
 C2   : Integer;
 C3   : Integer;
 x    : Integer;


Procedure VarSpecInit;
 Begin
  Scr.Level     := 3;

  Liv.Number    := 3;

  Bulb.Delay    := 7 - Scr.Level;
  Bulb.Radius   := 3;

  Col.Bulb      := WHITE;

  Odb.X1        := 80;
  Odb.Y1        := 8;
 End;

Procedure VarInit;
 Begin
  SetMouseSensitivity(0, 0, 0);

  Wall.LeftC    := 5;
  Wall.RightC   := 520;
  Wall.UpperC   := 5;
  Wall.UnderC   := 500;

  Txt.PoenaX    := 550;
  Txt.PoenaY    := 15;
  Txt.NivoX     := 555;
  Txt.NivoY     := 60;

  Col.TxtPoena  := YELLOW;
  Col.IntPoena  := LIGHTRED;
  Col.TxtNivo   := YELLOW;
  Col.IntNivo   := LIGHTRED;
  Col.Wall      := DARKGRAY;
  Col.Odb       := GREEN;

  Liv.MaxNumber := 6;
  Liv.X         := 535;
  Liv.X1        := 80;
  Liv.Y         := 110;
  Liv.Space     := 15;

  Odb.X         := 200;
  Odb.Y         := 450;

  Bulb.X        := Odb.X + Round(Odb.X1 / 2 - Bulb.Radius / 2);
  Bulb.Y        := Odb.Y - Bulb.Radius;
  Bulb.XMove    := 2;
  Bulb.YMove    := -2;
  Bulb.OnOdb    := TRUE;
  Bulb.Dead     := FALSE;
  Bulb.MaxXMove := 6;
  Bulb.MinXMove := -6;
 End;


Procedure MakeSnd;
 Begin
  Sound(Snd.Freq);
  Delay(Snd.Delay);
  NoSound;
 End;

Procedure OdbDraw;
 Begin
  SetFillPattern(Gray50, BLACK);
  SetColor(DARKGRAY);
  Rectangle(Odb.X, Odb.Y, Odb.X + Odb.X1, Odb.Y + Odb.Y1);
  FloodFill(Odb.X + 1, Odb.Y + 1, DARKGRAY);
  SetColor(BLACK);
  Rectangle(Odb.X, Odb.Y, Odb.X + Odb.X1, Odb.Y + Odb.Y1);

  Odb.X := MouseX;

  SetFillPattern(Gray50, Col.Odb);
  SetColor(DARKGRAY);
  Rectangle(Odb.X, Odb.Y, Odb.X + Odb.X1, Odb.Y + Odb.Y1);
  FloodFill(Odb.X + 1, Odb.Y + 1, DARKGRAY);
  SetColor(BLACK);
  Rectangle(Odb.X, Odb.Y, Odb.X + Odb.X1, Odb.Y + Odb.Y1);
 End;


Procedure MouseInit;
 Begin
  MouseX := 200;
  SetMouseSensitivity(20, 0, 0);
 End;


Procedure ScrInit;
 Begin
  Scr.Driver := Detect;
  InitGraph(Scr.Driver, Scr.Mode,' ');
  SetTextStyle(SmallFont, HorizDir, 5);
 End;


Procedure ScrDraw;
 Begin
  ClearViewPort;
  SetColor(Col.Wall);
  Rectangle(Wall.LeftC, Wall.UpperC, Wall.RightC, Wall.UnderC);
  SetColor(Col.TxtPoena);
  OutTextXY(Txt.PoenaX, Txt.PoenaY, 'Poena');
  SetColor(Col.TxtNivo);
  OutTextXY(Txt.NivoX, Txt.NivoY, 'Nivo');
 End;

Procedure NivoDraw;
 Begin
  SetColor(Col.IntNivo);
  Rectangle(Txt.NivoX, Txt.NivoY + 20, Txt.NivoX + 25, Txt.NivoY + 40);
  SetFillPattern(Gray50, Black);
  FloodFill(Txt.NivoX + 1, Txt.NivoY + 21, Col.IntNivo);
  SetColor(BLACK);
  Rectangle(Txt.NivoX, Txt.NivoY + 20, Txt.NivoX + 25, Txt.NivoY + 40);

  SetColor(Col.IntNivo);
  Str(Scr.Level, Scr.LevelS);
  OutTextXY(Txt.NivoX + 10, Txt.NivoY + 20, Scr.LevelS);
 End;


Procedure LivesDraw;
 Begin
  {Brise sve zivote sa ekrana}
  SetFillPattern(Gray50, BLACK);
  For C1 := 1 to Liv.MaxNumber Do Begin
   SetColor(DARKGRAY);
   Rectangle(Liv.X, Liv.Y + C1 * Liv.Space, Liv.X + Liv.X1, Liv.Y + C1 * Liv.Space + Odb.Y1);
   FloodFill(Liv.X + 1, Liv.Y + C1 * Liv.Space + 1, DARKGRAY);
   SetColor(BLACK);
   Rectangle(Liv.X, Liv.Y + C1 * Liv.Space, Liv.X + Liv.X1, Liv.Y + C1 * Liv.Space + Odb.Y1);
  End;

  {Isrtava zivote}
  SetFillPattern(Gray50, Col.Odb);
  For C1 := 1 to Liv.Number Do Begin
   SetColor(Col.Odb);
   Rectangle(Liv.X, Liv.Y + C1 * Liv.Space, Liv.X + Liv.X1, Liv.Y + C1 * Liv.Space + Odb.Y1);
   FloodFill(Liv.X+1, Liv.Y + C1 * Liv.Space + 1, Col.Odb);
   SetColor(BLACK);
   Rectangle(Liv.X, Liv.Y + C1 * Liv.Space, Liv.X + Liv.X1, Liv.Y + C1 * Liv.Space + Odb.Y1);
  End;
 End;

Procedure BrickDraw;
 Begin
  For C1 := 0 to Brick.SirinaN Do Begin
   For C2 := 0 to Brick.VisinaN Do Begin
    Rectangle(Brick.X + C1 * Brick.X1, Brick.Y + C2 * Brick,
              Brick.X + (C1 + 1) * Brick.X1, Brick.Y + (C2 + 1) * Brick.Y1);

{    FloodFill(}



Procedure BulbWallReflect;
 Begin
  Snd.Freq := 600;
  Snd.Delay := 3;

  If (Bulb.X > Wall.RightC - Bulb.Radius - Bulb.MaxXMove - 1) or
     (Bulb.X < Wall.LeftC + Bulb.Radius - Bulb.MinXMove + 1) Then Begin
   Bulb.XMove := -Bulb.XMove;
   MakeSnd;
  End;

  If Bulb.Y < Wall.UpperC + Bulb.Radius - Bulb.YMove Then Begin
   Bulb.YMove := -Bulb.YMove;
   MakeSnd;
  End;

  If Bulb.Y > Wall.UnderC Then Bulb.Dead := TRUE
 End;


Procedure BulbOdbReflect;
 Begin
  If (Bulb.Y > Odb.Y - Bulb.Radius - Bulb.YMove) And
     (Bulb.Y < Odb.Y - Bulb.Radius + 1) And
     (Bulb.X > Odb.X - Bulb.Radius - 2) And
     (Bulb.X < Odb.X + Odb.X1 + Bulb.Radius + 2) Then Begin
   Bulb.XMove := Round((Bulb.X - Odb.X - 40) / 7) + Round(Bulb.XMove / 4);
   Bulb.YMove := -Abs(Bulb.YMove);
   Bulb.Delay := Round(Abs(Bulb.XMove) * 2.5);
   If Abs(Bulb.XMove) > 4 Then Dec(Bulb.Delay, Round(Abs(Bulb.XMove) / 1.25));

   If Bulb.XMove = 0 Then Bulb.Delay := 7 - Scr.Level;
  End;

  If Bulb.Y > Odb.Y - Bulb.Radius - 2 Then OdbDraw;
 End;


Procedure BulbMove;
 Begin
  If (Bulb.XMove = 2) and (Bulb.YMove = -2) Then Bulb.Delay := 7 - Scr.Level;
  If Bulb.XMove > Bulb.MaxXMove Then Bulb.XMove := Bulb.MaxXMove;
  If Bulb.XMove < Bulb.MinXMove Then Bulb.XMove := Bulb.MinXMove;

  BulbWallReflect;
  BulbOdbReflect;

  Bulb.X := Bulb.X + Bulb.XMove;
  Bulb.Y := Bulb.Y + Bulb.YMove;
 End;

Procedure BulbDraw;
 Begin
  SetColor(BLACK);
  Circle(Bulb.X, Bulb.Y, Bulb.Radius);

  If Bulb.OnOdb = TRUE Then
   Bulb.X := Odb.X + Round(Odb.X1 / 2 - Bulb.Radius / 2) else BulbMove;
  SetColor(Col.Bulb);
  Circle(Bulb.X, Bulb.Y, Bulb.Radius);
  If Bulb.OnOdb = FALSE Then Delay(Bulb.Delay);
 End;


Procedure BulbDead;
 Begin
  GrabPal;
  FadeOut;
   Dec(Liv.Number);
   VarInit;
   ScrDraw;
   NivoDraw;
   LivesDraw;
   MouseTo(200, 0);
   OdbDraw;
   BulbDraw;
  FadeIn;
  MouseTo(200, 0);
 End;


Procedure OdbRead;
 Begin
  While (Bulb.Dead = FALSE) and (Scr.NextLevel = FALSE) Do Begin
   ReadMouse;
   If MouseX > Wall.RightC - 82 Then MouseX := Wall.RightC - 82;
   If MouseX < Wall.LeftC + 1 Then MouseX := Wall.LeftC + 1;
   If MouseX <> Odb.X Then Begin
    OdbDraw;
    BulbDraw;
   End;
   If Bulb.OnOdb = FALSE Then BulbDraw;
   If LeftButtonPressed = TRUE Then Bulb.OnOdb := FALSE;
  End;
 End;


Begin
 Randomize;
 VarSpecInit;
 VarInit;
 ScrInit;
 ScrDraw;
 NivoDraw;
 LivesDraw;
 BrickDraw;
 OdbDraw;
 While Liv.Number > 1 Do Begin
  If Bulb.Dead = TRUE Then BulbDead;
  BulbDraw;
  MouseInit;
  OdbRead;
 End;
 FadeOut;
End.



 
Odgovor na temu

reiser

Član broj: 7895
Poruke: 2314



+102 Profil

icon Re: Error 77 : File variable expected ???11.06.2003. u 14:01 - pre 253 meseci
Zaboravio sam da navedem, procedura BrickDraw je zapoceta i nije ni zatvorena sa End;
 
Odgovor na temu

[es] :: Pascal / Delphi / Kylix :: Error 77 : File variable expected ???

[ Pregleda: 3506 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.