In an earlier post I wrote about the writing process - the process I use to generate the dialogue in AIML for Atomic and Romeo. This post is about the interface and how it works as the interface plays a crucial role in the project. It supplies the timing of the dialogue, the ability to heckle Atomic, and controls to the length of each performance, even allowing the user to terminate a performance.
In this most recent version of the interface there are 1207 lines of code, including inactive comment lines that describe what a function or variable should be doing. There are sixteen functions that control all of the behaviours of the interface. Some of these functions are timers that control the display of text on the screen including a randomly selected set of end-of conversation sign-offs and a random selection of responses to heckles, including some that also act as end-of-conversation sign-offs.
- The four core functions are: askAtomic, askRomeo, onAnswerLoad and onAnswerLoad01. The askAtomic function captures the user's text and sends it to the server. The onAnswerLoad function captures the reply from the server and fires the AskRomeo function sending the reply to Romeo. The onAnswerLoad01 then captures the reply from Romeo and fires the askAtomic function. In the earliest versions of the interface simply getting this to work in a consistent manner was the priority.
- Getting the performance to end was the next development. A variable, simply called 'howMany', counts the number of interactions. When howMany is greater than 26 the onAnswer functions are disabled - stopping the performance.
- The next step in the development was to allow the user to stop the performance. To do to this the interface has to be able to detect which character delivered the last line, otherwise, the sign-off would be both out of sequence and disconcerting. By tracking the current value of the 'howMany' variable it's possible to then test if it has an odd or even value. Atomic always has odd numbered lines - Romeo always has even numbered lines. This allows me to provide the lines in the appropriate order depending on the last speaker via a pair of timer functions.
- Likewise, the heckle function depends on the interface knowing who is speaking. Further, the interface needs to remember the last line the character delivered so that after the heckle is dealt with the original conversation can continue. The are twelve possible 'anti-heckler' lines that Atomic can deliver - two of these replies trigger an extended reply that actually ends the performance.
No comments:
Post a Comment