Script for executable idle timer
Phil Davis
revdev at pdslabs.net
Tue Nov 12 19:06:24 EST 2013
Improved code (that doesn't die if user clicks "OK" while timer is
running). Watch for line wraps:
-- Button script:
on mouseUp
start using this stack
send "updateDialog 9" to fld id 1006 of stack "answer dialog" in 1
second
answer "Your world will end in 10 seconds."
end mouseUp
-- Stack script:
command updateDialog pTime
if "answer dialog" is among the lines of the openStacks then
if pTime = 0 then
click at the loc of btn "OK" of stack "answer dialog"
else
put "Your world will end in" && pTime && "seconds." into
the target
subtract 1 from pTime
send "updateDialog pTime" to the target in 1 second
end if
end if
end updateDialog
Phil
On 11/12/13, 3:51 PM, Phil Davis wrote:
> No need to modify the answer dialog. This works:
>
> In a button on my test stack:
>
> on mouseUp
> start using this stack
> send "updateDialog 9" to fld id 1006 of stack "answer dialog" in
> 1 second
> answer "Your world will end in 10 seconds."
> end mouseUp
>
>
> In the script of my test stack:
>
> command updateDialog pTime
> if pTime = 0 then
> click at the loc of btn "OK" of stack "answer dialog"
> else
> put "Your world will end in" && pTime && "seconds." into
> the target
> subtract 1 from pTime
> send "updateDialog pTime" to the target in 1 second
> end if
> end updateDialog
>
>
> Except my world didn't end when the dialog closed. That will require
> more code.
>
> Phil Davis
>
>
>
> On 11/12/13, 3:05 PM, Devin Asay wrote:
>> On Nov 12, 2013, at 3:45 PM, Mark Wieder wrote:
>>
>>> Devin-
>>>
>>> Tuesday, November 12, 2013, 1:39:57 PM, you wrote:
>>>
>>>> The problem with a dialog box is that there is no way to dismiss
>>>> is in a script as far as I know.
>>> In the script of the first card of the dialog box:
>>>
>>> on openCard
>>> send "closeMe" to me in 10 seconds
>>> end openCard
>>>
>>> on closeMe
>>> close this stack
>>> end closeMe
>> So you'd have to modify the ask and answer dialog stacks in the IDE?
>>
>> Devin
>>
>> Devin Asay
>> Learn to code with LiveCode University
>> http://university.livecode.com
>>
>>
>> _______________________________________________
>> 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
>>
>
--
Phil Davis
More information about the use-livecode
mailing list