Hello,
Please call me "Don." That is my preference for everyone on this forum. You can't be much older or more quaint than me... I'm still in shock because Dean Martin and Jerry Lewis split up!
Now, for your question:
For the most part, it's possible to insert code anywhere in the script, and if the code is written properly, it will run.
Examine the "brain" VBS .uhp script, and you will see a place where it says "Function GetResponse." This is the official start of the GetResponse function. Much later in the script, but not at the end, there is a statement "End Function." The code between those two markers is the "function." There are a couple of other functions at the end of the script, and a function can "call" another function as needed.
As Larry mentioned, inserting code, especially test code, LATER in the Hal script usually makes it more certain that you'll see the results on every exchange. Why? Well, the goal of the GetResponse function is to produce a line for Hal to speak, in the form of a variant named "GetResponse." (Yes, the function and the variant have the same name, but they're two different things.)
Since Hal has many routines to produce possible responses, most of them have a statement in them something like this:
If Len(GetResponse)<4 Then
In English, this line of code is saying this: "Check the length of the string of characters you have at this point in the script for the variant called GetResponse. If the memory-bank-variant named GetResponse is empty so far, or consists of less than 4 letters in length, then proceed with the following routine. Otherwise, skip it."
If GetResponse already has something in it, but a new routine "saves" information to GetResponse, it over-writes the previous contents. Look at this:
GetResponse = "Hi there."
GetResponse = "Goodbye."
These two lines of code would result in GetResponse containing "Goodbye" only, since it would over-write whatever was there previously.
However, look at this:
GetResponse = " Hi there. "
GetResponse = GetResponse & " Goodbye. "
Those two lines of code would result in GetResponse containing "Hi there. Goodbye." This is because you can "concatenate" (couple together like railroad cars) character strings using the ampersand.
Some of the response routines have logic that overrides what was there before. They will "override" whatever is in GetResponse if they come up with something for Hal to say.
The net result is that experimental code placed early in the script has a high chance of being over-written. Late in the script, it isn't so likely to be over-written.
When you get more advanced, of course, you will probably want to put that "If Len(GetResponse)<4" conditional statement in there, and place your routine strategically in your preferred place in "priority order."
I know that there are thousands of postings on this forum, so it's hard to catch up on everything at once, but I do suggest that you go to the "search" function and check out some of my older postings on what the code means and how to program. It may be helpful. And you're always welcome to post more questions, whatever they may be.
I hope this helps a bit. Take care and write again!
Sincerely,
Don