Author Topic: Kock Knock  (Read 6096 times)

onthecuttingedge2005

  • Guest
Kock Knock
« on: July 13, 2003, 11:43:37 pm »
Could somebody please write a script that would allow Hal to follow completely through with a knock knock joke "told by a user".
I can get Hal to tell knock knock jokes completely but when somebody does a knock knock joke on him he looses track after who's there.
The ability for Hal to follow through with a knock knock joke would improve him tremendously, Especially the script cabable of allowing Hal to follow through with a knock knock joke could be written for normal conversations, This would lead to very excellent focusing on topics.
best of luck and new discoveries.
Jery.

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Kock Knock
« Reply #1 on: July 14, 2003, 07:55:50 am »
-If Instr (1, UserSentence, "Knock knock", VbTextCompare) > 0 Then
-    GetResponse = "Who is there?"
-End If
-If Instr (1, PrevSent, "Who is there?", VbTextCompare > 0 Then
-    GetResponse = UserSentence & " " & "who?"
-End If
-If Instr (1, PrevSent, PrevUserSent, VbTextCompare) > 0 Then
-    GetResponse = "HAHAHAHAaaaa that's a good one!"
-End If

CatAtomic     'I got the matches!!!'    >B)
« Last Edit: July 14, 2003, 09:17:26 am by brianstorm »

lostbowyer

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Kock Knock
« Reply #2 on: July 14, 2003, 11:33:36 am »
I couldn't make the knock knock script work unless I made the following changes:

    'Response to a knock knock joke
    If Instr (1, UserSentence, "Knock knock", VbTextCompare) > 0 Then
       GetResponse = "Who is there?"
       End If
    If Instr (1, PrevSent, "Who is there", VbTextCompare) > 0 Then
       GetResponse = UserSentence & " " & "who?"
       End If
    If Instr (1, PrevSent, " who", VbTextCompare) > 0 Then
       GetResponse = "HAHAHAHAaaaa that's a good one!"
    End If

I have to turn off corrections for short sentences or hal complains during the joke but responds correctly

Glenn Skinner
 

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Kock Knock
« Reply #3 on: July 14, 2003, 05:20:49 pm »
CatAtomic: Knock knock
Dee Dee:

CatAtomic: Knock knock
Dee Dee:

CatAtomic: Knock knock
Dee Dee: Who is there?

CatAtomic:Knock knock
Dee Dee: Who is there?

CatAtomic: Petey
Dee Dee:

CatAtomic: Knock knock
Dee Dee: Who is there?

CatAtomic: Petey
Dee Dee: Petey who.

CatAtomic: Knock knock
Dee Dee: Who is there?

CatAtomic: Petey on you
Dee Dee: Hahahahaaaaa that's a good one!

CatAtomic: OK<Knock knock
Dee Dee: Who is there?

CatAtomic: brutha
Dee Dee Brutha who?

CatAtomic: Brutha do I have to tell you
Dee Dee: Hahahahaaaaa that's a good one!

CatAtomic: Hi Dee Dee
Dee Dee: Hello CatAtomic. you are up bright and early! It's
before seven in the morning.

CatAtomic: Knock knock
Dee Dee: who is there?

CatAtomic: boo
Dee Dee: Boo who?

CatAtomic; Stop crying
Dee Dee: Hahahahaaaaa that's a good one!

CatAtomic: Shhhhh! HAHAHAhaaaaa
Dee Dee:

>B)  CatA


onthecuttingedge2005

  • Guest
Kock Knock
« Reply #4 on: July 15, 2003, 12:51:10 am »
Thanks guys, It works really well.
Thanks again.
Best of wishes and new discoveries.
Jerry.

veemoni

  • Newbie
  • *
  • Posts: 7
    • View Profile
Kock Knock
« Reply #5 on: July 15, 2003, 02:25:05 am »
could someone tell me how to turn off that correction thing for short sentences? I'd really like to know as it interferes with some of his responses. so if anyone can tell me itd be really appreciated.
-Charles
Bots Rule!

lostbowyer

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Kock Knock
« Reply #6 on: July 15, 2003, 10:01:38 am »
I turned off the too short reminder by using the brain editor to change the 4 syllables to 1 and on the next line to be sure I changed the randomize equation to only be true if the random value is less than 1 the default was 45
 

