Author Topic: TIMER QUESTION  (Read 3152 times)

jenna

  • Newbie
  • *
  • Posts: 23
    • View Profile
TIMER QUESTION
« on: December 24, 2003, 09:28:15 am »
I have been using the Auto-Idle function now and it works great, Hal is able to talk when the user is idle two to three different times during the day.. My dilemma is that Hal doesn’t repeat the Auto-Idle function every day unless you exit Hal and restart, then the scan function will restart.  It appears that the Timer quits at or just before midnight, and doesn’t reset till you restart Hal.  Is there a way to reset the timer within a script.  I’ve tried several methods but haven’t had any luck.
Thanks
Jenna [:)]
 

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
TIMER QUESTION
« Reply #1 on: December 24, 2003, 12:56:13 pm »
The timer variable in VB keeps track of how many seconds have elapsed since midnight which is why you are having this problem. I would reccomend using the VB "Now" function as that keeps the full date. You can figure out differences in time using a VB function called DateDiff. It works like this:

DiffInMinutes = DateDiff("N", Now, LastResponseTime)
DiffInSeconds = DateDiff("S", Now, LastResponseTime)
DiffInHours = DateDiff("H", Now, LastResponseTime)
DiffInDays = DateDiff("D", Now, LastResponseTime)
LastResponseTime = Now
Robert Medeksza

lostbowyer

  • Full Member
  • ***
  • Posts: 105
    • View Profile
TIMER QUESTION
« Reply #2 on: December 26, 2003, 02:40:33 pm »
The above commands appear to result in generating a negative number, I kept my format of counting the time difference in seconds, in order for the script to work I had to change the

DateDiff("S", Now, LastResponseTime)

To

DateDiff("S", LastResponseTime, Now)

Just an fyi....
Glenn