Page 1 of 1
Typing correct answer in field then go to next page??
Posted: Fri Dec 19, 2014 2:12 pm
by Dillinger
Hi,
I am currently making something where I need the player to typ in the correct answer in a field, and if it's correct LiveCode needs to go to the next page or some other page I typ. But I cannot find the codes to do so. can anyone help?
Thanks

Re: Typing correct answer in field then go to next page??
Posted: Fri Dec 19, 2014 2:39 pm
by Dixie
Make a stack with two cards... put a field onto the first card, set the dontwrap of the field to true... and put the following script into the field script... If the correct text is answered, in this case "Happy Christmas" then you will be taken to the next card...
Code: Select all
on returnInField
if the text of me = "Happy Christmas" then
go next
else
beep
answer "Wrong Answer"
end if
end returnInField
Ho,ho,ho
Dixie
Re: Typing correct answer in field then go to next page??
Posted: Fri Dec 19, 2014 3:22 pm
by dave.kilroy
erm - Santa just told me that it works better if you don't set the lockText to true...
Merry Christmas everyone!
Re: Typing correct answer in field then go to next page??
Posted: Fri Dec 19, 2014 3:32 pm
by dunbarx
The field must be unlocked, as Dave mentioned, but i would include a button that the user must press when satisfied with the text in the field. Though it is possible to use the returnInField message, the action of pressing return once the text is "complete" is not necessarily intuitive or obvious.
But those are details. Dillinger, you should play with the lessons and other beginner resources. Your project is a perfect first application. Do embellish it endlessly, even with useless extra functionality, just to become fluent with the structure of LC and to start to build a decent vocabulary. For example, in the above discussion, can you see your way to having the correct text, once the last char is entered, automatically go to the next card, without pressing return or another button? This is not likely to be what you want, but is just an example of the sort of extra stuff you might play around with in order to learn. Write back anytime with your successes and problems.
Craig Newman
Re: Typing correct answer in field then go to next page??
Posted: Fri Dec 19, 2014 5:37 pm
by Dixie
Yes, of course... I meant 'dont wrap'...

I corrected my first post
Re: Typing correct answer in field then go to next page??
Posted: Sat Dec 20, 2014 6:57 pm
by Dillinger
Thanks for the help guys!