Hello again...
Yes, I'm stuck again.
My game now creates a list of words to show to the children to spell. As they spell a word correctly, that word is deleted from the list.
Here is the code for that part:
on RunGame
put 0 into gAttempts
get any word of field "TempList" of card "List Card"
put it into gWord
move field "word" to the loc of gButton in 1 tick
set the locktext of field "word" to true
put gWord into field "word"
show field "word"
wait 2 seconds
put empty into field "word"
set the locktext of field "word" to false
click at the loc of field "word"
end RunGame
on returnInField
put field "word" into tAnswer
--that is the word the students typed into the field, which is then compared to the original word
select empty
if tAnswer = gWord then
put yes into field "word"
hide button gButton
hide field "word" -- this with the above reveal a piece of the picture
replace gWord with empty in field "List 1" of card "List Card"
--removes the word from the list, but delets parts of other words that match as well!
I was using "any" because it seemed the easiest way to randomize the word selection but it looks like I will have to randomize a number and ask for a word by number instead, then after deleting that word, move up the other words and select a random number from 1-19 instead of from 1-20. It would be easier, however, if I could instead delete only whole words instead of parts of words.
Suggestions?
*sets out chocolate-chip cookies as a bribe*
Thanks,
Banty
Copy Contents of one Field to Another
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Copy Contents of one Field to Another
2nd-grade Teacher, Poultry Fancier, Scottish Country Dancer
and Perpetual Beginner
and Perpetual Beginner
Re: Copy Contents of one Field to Another
Bantymom,
instead ofput this
this assumes that you only have unique words "in List 1", multiple occurences of a word would be a little different.
regards
Bernd
instead of
Code: Select all
replace gWord with empty in field "List 1" of card "List Card"
Code: Select all
put wordOffset(gWord,field "List 1") into tWordNumber
put empty into word tWordNumber of field "List 1"
that is a very useful aspect of replace, it just does not work if you want to operate on words--removes the word from the list, but delets parts of other words that match as well!
regards
Bernd
Re: Copy Contents of one Field to Another
Hi,
Here's a simple routine to delete all words gWord from a field.
Mark
Here's a simple routine to delete all words gWord from a field.
Best,lock screen
repeat with x = number of words of fld "Word List" down to 1
if word x of fld "Word List" is gWord then
delete word x of fld "Word List"
end if
end repeat
unlock screen
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode