: : in ne one know how to do this or have done this i would appreciate the help if you can! : : thanx : : : : Point System? You mean a "Point of Sale" or a Central Server or??? Also, are you using Pascal for DOS or Windows? : : pascal like a game that would reward points when you win and subtraced when u lose
: : : in ne one know how to do this or have done this i would appreciate the help if you can! : : : thanx : : : : : : : Point System? You mean a "Point of Sale" or a Central Server or??? Also, are you using Pascal for DOS or Windows? : : : : : pascal like a game that would reward points when you win and subtraced when u lose :
You would just use a variable to hold the point data. If you are looking to have the score continue on when a game is loaded at a different time, write the score into a file and load that file when the game is first opened.
Here's an example of gaining and losing points by pressing 'W' & 'L'. The program stores the points into a file in the C: directory called 'SCORES.DAT'.
[code] USES Crt, Dos; VAR Score : LongInt;
PROCEDURE Win; Begin Inc(Score); End;
PROCEDURE Lose; Begin If Score > 0 Then Dec(Score); End;
PROCEDURE LoadScore; VAR T : Text; Begin Assign(T,'C:SCORE.DAT'); {$I-} Reset(T); {$I+} If IOResult <> 0 Then Exit; ReadLn(T,Score); Close(T); End;
PROCEDURE SaveScore; VAR T : Text; Begin Assign(T,'C:SCORE.DAT'); Rewrite(T); WriteLn(T,Score); Close(T); End;
VAR Key : Char;
Begin LoadScore; Repeat Key := Upcase(Readkey); Case Key Of 'L' : Lose; 'W' : Win; End; Until Key = #27; SaveScore; End. [/code]
: : : : in ne one know how to do this or have done this i would appreciate the help if you can! : : : : thanx : : : : : : : : : : Point System? You mean a "Point of Sale" or a Central Server or??? Also, are you using Pascal for DOS or Windows? : : : : : : : : pascal like a game that would reward points when you win and subtraced when u lose : : : : You would just use a variable to hold the point data. If you are looking to have the score continue on when a game is loaded at a different time, write the score into a file and load that file when the game is first opened. : : Here's an example of gaining and losing points by pressing 'W' & 'L'. The program stores the points into a file in the C: directory called 'SCORES.DAT'. : : [code] : USES Crt, Dos; : VAR : Score : LongInt; : : PROCEDURE Win; : Begin : Inc(Score); : End; : : PROCEDURE Lose; : Begin : If Score > 0 Then Dec(Score); : End; : : PROCEDURE LoadScore; : VAR T : Text; : Begin : Assign(T,'C:SCORE.DAT'); : {$I-} Reset(T); {$I+} : If IOResult <> 0 Then Exit; : ReadLn(T,Score); : Close(T); : End; : : PROCEDURE SaveScore; : VAR T : Text; : Begin : Assign(T,'C:SCORE.DAT'); Rewrite(T); : WriteLn(T,Score); : Close(T); : End; : : VAR : Key : Char; : : Begin : LoadScore; : Repeat : Key := Upcase(Readkey); : Case Key Of : 'L' : Lose; : 'W' : Win; : End; : Until Key = #27; : SaveScore; : End. : [/code] : : Hope this answers your question : Phat Nat : : thanks that helped alot
Comments
: thanx
:
Point System? You mean a "Point of Sale" or a Central Server or??? Also, are you using Pascal for DOS or Windows?
: : thanx
: :
:
: Point System? You mean a "Point of Sale" or a Central Server or??? Also, are you using Pascal for DOS or Windows?
:
:
pascal like a game that would reward points when you win and subtraced when u lose
: : : thanx
: : :
: :
: : Point System? You mean a "Point of Sale" or a Central Server or??? Also, are you using Pascal for DOS or Windows?
: :
: :
: pascal like a game that would reward points when you win and subtraced when u lose
:
You would just use a variable to hold the point data. If you are looking to have the score continue on when a game is loaded at a different time, write the score into a file and load that file when the game is first opened.
Here's an example of gaining and losing points by pressing 'W' & 'L'. The program stores the points into a file in the C: directory called 'SCORES.DAT'.
[code]
USES Crt, Dos;
VAR
Score : LongInt;
PROCEDURE Win;
Begin
Inc(Score);
End;
PROCEDURE Lose;
Begin
If Score > 0 Then Dec(Score);
End;
PROCEDURE LoadScore;
VAR T : Text;
Begin
Assign(T,'C:SCORE.DAT');
{$I-} Reset(T); {$I+}
If IOResult <> 0 Then Exit;
ReadLn(T,Score);
Close(T);
End;
PROCEDURE SaveScore;
VAR T : Text;
Begin
Assign(T,'C:SCORE.DAT'); Rewrite(T);
WriteLn(T,Score);
Close(T);
End;
VAR
Key : Char;
Begin
LoadScore;
Repeat
Key := Upcase(Readkey);
Case Key Of
'L' : Lose;
'W' : Win;
End;
Until Key = #27;
SaveScore;
End.
[/code]
Hope this answers your question
Phat Nat
: : : : thanx
: : : :
: : :
: : : Point System? You mean a "Point of Sale" or a Central Server or??? Also, are you using Pascal for DOS or Windows?
: : :
: : :
: : pascal like a game that would reward points when you win and subtraced when u lose
: :
:
: You would just use a variable to hold the point data. If you are looking to have the score continue on when a game is loaded at a different time, write the score into a file and load that file when the game is first opened.
:
: Here's an example of gaining and losing points by pressing 'W' & 'L'. The program stores the points into a file in the C: directory called 'SCORES.DAT'.
:
: [code]
: USES Crt, Dos;
: VAR
: Score : LongInt;
:
: PROCEDURE Win;
: Begin
: Inc(Score);
: End;
:
: PROCEDURE Lose;
: Begin
: If Score > 0 Then Dec(Score);
: End;
:
: PROCEDURE LoadScore;
: VAR T : Text;
: Begin
: Assign(T,'C:SCORE.DAT');
: {$I-} Reset(T); {$I+}
: If IOResult <> 0 Then Exit;
: ReadLn(T,Score);
: Close(T);
: End;
:
: PROCEDURE SaveScore;
: VAR T : Text;
: Begin
: Assign(T,'C:SCORE.DAT'); Rewrite(T);
: WriteLn(T,Score);
: Close(T);
: End;
:
: VAR
: Key : Char;
:
: Begin
: LoadScore;
: Repeat
: Key := Upcase(Readkey);
: Case Key Of
: 'L' : Lose;
: 'W' : Win;
: End;
: Until Key = #27;
: SaveScore;
: End.
: [/code]
:
: Hope this answers your question
: Phat Nat
:
:
thanks that helped alot