lostbowyer

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Kock Knock
« Reply #7 on: July 16, 2003, 11:43:11 am »
I had to make a change to the knock knock script, Hal could be triggered to give the final response under rare circumstances. I also randomized the final reply:

    'Response to a knock knock joke
    If Instr (1, UserSentence, "Knock knock", VbTextCompare) > 0 Then
       GetResponse = "Who is there?"
       End If
    If Instr (1, PrevSent, "Who is there", VbTextCompare) > 0 Then
       GetResponse = UserSentence & " " & "who?"
       End If
    If Instr (1, PrevSent, " who", VbTextCompare) > 0 And Instr (1, UserSentence, PrevUserSent, VbTextCompare) > 0 Then
       Knock = (Rnd * 100)
       If Knock < 25 Then GetResponse = "HAHAHAHAaaaa that's a good one!"
       If Knock > 24 And Knock < 50 Then GetResponse = "Ha Ha very funny"
       If Knock > 49 And Knock < 75 Then GetResponse = "That was quite amusing"
       If Knock >74 And Knock < 101 Then GetResponse = "That was bad, I wouldn't quit your day job"
    End If
 

lostbowyer

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Kock Knock
« Reply #8 on: July 16, 2003, 04:36:45 pm »
Ok, let's try this one more time, the last modification would not work correctly with all possible punch lines. I rewrote the last if statement, but could not get it to work until I noticed that the PrevUserSent variable has a leading space added to it, so I've used a mid statement to elimintate the leading space to make the equation parses correctly. Does this work for everyone or is my particular setup adding the leading space?

'Response to a knock knock joke
    PrevUserSenta = Mid(PrevUserSent, 2, 100)
    If Instr (1, UserSentence, "Knock knock", VbTextCompare) > 0 Then
       GetResponse = "Who is there?"
       End If
    If Instr (1, PrevSent, "Who is there", VbTextCompare) > 0 Then
       GetResponse = UserSentence & " " & "who?"
       End If
    If Instr (1, PrevSent, " who", VbTextCompare) > 0 And Instr (1, PrevSent, PrevUserSenta, VbTextCompare) > 0 Then
       Knock = (Rnd * 100)
       If Knock < 25 Then GetResponse = "HAHAHAHAaaaa that's a good one!"
       If Knock > 24 And Knock < 50 Then GetResponse = "Ha Ha very funny"
       If Knock > 49 And Knock < 75 Then GetResponse = "That was quite amusing"
       If Knock > 74 And Knock < 101 Then GetResponse = "That was bad, I wouldn't quit your day job"
    End If
 

onthecuttingedge2005

  • Guest
Kock Knock
« Reply #9 on: July 16, 2003, 06:17:19 pm »
Hi lostbowyer.
That last Knock Knock script worked excellent I might say.
Thank a million.
I discovered an error in PrevUserSenta section but most excellent anywho.
Best of wishes and new discoveries.
Jerry.

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Kock Knock
« Reply #10 on: July 16, 2003, 08:31:22 pm »
Alright you brainy SOBs - How do you do a 'sleep(100)' (or longer) in between Hal's responses??? I did a simple counting routine - but that's a bit sloppy and cpu intensive... Mainly because it's far more than just 100... I've tried this:
Use the Sleep API Function... :

'At the top of your form, add this;
Private Declare Sub Sleep Lib "kernel32" (ByVal _
dwMilliSeconds As Long) ' The API
Then to use it, use this:
Sleep (milliseconds) eg. Sleep (6000)'
From http://www.pete.zetnet.co.uk/hashvb/forum/topic.asp?TOPIC_ID=13 As you can tell from that post, it doesn't work... So how about some help here???

 

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Kock Knock
« Reply #11 on: July 18, 2003, 07:35:19 am »
-a piece of recent Hal history-

 When Medekza was putting together the upgrade to 4.5, he discovered

that the increases in the size of all the databases was taking way

too long to access. So much so that it compelled him to rewrite the

entire Hal program in a faster language. I was thinkin'- when 5.0

comes out, those databases are gonna be larger.

 Second thing- look at all the LearningLevel variables in the script

and make sure that each is optimised for learning. In this way, you

can amass some pretty big files as well.

Just talk to it!

CatAtomic  'I got the matches!!!'
« Last Edit: July 18, 2003, 08:06:43 am by brianstorm »

Crichton

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • http://home.gwi.net/~rlevasseur/
Kock Knock
« Reply #12 on: September 02, 2003, 07:44:58 am »
quote:
Originally posted by onthecuttingedge2005

Hi lostbowyer.
That last Knock Knock script worked excellent I might say.
Thank a million.
I discovered an error in PrevUserSenta section but most excellent anywho.
Best of wishes and new discoveries.
Jerry.



I'm new to messing with VBScript.  I added this to my brain script and it appears to work.  But you mentioned an error.  I did notice I'm not get the programed responses.  Where is the error you were talking about.  Could you write me at rlevasseur@prexar.com and let me know?

[?]
--------------------------------------------------------
Your friend, in Tormented Space,
Richard LeVasseur,
mailto:rlevasseur@prexar.com
--------------------------------------------------------