It's alive!

I have been working on Mac, my JavaScript chatbot for a couple of days.  I won't post it online just yet as it is still in development.

The interface with no CSS.  The previous conversation is stacked up in reverse order.

The JSON file for one input pattern.
The bot works as follows:

The user types some text into the edit box and the system tries to match this with a script object stored in the JSON file.  For each script, if the current conversation subject matches one for the script, it will check whether the user's input matches one of the regular expressions in the 'pattern' array.  If there is a match it will check whether the condition has been met.  If the condition is true it will respond with the data in "whenTrue", otherwise if the condition is false, or if there is no condition, the "whenFalse" block will execute.  In both cases, a random response from the "match" field will be returned.  The system will silently set variables in the 'think' list and set the special conversation variable to the new conversation topic in "setSubject".

The result of the script above is that Mac will respond to some standard greetings "Hi", "Hello", "Hullo", etc.  Should the user type "Hi" again, Mac will have a different response "Hello again".

That's all for now because I have to go, but I'll keep on working and publish the code shortly.