Finally found one.

John Craig john at splash21.com
Wed Oct 3 02:12:58 EDT 2012


Hi, Craig.  There's no message build up : every time you send a 
'showRandoms tSecs', you schedule another 'showRandoms tSecs' if your 
time check is true, so there's one pending.
Pressing the stop button just makes another call to the handler, it 
doesn't cancel the scheduled message - it's still there and will still fire.
When you send  'showRandoms 0', the existing scheduled message is still 
'showRandoms x' - it still has it's random number as the tSecs parameter.


On 03/10/2012 02:15, dunbarx at aol.com wrote:
> John.
>
>
> Just read your post. I came to the same conclusion. See the last entry in the thread in the forums.
>
>
> But it seems like each time a pending message is queued, a message is sent, so I do not see why these should build up. But I posted an example, similar to your thinking, and it obviously is the reason behind it all.
>
>
> But as Bernd notes, why the "exit to top" doesn't kill everything is still a mystery...
>
>
> Craig Newman
>
>
>
> -----Original Message-----
> From: John Craig <john at splash21.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Sent: Tue, Oct 2, 2012 4:43 pm
> Subject: Re: Finally found one.
>
>
> 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
>>
>
> _______________________________________________
> 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
>
>   
> _______________________________________________
> 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