Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.