Hello Ponnfar,
-----Regarding the "Rnd" call:
The "Rnd" call creates a random decimal number between zero and one. Therefore "Rnd * 10" creates a random number between zero and ten.
The conditional statement "If Rnd * 10 < 5 Then" means the following:
Generate a random number between zero and ten, and do the next lines of code if the result is less than five; however, if the result is greater than five, skip to the line of code after the "End If" statement.
A code statement such as the above is used when you want something to happen about half the time, and not happen the other half of the time.
-----Regarding my advice on the "DateDiff" function:
In order to use "DateDiff" in place of "Timer" in the routine that you wrote, you would have to do some custom adaptation. If your code is doing what you want it to do, I would recommend going ahead and enjoying it the way that it is.
-----Regarding the "Auto-Idle" function:
I still haven't experimented with the new Auto-Idle function, but your description of what you've done with it so far sounds very good.
In principle, it should be possible to establish a variable in the script that can either be set to "TRUE" or "FALSE" via user conversational input. Pretend that you named the new variable AutoIdleEnable. When the variable AutoIdleEnable was "TRUE," you would have your code written to enable the Auto-Idle routine, and when the variable AutoIdleEnable was "FALSE," you would have your code written so that Hal ignored the Auto-Idle routine. In order for Hal to remember the value of AutoIdleEnable from remark to remark, you would either have to declare it before the first function as a "global variant" (as described in other postings), or save it into the "custom mem" variant (as described in other postings).
-----Regarding remembering the most recent topic:
It would be feasible to add a variant to the script that would be set equal to the most recent topic. Suppose you named that variant MostRecentTopic. Then, under circumstances that you define, you could have Hal respond something like this:
GetResponse = " We were talking about " & MostRecentTopic & " ! "
Of course, MostRecentTopic would have to be either declared before the first function as a global variant, or would have to be saved into CustomMem, in order for Hal to "remember" the variant through conversational exchanges.
I apologize for answering in principle rather than writing the actual code at the moment, but this gets you an answer a lot faster. I hope this is at least somewhat helpful to you.
Best regards,
Don