Loop Pause/wait/stop for user input

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
Not a lot of thought
Posts: 77
Joined: Thu May 21, 2015 2:41 am

Loop Pause/wait/stop for user input

Post by Not a lot of thought » Sun Nov 29, 2015 4:14 pm

I have an instance where I'm running a loop, but if a certain condition exists then I need the user to confirm information before the loop continues. I'd like to pause the loop and wait for a user response then either move to the next iteration or run through the current. The only thing I'm struggling with is stopping the loop to await user input. Does anyone know of a good tutorial or have any suggestions? I've tried looking for a stop and pause command but nothing I found seemed like it would be helpful. I also wasn't sure if I could use an if else statement to accomplish this.

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

Re: Loop Pause/wait/stop for user input

Post by dunbarx » Sun Nov 29, 2015 4:55 pm

Hi

On a new card, make a button and two fields. Put this into the button script:

Code: Select all

on mouseUp
   repeat with y = 1 to 25
      wait 15
      if y = 15 then
         ask "Think of a number"
         put it into fld 2
      end if
      put y into fld 1
   end repeat
end mouseUp
Does this help?

Craig Newman

Post Reply