call it another silly newbe question?


(gecko) #1

hi! I used the blender game engine several times to make small realtime videos(will put one soon on my website www.gecko.xt.be), but now I want to make a kind of scrabble game!
thats why I need blender to check if the content of a string is included in a extern wordlist. thats my problem. I need this to find out wether the player has entered a word which exists or not.
thanx for help, benno


(saluk) #2

In python:


f = open(filename,"r")
wordlist = f.readlines()
f.close()

enteredwordok = 0
for word in wordlist:
    if enteredword == word:
        enteredwordok = 1

if enteredwordok:
    do stuff

It’s only a fragment of course, but it’s the code fragment that does what you need. It needs to be edited with the actual filename and you can change the variables to your liking. The external file should have a list of correct words, each one on a new line:


word1
word2
word3
word4
etc


(gecko) #3

thankyouverymuch!!!

I hope I can post my game soon on the internet.
but first of all I have to search for a phyton-tutorial ;-)…