Any suggestions or directions on how I can use an (external text file) to display words, one at a time on screen? For example, I have an external text file that says "Now is the time for all good men... yada yada".. And I want be able to display "Now" -- "is" --- "the" --- "time" --- "for " --- "all" --- "good".... (you get the idea I think)... It is actually a "reader" for a short story, so the text file may be somewhat lengthy...
If you make sure that there is always the same symbol separating words (space may be the obvious choice), then you can use tokenat and tokencount expressions.
variable currentWord=0 Keyboard on Enter pressed: Text set text to trim(tokenat(fileData, currentWord, " ")) Add 1 to currentWord
You can also use tokenat() with newline separator to break text into paragraphs, and then break paragraphs into words.
I will do a test to implement what you have suggested,,,, BUT what determines the "timing" of the words being presented. I see no reference to time? Will these flash too rapidly? If so how to slow them down? Possibly add a "delay"?
Develop games in your browser. Powerful, performant & highly capable.
I thought your question was more about how to get words from the file.
In my example one word is shown at a time when Space key is pressed. You can change this to "Every X seconds" or some other event. Or you can display all words in a loop, here is an example with 0.5 delay between words:
Repeat tokencount(fileData, " ") times Wait 0.5*loopindex Text set text to trim(tokenat(fileData, currentWord, " ")) Add 1 to currentWord