Finally found one.

J. Landman Gay jacque at hyperactivesw.com
Tue Oct 2 16:50:27 EDT 2012


On 10/2/12 3:42 PM, John Craig wrote:
> 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  :)

Ah, that's it. I tried handling pending messages differently but in the 
wrong place:

on showRandoms tSecs
   put random(99)
   wait 0 with messages
   if tSecs = 0 then
     exit to top
   end if
   if tSecs > the seconds and "showRandoms" is not in the pendingmessages
   then send "showRandoms" && tSecs to me in 5
end showRandoms

Your way works.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the Use-livecode mailing list