Best way to set up an idle timer - not like this

Dar Scott dsc at swcp.com
Fri Aug 15 16:02:01 EDT 2003


On Friday, August 15, 2003, at 02:23 PM, Devin Asay wrote:

>> on openStack
>>   -- start timeout counter
>>   insert the script of image "P&Rbg1.jpg" into front

Cool idea!

>>   send "logoutQuery" to stack "chinpr" in 5 * 60 seconds -- or 
>> whatever time you want

Replace above line with this:

    resetLogout


>> end openStack

local logoutID = ""

>>
>> on logoutQuery
>>   if the userPIN of this stack is not empty then -- i.e., if the user 
>> is logged in
>>     answer "A appropriate prompt here." with "Logout" or "Enter 
>> PIN..."
>>     if it is "Enter PIN..." then -- (user chose to continue)
>>       repeat forever -- or could put a limit here
>>         ask information "Enter your PIN to continue the test."
>>         if it is the userPIN of this stack then
>>           resetLogout
>>           exit repeat
>>         else
>>           answer information "Incorrect PIN. Try Again or Logout?" 
>> with "Logout" or "Try Again"
>>           if it is "Logout" then
>>             go card "menu" of stack "chinpr"
>>             logout
>>             exit repeat
>>           end if
>>         end if
>>       end repeat
>>       exit logoutquery
>>     else if it is "Logout" then -- (user chose to log out)
>>       go card "menu" of stack "chinpr"
>>       logout
>>       exit logoutQuery
>>     end if
>>   end if
>> end logoutQuery
>>
>> on resetLogout
>>   cancel item 1 of last line of the pendingMessages

Take out above line, throw it on the floor and stomp on it.

      cancel logoutID  -- cancel of empty seems to be harmless and fast

>>   send "logoutQuery" to stack "chinpr" in 5 * 60 seconds

      put the result into logoutID

>> end resetLogout


on closeStack
     cancel logoutID
end closeStack


How's that?

(Almost right out of the Primer on Message Mechanics which I promise 
I'm working on right now.)

You may be canceling a rev message or some other message.

Dar Scott


****************************************
     Dar Scott Consulting
     http://www.swcp.com/dsc/
     Programming Services
****************************************




More information about the use-livecode mailing list