ok, i see how that works, but there's one difference... your code has one condition (whehter or not the letter has been used before). In my code, there's two: (1) whether or not the letter has been used before (2) if the letter is the correct one.
you had me make a
right varible equal 0 and then make a for/next loop to see if the letter guess was in the hidden word and if it was then make that variable equal 1. then, make an if/then statement to see whether or not that variable was still 0, and if it was, then increase the strikes variable. So, i tried to apply this same thing with a
used variable to determine whether or not the letter had been used (regardless of whether it was right or wrong) and if it had, then ignore the if/then statement that checks whether the variable was still 0 altogether. I am not sure how to do it. I tired making the
used and
right variables equal true or false excessively, but it seems like darkbasic doesn't give a crap.
`incorrect/same answer variables
right = 0
used = 0
`check if the guessed letter is in the word
for letter = 1 to statelen
if mid$(rndstate$,letter) = input$
blank$ = left$(blank$,letter-1) + mid$(rndstate$,letter) + right$(blank$,statelen-letter)
text 50,150, blank$
right = 1
endif
next letter
`check if letter has been used already
repeat
for a = 1 to len(input$)
if mid$(check$,a)=input$
input$ = ""
used = 1
right = 1
endif
next a
until input$<>""
if used = 1 and right = 1
strikes = strikes + 0
text 73,280, str$(strikes)
wrong = 1
endif
`wrong answer
if right = 0 and used = 0
strikes = strikes + 1
text 73,280, str$(strikes)
wrong = 1
endif
w=asc(input$)-96
`add letters to check$
check$=left$(check$,w-1) + input$ + right$(check$,len(check$)-w)
`print new check$
text 50, 400, check$
`winning
if blank$ = rndstate$ and strikes<10
cls
text 30,0, "congrats"
text 40,0, rndstate$
endgame_menu()
endif
`losing
if strikes>=10 and blank$<>rndstate$
cls
text 40, 0, "you got hanged"
endgame_menu()
endif