Finally found one.

John Craig john at splash21.com
Tue Oct 2 16:42:01 EDT 2012


Hi, Craig.  Looks like the trouble is that you've always got a pending 
message, so after you press stop, there's another message fired 
immediately to start things rolling again.

try this handler in the card;

command cancelMessages pMessages
    -- cancel any pending messages in the pMessages list
    if pMessages = empty then exit cancelMessages
    put the pendingMessages into tPending
    repeat for each line tMsg in tPending
       put item 1 of tMsg into tID
       put item 3 of tMsg into tName
       if tName is among the items of pMessages then cancel tID
    end repeat
end cancelMessages



and change your showRandoms command to;


on showRandoms tSecs
    put random(99)
    if tSecs = 0 then
       cancelMessages "showRandoms"
       exit to top
    end if
    if tSecs > the seconds then send "showRandoms" && tSecs to me in 10 
millisecs
end showRandoms


HTH  :)



On 02/10/2012 03:25, dunbarx at aol.com wrote:
>
>
>
> Finally found reproducible scripts that work as advertised when stepping through in the deBugger, but do not when simply run. This gremlin has been sighted, like the Yeti, by nominally sane people, but never caught.
>
>
> Make two buttons. Name one "start". Name the other "stop".
>
>
> in btn "start":
> on mouseUp
>     put the seconds + 8 into tSecs
>     showrandoms tSecs
> end mouseUp
>
>
> In btn "stop":
> on mouseup
>     send "showRandoms" && 0 to this card
> end mouseup
>
>
> In the card script:
> on showRandoms tSecs
>     put random(99)
>     if tSecs = 0 then
>        exit to top
>     end if
>     if tSecs > the seconds then send "showRandoms" && tSecs to me in 0 millisecs
> end showRandoms
>
>
> Try it. If you press the "start" button, you get random numbers in msg for eight seconds. If you press the "stop" not while this is going on, nothing happens.
>
>
> If you place a breakpoint at the "exit to top" line in the card script. the handler is caught there, and if you then step through, you exit. The "stop" button resets the variable "tSecs" to a value that will force showRandoms to end. And it does, but only if you step through, not if you run it. The variable watcher shows a "0" as the value of tSecs, as it should, and the conditional tosses you out of the handler. As it should.
>
>
> But not in a normal run, only in the debugger.
>
>
> I have been chasing this since 1987. I am not crazy. I have pictures. I will start a support group.
>
>
> Craig Newman
>
>   
> _______________________________________________
> 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