Tuesday, July 24, 2012
New random end of conversation text.
I've re-worked the sign-off that signals the end of the conversation. Initially it was static - a three line block that was delivered by the Flash interface. When the performance reached 20 lines the following text was delivered.
Romeo: That's enough out of us.
Atomic: That's enough out of you.
Romeo: Enough already!
Don't be afraid, but it is time for a little Actionscript code.
In this latest version (ARbotsAS3v04.swf) I've built in a variable called 'whichEnding'. The variable holds a random number with the possible values of 4, 3, 2, 1 or 0. These values are generated by the following line.
var whichEnding:Number = Math.floor(Math.random()*5);
In the code is another variable that counts how many lines have been interchanged - it has the truly imaginative name of 'howMany'. Once the value of 'howMany' reaches 20 a function fires the following set of if-statements.
if(whichEnding == 4) {
Romeo: That's enough out of us.
Atomic: That's enough out of you.
Romeo: Enough already!
} else if(whichEnding == 3){
Romeo: The show's over folks.
Atomic: You don't have to go home...
Romeo: But you can't stay here!
} else if(whichEnding == 2){
Romeo: Our work here is done.
Atomic: Atomic has left the building, thank you and goodnight.
Romeo: That jumpsuit is a little tight...
} else if(whichEnding == 1){
Romeo: Live long, and prosper.
Atomic: Die young, and leave a pretty corpse!
Romeo: So how's that working out for you?
} else {
Romeo: That's enough thinking.
Atomic: The Budda said - With our thoughts we make the world.
Romeo: Yes Monkey - and it's a very small world.
}
The result is that there are five possible sign-offs. I've simplified the code for the purposes of illustration but the logic remains the same.
Why bother? The single sign-off was not strong enough to have 'catch-phrase' status. Rather than fighting to find a Simpson-esque phrase I felt that Atomic and Romeo could show just a bit of variability.
PS > The variable names are purposefully written in camelCase. This really shows my age - camelCase is an old tradition in programing that came from Pascal and other languages. It's generally good advice to avoid spaces in names.
PPS > I've given up on the free AIML set. It takes far too much editing on all levels: punctuation, tone, factual content. There is far too much in the set that affected the personality of the characters. The blank slate approach is the only real option. I will end up with less content but it will be better targeted and it will, if nothing else, be all of my doing.
Romeo: That's enough out of us.
Atomic: That's enough out of you.
Romeo: Enough already!
Don't be afraid, but it is time for a little Actionscript code.
In this latest version (ARbotsAS3v04.swf) I've built in a variable called 'whichEnding'. The variable holds a random number with the possible values of 4, 3, 2, 1 or 0. These values are generated by the following line.
var whichEnding:Number = Math.floor(Math.random()*5);
In the code is another variable that counts how many lines have been interchanged - it has the truly imaginative name of 'howMany'. Once the value of 'howMany' reaches 20 a function fires the following set of if-statements.
if(whichEnding == 4) {
Romeo: That's enough out of us.
Atomic: That's enough out of you.
Romeo: Enough already!
} else if(whichEnding == 3){
Romeo: The show's over folks.
Atomic: You don't have to go home...
Romeo: But you can't stay here!
} else if(whichEnding == 2){
Romeo: Our work here is done.
Atomic: Atomic has left the building, thank you and goodnight.
Romeo: That jumpsuit is a little tight...
} else if(whichEnding == 1){
Romeo: Live long, and prosper.
Atomic: Die young, and leave a pretty corpse!
Romeo: So how's that working out for you?
} else {
Romeo: That's enough thinking.
Atomic: The Budda said - With our thoughts we make the world.
Romeo: Yes Monkey - and it's a very small world.
}
The result is that there are five possible sign-offs. I've simplified the code for the purposes of illustration but the logic remains the same.
Why bother? The single sign-off was not strong enough to have 'catch-phrase' status. Rather than fighting to find a Simpson-esque phrase I felt that Atomic and Romeo could show just a bit of variability.
PS > The variable names are purposefully written in camelCase. This really shows my age - camelCase is an old tradition in programing that came from Pascal and other languages. It's generally good advice to avoid spaces in names.
PPS > I've given up on the free AIML set. It takes far too much editing on all levels: punctuation, tone, factual content. There is far too much in the set that affected the personality of the characters. The blank slate approach is the only real option. I will end up with less content but it will be better targeted and it will, if nothing else, be all of my doing.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment