CLS
TYPE Player
Name$ = ""
Score AS INTEGER
END TYPE
PRINT "Welcome to Guess or Die!"
PLAY "ABA"
INPUT "Please enter your name"; Player.Name$
BEEP
PRINT "First Question..What is 1+1?", Question1%
IF Question1% = 2 THEN
PRINT "Correct! 10 Points."
Player.Score 10
What I am trying do to is basicly add 10 points to the players score.
Konamix wrote:I am experienced in the DM programming language, and now wish to learn QBASIC. I know some, and what I do not understand is quite simple..yet to hard!
CLS
TYPE Player
Name$ = ""
Score AS INTEGER
END TYPE
PRINT "Welcome to Guess or Die!"
PLAY "ABA"
INPUT "Please enter your name"; Player.Name$
BEEP
PRINT "First Question..What is 1+1?", Question1%
IF Question1% = 2 THEN
PRINT "Correct! 10 Points."
Player.Score 10
What I am trying do to is basicly add 10 points to the players score.
Konamix wrote:I am experienced in the DM programming language, and now wish to learn QBASIC. I know some, and what I do not understand is quite simple..yet to hard!
CLS
TYPE Player
Name$ = ""
Score AS INTEGER
END TYPE
PRINT "Welcome to Guess or Die!"
PLAY "ABA"
INPUT "Please enter your name"; Player.Name$
BEEP
PRINT "First Question..What is 1+1?", Question1%
IF Question1% = 2 THEN
PRINT "Correct! 10 Points."
Player.Score 10
What I am trying do to is basicly add 10 points to the players score.
i think you also must do this:
after END TYPE
you must put
DIM play AS player
then player.score is really written play.score...
play could be any label you want that was just an exmaple
CLS
TYPE Player
Name AS STRING '<---
Score AS INTEGER
END TYPE
DIM Plyr AS Player '<---
PRINT "Welcome to Guess or Die!"
PLAY "ABA"
INPUT "Please enter your name"; Plyr.Name '<---
BEEP
PRINT "First Question..What is 1+1?", Question1%
IF Question1% = 2 THEN
PRINT "Correct! 10 Points."
Plyr.Score = Plyr.Score + 10 '<---
END IF '<---
Going by and adding up what the others pointed out, all the new or changed stuff in this code is marked with '<---...
Also, Name$ = "" should be Name AS STRING,.. And when you have a IF block, you need to end it with END IF... And you can't use Play as a lable sence play is a Statement, so that needs to be Plyr or something else...