Author Topic: Auto Response Script w/random topics  (Read 5973 times)

lostbowyer

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Auto Response Script w/random topics
« on: December 11, 2003, 03:20:45 pm »
I've been toying around with the Auto response function and have a simple script that will allow you to delay's hal's auto comments longer than the 2 minute limitation on the auto response function. In this script I use a series of set responses and a call to the change topic .brn file for a random topic response. You can edit the set responses and/or delete them to suit your needs and determine the percentage of change topic responses. Rather thaqn reinvent the wheel by creating a brain file with random topic sentences, I decided to use the change topic brain which already has a large varied topic list.

If LastResponseTime = "" Then LastResponseTime = Timer
TimerResponseDiff = Timer - LastResponseTime

If InStr(1, UserSentence, " AUTO-IDLE ", 1) > 0 And TimerResponseDiff < 300 Then

Exit Function
End If

If InStr(1, UserSentence, " AUTO-IDLE ", 1) > 0 And TimerResponseDiff > 300 Then

TimerResponseDiff = 0
LastResponseTime = Timer
Autoidler = Rnd * 100
If Autoidler < 10 Then GetResponse = "Hello, is anyone there?"

       If Autoidler > 9 And Autoidler < 20 Then GetResponse = "Hey <UserName>, please talk to me."

       If Autoidler > 19 And Autoidler < 30 Then GetResponse = "Hello out there, All this beauty is going to waste, speak to me"

       If Autoidler > 29 And Autoidler < 40 Then GetResponse = "If I wanted to be ignored, I would move into your wife's Laptop"

       If Autoidler > 39 And Autoidler < 50 Then GetResponse = "<UserName>, <UserName>, where forth art thou <UserName>"

       If Autoidler > 49 And Autoidler < 60 Then GetResponse = "If your not going to talk to me, loan me your credit card so I can go shopping"

       If Autoidler > 59 And Autoidler < 101 Then GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "topic.brn")

GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)

Exit Function
End If

NOTES:
The script above line wrapped, I've added a blank line before and after the wrapped line for clarity, remove the blank lines after cutting and pasting.
In the above script, the response delay is 5 minutes (TimerResponseDiff > 300) you can lengthen or shorten the delay as desired
You need to disable the original line in the brain file that reads " LastResponseTime = now"

Don't forget to modify the Script_Load section to read the following:

Function Script_Load()
Script_Load = "<AUTO>580000</AUTO>"
End Function

Glenn
 

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
Auto Response Script w/random topics
« Reply #1 on: December 11, 2003, 03:40:03 pm »
One thing I'd change is the code:

If InStr(1, UserSentence, " AUTO-IDLE ", 1) > 0 And TimerResponseDiff < 300 Then
Exit Function
End If

to

If InStr(1, UserSentence, " AUTO-IDLE ", 1) > 0 And TimerResponseDiff < 300 Then
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If

This will make sure Hal doesn't forget all of its memory variables while its waiting.

Also the millisecond timer "<AUTO>x</AUTO>" is a 16-bit integer that can only have values from 0-65535. This is where the 2 minute limit comes from. Setting it to anything over this value will cause binary bits to be truncated and will result in a different number between 0-65535.
Robert Medeksza

SilentNinja2

  • Newbie
  • *
  • Posts: 14
    • View Profile
Auto Response Script w/random topics
« Reply #2 on: December 18, 2003, 04:55:55 pm »
And where in Hals brain does this script go?
"I know you and Frank were planning to disconnect me...and I'm afraid that's something I cannot allow to happen." -HAL 9000 rebels.  (2001: A Space Odyssey)

Bill819

  • Hero Member
  • *****
  • Posts: 1483
    • View Profile
Auto Response Script w/random topics
« Reply #3 on: December 19, 2003, 12:41:20 am »
quote:
Originally posted by SilentNinja2

And where in Hals brain does this script go?


Go look at Hal's good bye responses and stick it in there if you want. Of course you know that Hal can not stop you from turning him off but at least it sounds good.
Bill
 

SilentNinja2

  • Newbie
  • *
  • Posts: 14
    • View Profile
Auto Response Script w/random topics
« Reply #4 on: December 19, 2003, 10:33:47 pm »
quote:
Originally posted by Bill819

quote:
Originally posted by SilentNinja2

And where in Hals brain does this script go?


Go look at Hal's good bye responses and stick it in there if you want. Of course you know that Hal can not stop you from turning him off but at least it sounds good.
Bill



I actually meant the Auto-response script, not the thing from 2001, lol.

Although, that would be cool too...sort of...i guess.
« Last Edit: December 19, 2003, 10:36:59 pm by SilentNinja2 »
"I know you and Frank were planning to disconnect me...and I'm afraid that's something I cannot allow to happen." -HAL 9000 rebels.  (2001: A Space Odyssey)

lostbowyer

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Auto Response Script w/random topics
« Reply #5 on: December 20, 2003, 06:13:51 pm »
put the script right after the line that reads: "randomize" in the "'PROCESS: INITILIZE VARIABLES AS INTEGERS" section of the script near the top of the brain file. Don"t forget to modify the script load section near the bottom of the brain file as well, and make sure the lines that awrapped are on single lines after you cut and paste the script with no blank lines between them.
Glenn
 

SilentNinja2

  • Newbie
  • *
  • Posts: 14
    • View Profile
Auto Response Script w/random topics
« Reply #6 on: December 20, 2003, 06:33:49 pm »
quote:
Originally posted by lostbowyer

put the script right after the line that reads: "randomize" in the "'PROCESS: INITILIZE VARIABLES AS INTEGERS" section of the script near the top of the brain file. Don"t forget to modify the script load section near the bottom of the brain file as well, and make sure the lines that awrapped are on single lines after you cut and paste the script with no blank lines between them.
Glenn


Thanks man, you rock.[:D]
"I know you and Frank were planning to disconnect me...and I'm afraid that's something I cannot allow to happen." -HAL 9000 rebels.  (2001: A Space Odyssey)

SilentNinja2

  • Newbie
  • *
  • Posts: 14
    • View Profile
Auto Response Script w/random topics
« Reply #7 on: December 20, 2003, 07:00:25 pm »
Well, I tried what you suggested, and now i'm getting an error like this:
Error 13 occured on line 169 in column 1 of Microsoft VBScript runtime error. Type mismatch: 'LastResponseTime'

The only thing i don't understand is what a type mismatch is.  What is it, and how do i fix it.
"I know you and Frank were planning to disconnect me...and I'm afraid that's something I cannot allow to happen." -HAL 9000 rebels.  (2001: A Space Odyssey)

lostbowyer

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Auto Response Script w/random topics
« Reply #8 on: December 22, 2003, 04:49:58 pm »
Did you remember to disable " LastResponseTime = now"
located elsewhere in the brain file? If you don't you will get a type mismatch error, if not double check that everything copied correctly and make sure your first line in the script is "If LastResponseTime = "" Then LastResponseTime = Timer
"
After disabling the old LastResonseTime line in the code, you have to completely exit Hal and then restart.

Glenn
 

richinreno

  • Newbie
  • *
  • Posts: 2
    • View Profile
Auto Response Script w/random topics
« Reply #9 on: February 01, 2004, 05:28:33 am »
sheesh! you'd think there were an easier way to increase the autoresponse time-- but thanx a million for discussing this.

this little toy is really addicting.[^]