'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.brn1.49 KB