I was bored so I made this for you. This loads a text file (as Robot suggested). The text file (example attached) should consist of a date and a word for that day "09/01/05 Playstation". Only use one line per word. I made a lot of rem statements but if you have questions just ask. Just don't tell your teacher you did it yourself... direct him/her to here... convince him/her to order lots of Darkbasic Pro CD's for your school.
` Make Word$ = whatever comes out of the function TodaysWord()
Word$=TodaysWord()
ink rgb(0,255,0),0
print "Word Of The Day = ";
ink rgb(0,150,0),0
print Word$
print ""
ink rgb(150,150,150),0
print "< PRESS ANY KEY >"
suspend for key
` Get the word of the day
function TodaysWord()
` Get the current date
d$=get date$()
` Check to see if hangman.txt exists... if not print an error
if file exist("hangman.txt")=0
ink rgb(255,0,0),0
print "Error: ";
ink rgb(150,0,0),0
print "Hangman.txt not found."
print ""
ink rgb(150,150,150),0
print "< PRESS ANY KEY >"
suspend for key
end
endif
` Open the file hangman.txt
open to read 1,"hangman.txt"
do
` If the end of the file is reached print an error
if file end(1)
ink rgb(255,0,0),0
print "Error: ";
ink rgb(150,0,0),0
print "Word of the day not found."
print ""
ink rgb(150,150,150),0
print "< PRESS ANY KEY >"
suspend for key
end
endif
` Read a line in hangman.txt
read string 1,a$
` Check the left side of the string to see if the
` current date ( d$ ) matches the date in the first
` 8 letters of a$.
if left$(a$,8)=d$
` If it is the same make a$ = everything but the
` first 9 letters of a$ (the date and the space)
a$=right$(a$,len(a$)-9)
close file 1
` Leave the function with a$. This makes a$
` available outside of this function
exitfunction a$
endif
loop
endfunction a$