Forum Moderators: not2easy

Message Too Old, No Replies

I need help with Lingo script, for dicrector.

         

jaames

11:49 pm on Apr 3, 2004 (gmt 0)

10+ Year Member



I want to have a simple word comparison game in director…where the users inputs a word in the text box…. Then the word inputted is compared to an embedded word in director to see whether they are right or wrong…

For example… I want the user to input a the word “grass” in the text box …then when they press an enter button the text box clears where the user can put another word in the text box…then another…

Basically the process will go on like this:
1- User inputs “Grass” in text box
2- User presses an ENTER button
3- Text box clears

Then I want this process to repeat until the user inputs ten word….

At the end of it the user presses an “analyze” button where the 10 words entered are all compared to the ten words I embedded… it will give the result of the testing game.

I am good as far as graphics goes in director and have designed this simple game, but I have no idea about Lingo scripts… so please help me if you can because I don’t know what the lingo scripts I would have to use to achieve this.

thanks in advance

jaames

8:27 pm on Apr 8, 2004 (gmt 0)

10+ Year Member



Can somebody please help me!

bayon86

2:26 pm on Apr 23, 2004 (gmt 0)

10+ Year Member



oops, submitted twice...

[edited by: bayon86 at 2:30 pm (utc) on April 23, 2004]

bayon86

2:28 pm on Apr 23, 2004 (gmt 0)

10+ Year Member



James, what you are doing should not be so difficult. It could all work off the enter button, meaning attach this behaviour to the enter button. something along the lines of:

on beginsprite me
myCounter = 0 -- init counter so we can count how many wordshave been entered
set masterWordList = ["word1","word2,"andSoOn"] -- init master word list
set userWordList = [] -- init empty user word list, we will put the words entered by the user into this list
end

on mouseup me
theWord = member("textbox").text
userWordList.append(theWord) -- add word to userWordList
member("textbox").text = "" -- clear text box
if myCounter > 9 -- check to see how many words have been entered. if more than 9, analyze()
analyze()
else
myCounter = myCounter + 1 -- increase mycounter
end
end

on analyze
userScore = 0
repeat with foo = 1 to 10
if getAt(userWordList,foo) == (getAt masterWordList, foo)
userScore = userScore +1
end
end repeat
myCounter = 0 -- reset counter
end

hope that helps, or at least gets you in the right direct. if you are new to lingo you might need to bone up on lists and the repeat structure. good luck