Exiting a repeat loop

Brian Milby brian at milby7.com
Thu Oct 4 16:24:05 EDT 2018


Yes, probably need a wait with messages inside the loop. Also the reset probably needs to go above the exit.

Thanks,
Brian
On Oct 4, 2018, 4:14 PM -0400, Sannyasin Brahmanathaswami via use-livecode <use-livecode at lists.runrev.com>, wrote:
> I have little game where the user runs a repeat loop. And I want to let
> the user stop at any time. So what I do set a local flag.
>
> Here is the simple logic
>
> ----------
>
> local sStopFlag
>
> *on mouseup*
>
> * repeat* sCycles times
>
> * if* sStopFlag=1*then*
>
> * exit* *repeat*
>
>
> ** put "0" into sStopFlag # reinitialize in case they want to
> continue**
>
> * end* *if*
>
> * ** #SNIP -- Cool stuff happens on screen*
>
> *end mouseup*
>
> *#and another button that sets the flag*
>
> *# button "pause"
> *
>
> *on mouseup*
>
> * put 1 into sStopFlag*
>
> *end mouseup*
>
> *# but on mobile, the user can't exit repeat until she clicks the
> "pause" multiple time.*
>
> *What the secret on exit a running repeat loop?*
>
> *Do add a little idle time?
> *
>
> *BR
> *
>
> *
> *
>
> *
> *
>
> *
> *
>
> *
> *
>
>
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list