Author Topic: AUTO-IDLE MODIFIED  (Read 7071 times)

jenna

  • Newbie
  • *
  • Posts: 23
    • View Profile
AUTO-IDLE MODIFIED
« on: December 16, 2003, 08:41:26 am »
'First I would like to thank all that were involved in bring the "AUTO-IDLE" to the forefront.
'Secondly I'm not sure if we can just post our scripts here without approval from someone, please advise.
'I have modified the script to have Hal only response during selective hours when users is idle.
'By change the valves  of  StartTime, EndTime and DelayTime below, you can give Hal as starting hour 'and a Ending Hour to witch he will  make comments, also changing the Delay Time will effect the seconds 'between each comment.
'I have also included a User_Idle.brn that you can download and put into your DefBrain directory.
'I'm sure there are other ways to accomplish the same thing here, but this is my first attempt to play/modify  'Hal's scripts.
'In the example below Hal will start with his comments at "9:00 am" and every 30 seconds he will pick 'something from the User_Idle.brn and will stop with his comments at 11:00 am
-----------------------------------------------------------------------------
'Script for auto response when users is idle.  
'Set desired valves below and save script
  DelayTime = 30
  StartTime = "9"
    EndTime = "11"  
 If LastResponseTime = "" Then LastResponseTime = Timer  
 TimerResponseDiff = Timer - LastResponseTime
 
If InStr(1, UserSentence, " AUTO-IDLE ", 1) > 0 And TimerResponseDiff < DelayTime Then
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If

If InStr(1, UserSentence, " AUTO-IDLE ", 1) > 0 And TimerResponseDiff > DelayTime Then
TimerResponseDiff = 0
LastResponseTime = Timer
 AutoIdleEnable = True
 
 'This will start Hal to comment when user is idle between the times selected
 If Trim(Hour(Now)) => StarTime And Trim(Hour(Now)) < EndTime Then AutoTimeDelay = True
   If AutoIdleEnable = True And AutoTimeDelay = True Then  
      NoResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "USER_IDLE.brn")
      GetResponse = NoResponse & vbCrlf
         
  GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
  Exit Function
 End If
End If  

'This will stop Hal from commenting when user is idle between the times selected
If Trim(Hour(Now)) <= StarTime And Trim(Hour(Now)) >= EndTime Then AutoTimeDelay = False
     If AutoIdleEnable = True And AutoTimeDelay = False Then
 GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
  Exit Function
End If
'---------------------------------------------------------------------
Function Script_Load()
    Script_Load = "<AUTO>30000</AUTO>"
End Function



Download Attachment: User_idle.brn
1.49 KB
« Last Edit: December 24, 2003, 09:35:29 am by jenna »
 

jenna

  • Newbie
  • *
  • Posts: 23
    • View Profile
AUTO-IDLE MODIFIED
« Reply #1 on: December 17, 2003, 07:07:35 pm »
[V]I have made some changes to my first posting, the above changes now appear in the script and should now work. I deleted the "Oct" function, and also the StartTime and EndTime valves placed in " ".  Please accept my apology for any inconvience that my first posting of the above script may have caused.
I have purchased the book "VBScipt in a nut shell" so maybe I'll get better. thanks
jenna [8D]
 

antec2

  • Newbie
  • *
  • Posts: 22
    • View Profile
AUTO-IDLE MODIFIED
« Reply #2 on: December 18, 2003, 12:47:55 am »
I would like to try this script, but where should it be placed in the existing script? I keep getting syntax errors.
Kman

jenna

  • Newbie
  • *
  • Posts: 23
    • View Profile
AUTO-IDLE MODIFIED
« Reply #3 on: December 18, 2003, 07:13:46 am »
Hi antec2
Make sure you have the changes I made yesterday to the script, it's the one now posted above.
I placed the script after "PROCESS: INITILIZE  VARIABLES AS INTEGERS" after the word Randomize.
You need to disable the original line in the brain file that reads " LastResponseTime = now"
I placed the Function Script_Load() after the last End Function; just after the Sub Script_Load().
Don't forget to modify the Script_Load section to read the following:
Function Script()
Script_Load =  "<AUTO>30000</AUTO>"
End Function
The script should work, it's working fine for me.  If you still have a problem, let me know.
Jenna[8D]
 

antec2

  • Newbie
  • *
  • Posts: 22
    • View Profile
AUTO-IDLE MODIFIED
« Reply #4 on: December 18, 2003, 07:00:16 pm »
well, got the script successfully pasted in. however, hal still never seems to generate "the first word" when the user is idle. I changed the start and stop valves to match the time of day i was testing, but i really am not sure what im doing wrong. would you mind emailing me your .uhp at kb1160@aol.com? im sure what im doing would be a very obvious mistake to anyone with previous programming experince (i have none). maybe i need to buy that book VBS in a nutshell[:)] to have more fun with this.
thanks
Kman

jenna

  • Newbie
  • *
  • Posts: 23
    • View Profile
AUTO-IDLE MODIFIED
« Reply #5 on: December 19, 2003, 05:52:52 am »
antec2 (Kyle)
did you also download the "User_Idle.brn" file and place it in your DefBrain directory?
jenna [:)]
 

Cobra8007

  • Newbie
  • *
  • Posts: 39
    • View Profile
    • http://www.blackopsmercenaries.us
AUTO-IDLE MODIFIED
« Reply #6 on: December 08, 2004, 04:24:09 pm »
GREAT JOB JENNA !!!!!!!!

I have searched and researched this forum, cut and pasted every script and modification in here.  Yours is the first that worked perfectly!

Thank you so much.

Tom