|
What is wrong? The output prints everything up to the first "False", then it doesn't do anything esle.
wordbank = [[
Lots and lots of words here...
]]
math.randomseed(tick())
word = {}
function explode(txt)
length = string.len(txt)
print(length)
for i = 1,length do
let = string.sub(txt,i,i)
table.insert(word, let)
print(let)
end
end
function unScramble()
chkused = false
found = false
wait(.1)
newstr = ""
guesses = {}
used = {}
for i = 1,#word do
num = math.random(1,#word)
print(num)
for i = 1, #used do
if used[i] == word[num] then
chkused = true
end
end
if used == false then
print("False")
newstr = newstr..word[num]
end
end
for i = 1,#guesses do
if guesses[i] == newstr then
found = true
print("true")
end
end
if found == false then
print("False")
look = string.find(wordbank,newstr)
print(newstr)
if look then
pos = string.sub(newstr, look)
print(pos)
else
explode("test")
unScramble()
end
end
end
explode("test")
unScramble()
~~Check it out - http://www.roblox.com/Create-A-Story-V-1-BETA-item?id=34866023~~ |
|
|
|
Yes, but, since it is empty and can't possibly find the word, it shouldn't change found to true
~~Check it out - http://www.roblox.com/Create-A-Story-V-1-BETA-item?id=34866023~~ |
|
|
|
|
You're being to vague. Explain more of what your script is supposed to do. |
|
|
Vague? Its a word unscrambler.. What more do you need? It takes a word, in this case "test", explodes it into a table with each letter, then makes random combinations of those letters and checks if it is in the word bank.
~~Check it out - http://www.roblox.com/Create-A-Story-V-1-BETA-item?id=34866023~~ |
|
elucidirJoin Date: 2011-08-08 Post Count: 243 |
Anagram solver. |
|
|
|
Bump
if used == false then
print("False")
newstr = newstr..word[num]
end
I think this is where it gets messed up.. It doesn't print "False" even though it should.
~~Check it out - http://www.roblox.com/Create-A-Story-V-1-BETA-item?id=34866023~~ |
|
|
Put this before "if used == false then":
print(tostring(used))
and give me the result. |
|
|
4
t
e
s
t
1
table: 1F7D9958
2
table: 1F7D9958
1
table: 1F7D9958
2
table: 1F7D9958
False
That's everything the script prints
~~Check it out - http://www.roblox.com/Create-A-Story-V-1-BETA-item?id=34866023~~ |
|
|
|
|
Are you trying to scramble the letters in a word, or the words in the sentence? |
|
|
Letters.
In the end, you will get a text box, input a word, and it unscrambles it and gives you all the words it found. |
|
|
OH, I think I get it now. Do you mind if I rewrite that for you? If so, can I ask what all the words in that string at the top are separated by? |
|
|
They aren't seperated by anything.. Heres an example:
aardvark
abaci
aback
abacus
I would put it in a table, but the list I downloaded has 25000+ words.. Haha |
|