Letter-individual checking
Hi!
I'm currently working on an educational game where the players will be given different tasks to complete.
The current task is to type the alphabet in the correct order and then "correct" it with a specified button.
The problem is, I do not know how to individually compare each letter to the alphabet, or the string I have created.
The letters are to be individual values to be able to show the player which letter is in the right spot, and which is in the wrong spot.
Would I need to ( at each type in of a character ) create a new string for each individual letter to then compare it to the complete string?
Thank you in advance! :)
Re: Letter-individual checking
You can use Mid$ to extract the specific letter from your correct answer string and then compare that to what letter the player has entered.
Re: Letter-individual checking
Excuse me for asking, but how would I use this in MMF2?
Both with the action/behaviour etc..
Re: Letter-individual checking
Run a fastloop len(string) times
On the loop set the selection from loopindex(loop) to loopindex(loop)+1
And test for the selected text = the text you want
Re: Letter-individual checking
Thanks for the help so far guys.
I think I've come a little bit on the way there.
But I do not know how to test the text against the string?
What I've done so far ( I think ) is created the loop, ran it, but I have not tested the edited text to the string.
The condition list is as follows for the loop:
User clicks with left button on ""
"Start loop "Len( String )" 29 times"
"Set loop "Len( String )" index to LoopIndex(Len( String ))+1
On loop "Len( String )"
How should I proceed?
Re: Letter-individual checking
You don't need to set the loop index, it will count up automatically.
Re: Letter-individual checking
Oh!
Thanks!
But I still need help with the comparing of the text box to the string.
How should I do that?
Note: I am a beginner, so I would appreciate it if you could explain thouroughly..
Thank you!
Re: Letter-individual checking
You don't run a loop 29 times, you run a loop len(string) times, where string is the string you are using (for example, 'len(edittext$("Edit Box"))')
And you can probably just use
mid$(string,loopindex("loop"),1) = a, etc
Re: Letter-individual checking
Okay, think I got it now.
But, I still don't understand with what actions I am supposed to compare the text with the string?
As I've said, I am a beginner, so you will need to explain the actions I need for it..
Thank you, been a massive help!
Re: Letter-individual checking
Hi again.
Think I found the MID$ thing.
I made it as a condition as follows:
Compare two general values, and then entered the MID$ for both the edited text and the string.
It looked like this for the string:
Mid$( paragraph$( "String", 1), 0, 1)
And like this for the text box:
Mid$(Edittext$( "Textbox" ), 0, 1)
But, the problem is, I don't know how to check exactly which letter is correct and which is false and then change the colour for them accordingly.
Thank you guys!