Reading multiple data statements

I am currently making a hangman game and I'd like to add a difficulty selection for easy, medium, and hard words. I have my words in a DATA command like this DATA "firstword","secondword"

I figured that i could make an if then or a case or something like this...

IF DIFFICULTY = 3 then !HARD
RANDOMIZE
RESTORE
DATA "sylt","syzygy"
ELSEIF DIFFICULTY = 2 then !MEDIUM
RANDOMIZE
RESTORE
DATA "hello","alphabet","aliens","intermediate"
ELSEIF DIFFICULTY = 1 then !EASY
RANDOMIZE
RESTORE
DATA "easy","guess"
END IF

but this doesn't work. The only thing I found in the TB manuals was a sample program...

! Trivia quiz.
!
READ num_quest ! Number of questions
FOR i = 1 to num_quest ! Read all questions
READ question$, answer$
PRINT question$;
LINE INPUT reply$ ! Get user’s guess
IF reply$ = answer$ THEN ! If correct...
LET right = right + 1 ! Count right replies
PRINT “Correct.” ! And say bravo
ELSE
PRINT “No, the correct answer is “; answer$; “.”
END IF
NEXT i

PRINT “You got”; 100 * right/num_quest; “% right.”
DATA 5
DATA What is the capital of Austria, Vienna
DATA What year did Franklin Pierce take office, 1853
DATA “What is the capital of Manitoba, Canada”, Winnipeg
DATA “How many years, on average, does a baboon live”, 20
DATA How about a gray squirrel, 5
END

I was hoping that someone could explain how I can have multiple DATA statements in my program, but instead of using them all, select which one I want to use.

Comments

Thank you

Thank you Big John That helped alot

Possibly A Simpler Method?

Personally I think that I know an easier way to do this without the use of those complicated arrays and what not. In my own experience I've only used TB Bronze and an early version of it at best but I do with what I have. Anyway, try using something like this:

RANDOMIZE
INPUT PROMPT "Difficulty Level? ":Diff$

IF Diff$=Easy$ THEN

LET Word_Choice=INT(RND*4)+1
!This will create a random # between 1&4
FOR i=1 to Word_Choice
READ Easy$

!This will read up to the segment of data defined by
!Word_Choice
!(EX: if Word_Choice=1 then it would only read easy1)
!(EX: if Word_Choice=2 then it could read easy1 or
!easy2)
!(EX: if Word_Choice=3 then it could read easy1,easy2,
!or easy3)
!(EX: if word choice=4 then it could read easy1,
!easy2, easy3, or easy4)
!these examples are valid for all following difficulties

NEXT i
LET Easy_Word$=Easy$
RESTORE

!This would allow the word that the players needs to
!guess to be the random word selected by Word_Choice
!This is also valid for all difficulties.

ELSE IF Diff$=Medium$ THEN

DO
LET Word_Choice=INT(RND*8)+1
LOOP UNTIL Word_Choice>=5
FOR i=1 to Word_Choice
READ Medium$
NEXT i
LET Med_Word$=Medium$
RESTORE

ELSE IF Diff$=Hard$ THEN

DO
LET Word_Choice=INT(RND*12)+1
LOOP UNTIL Word_Choice>=9
FOR i=1 to Word_Choice
READ Hard$
NEXT i
LET Hard_Word$=Hard$
RESTORE
END IF

DATA easy1$,easy2$,easy3$,easy4$
DATA med1$,med2$,med3$,med4$
DATA hard1$,hard2$,hard3$,hard4$

END

...Or am I?

DATA STATEMENTS

Hi,
Try this:

REM: Hangman
DIM word$(1)
DO
INPUT prompt "difficulty 1/2/3":difficulty
IF DIFFICULTY = 3 then !HARD
RANDOMIZE
CALL hard(word$())
ELSEIF DIFFICULTY = 2 then !MEDIUM
RANDOMIZE
CALL medium(word$())
ELSEIF DIFFICULTY = 1 then !EASY
RANDOMIZE
CALL easy(word$())
END IF
RESTORE
FOR n=1 to ubound(word$)
PRINT word$(n)
NEXT n
LOOP
END

SUB hard(word$())
MAT REDIM word$(2)
DATA "sylt","syzygy"
MAT READ word$
END SUB

SUB medium(word$())
MAT REDIM word$(4)
DATA "hello","alphabet","aliens","intermediate"
MAT READ word$
END SUB

SUB easy(word$())
MAT REDIM word$(2)
DATA "easy","guess"
MAT READ word$
END SUB

It works.

Big John

Multiple DATA Statements

You could number your program lines and use the RESTORE lineno command (where lineno is the DATA line to restore to). See the manuual for details