need help with a point system code - Programmers Heaven

Howdy, Stranger!

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

Categories

need help with a point system code

player1245player1245 Posts: 4Member
in ne one know how to do this or have done this i would appreciate the help if you can!
thanx

Comments

  • Phat NatPhat Nat Posts: 757Member
    : 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?

  • player1245player1245 Posts: 4Member
    : : 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
  • Phat NatPhat Nat Posts: 757Member
    : : : 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

  • player1245player1245 Posts: 4Member
    : : : : 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
Sign In or Register to comment.