Typing correct answer in field then go to next page??

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Dillinger
Posts: 4
Joined: Fri Dec 19, 2014 2:09 pm

Typing correct answer in field then go to next page??

Post by Dillinger » Fri Dec 19, 2014 2:12 pm

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 :D :shock:

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Typing correct answer in field then go to next page??

Post by Dixie » Fri Dec 19, 2014 2:39 pm

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
Last edited by Dixie on Fri Dec 19, 2014 5:38 pm, edited 1 time in total.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Typing correct answer in field then go to next page??

Post by dave.kilroy » Fri Dec 19, 2014 3:22 pm

erm - Santa just told me that it works better if you don't set the lockText to true...

Merry Christmas everyone!
"...this is not the code you are looking for..."

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Typing correct answer in field then go to next page??

Post by dunbarx » Fri Dec 19, 2014 3:32 pm

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

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Typing correct answer in field then go to next page??

Post by Dixie » Fri Dec 19, 2014 5:37 pm

Yes, of course... I meant 'dont wrap'... :oops: I corrected my first post

Dillinger
Posts: 4
Joined: Fri Dec 19, 2014 2:09 pm

Re: Typing correct answer in field then go to next page??

Post by Dillinger » Sat Dec 20, 2014 6:57 pm

Thanks for the help guys!

Post Reply