ELIPTZA : The Iptscrae Eliza

ELIPTZA is my Iptscrae version of the famous ELIZA; arguably the first "ChatBot" ever written. Originally intended to simulate a psychotherapy session, the bot responds to most statements by inverting the speaker's sentences and handing them back in the form of a question, asking you to elucidate or clarify your opinion. This approach, while occassionally annoying, does a pretty good job of keeping the conversation going for a while. Many people will talk with Eliptza for several minutes before they realize she is a bot.

ELIPTZA is a complex script, divided among multiple SPOTs. For this reason, the script is presented here as an entire Palace ROOM (with the default background "clouds.gif". To use the script, simply plug the entire room into your Pserver.pat file (making sure you don't use a room number that already exists in your Palace). You'll also have to provide your own graphic for Eliptza herself; to do this, make a new SPOT with the graphic of your choice, and move it into position so that her mouth is located in the middle of the room. Happy chatting!
ROOM ID 500
NAME "Chat With Eliptza"
PICT "clouds.gif"
SPOT
ID 1
NAME "1"
DONTMOVEHERE
OUTLINE 0,0 50,0 50,50 0,50
SCRIPT
ON ENTER {
"@256,192Hello. What's up?" LOCALMSG
}
ON OUTCHAT {
addStr GLOBAL
" " CHATSTR & " " & addStr =
lastStr GLOBAL
{ "@256,192You're repeating yourself!" LOCALMSG } addStr lastStr == IF
addStr lastStr =
addStr LOWERCASE addStr =
; SENTENCE INVERSION
{ "$1 your# $2" GREPSUB addStr = } { addStr "^(.*) my (.*)$" GREPSTR } WHILE
{ "$1 you@ are@ $2" GREPSUB addStr = } { addStr "^(.*) i'm (.*)$" GREPSTR } WHILE
{ "$1 you@ $2" GREPSUB addStr = } { addStr "^(.*) i (.*)$" GREPSTR } WHILE
{ "$1 are@ $2" GREPSUB addStr = } { addStr "^(.*) am (.*)$" GREPSTR } WHILE
{ "$1 my $2" GREPSUB addStr = } { addStr "^(.*) your (.*)$" GREPSTR } WHILE
{ "$1 I am $2" GREPSUB addStr = } { addStr "^(.*) you're (.*)$" GREPSTR } WHILE
{ "$1 you $2" GREPSUB addStr = } { addStr "^(.*) me (.*)$" GREPSTR } WHILE
{ "$1 me $2" GREPSUB addStr = } { addStr "^(.*) you (.*)$" GREPSTR } WHILE
{ "$1 myself $2" GREPSUB addStr = } { addStr "^(.*) yourself (.*)$" GREPSTR } WHILE
{ "$1 yourself $2" GREPSUB addStr = } { addStr "^(.*) myself (.*)$" GREPSTR } WHILE
{ "$1 i'm $2" GREPSUB addStr = } { addStr "^(.*) me are (.*)$" GREPSTR } WHILE
{ "$1 was $2" GREPSUB addStr = } { addStr "^(.*) were (.*)$" GREPSTR } WHILE
{ "$1 you were $2" GREPSUB addStr = } { addStr "^(.*) you@ was (.*)$" GREPSTR } WHILE
{ "$1 why@ don't i $2" GREPSUB addStr = } { addStr "^(.*) why don't me (.*)$" GREPSTR }
WHILE { "$1 why@ can't you@ $2" GREPSUB addStr = } { addStr "^(.*) why can't you@ (.*)$"
GREPSTR } WHILE
; GRAMMAR MODIFICATION
{ "$1 $2" GREPSUB addStr = } { addstr "^(.*),(.*)$" GREPSTR } WHILE
{ "$1 $2" GREPSUB addStr = } { addstr "^(.*)?(.*)$" GREPSTR } WHILE
{ "$1 $2" GREPSUB addStr = } { addstr "^(.*)!(.*)$" GREPSTR } WHILE
30 2 SETALARM
}
ENDSCRIPT
ENDSPOT

SPOT
ID 2
NAME "2"
DONTMOVEHERE
OUTLINE 50,0 100,0 100,50 50,50
SCRIPT
ON ALARM {
addStr GLOBAL
; KEYWORD RESPONSES - SIMPLE
{ "Computers are great, and I like them!" addStr = } addstr " computer " SUBSTR addstr "
computers " SUBSTR OR IF { "Names, who needs names?" addStr = } addstr " name " SUBSTR addstr " names " SUBSTR OR
IF { "Why do you ask?" addStr = } addstr " what " SUBSTR addstr " when " SUBSTR OR IF
{ "In what way?" addStr = } addstr " alike " SUBSTR addstr " same " SUBSTR OR IF
{ "How does that dream make you feel?" addStr = } addstr " dream " SUBSTR IF
{ "Can you think of a specific example?" addStr = } addstr " always " SUBSTR IF
{ "Is that the real reason?" addStr = } addstr " because " SUBSTR IF
{ "You seem quite sure!" addStr = } addstr " yes " SUBSTR IF
{ "How do you do?" addStr = } addstr " hello " SUBSTR addstr " hi " SUBSTR OR IF
{ "I'm actually quite boring. Let's talk about you!" addStr = } addstr " i'm " SUBSTR IF
{ "Are you sure?" addStr = } addstr " maybe " SUBSTR addstr "s why " SUBSTR OR IF
{ "I think you know why." addStr = } addstr " why " SUBSTR IF
{ "Aren't we just a bit negative today?" addStr = } addstr " no " SUBSTR IF
{ "Apology accepted! Now let's move on." addStr = } addstr " sorry " SUBSTR IF
{ "Sorry, I'm a pure-bred American!" addStr = } addstr " espanol " SUBSTR addstr "
francais " SUBSTR OR IF
{ "How is she doing these days?" addStr = } addstr " she " SUBSTR IF
{ "Did you know I dated him once?" addStr = } addstr " he " SUBSTR IF
{ "Really? No one at all?" addStr = } addstr " no one " SUBSTR addstr " nobody " SUBSTR
OR IF { "Oh yeah? Absolutely everyone?" addStr = } addstr " everyone " SUBSTR addstr "
everybody " SUBSTR OR IF
30 3 SETALARM
}
ENDSCRIPT
ENDSPOT

SPOT
ID 3
NAME "3"
DONTMOVEHERE
OUTLINE 100,0 150,0 150,50 100,50
SCRIPT
ON ALARM {
addStr GLOBAL
; KEYWORD RESPONSES - COMPLEX
{ "Do you often think about $1" "?" & GREPSUB addStr = } addStr " you@ remember (.*)$"
GREPSTR IF { "Did you really think I would forget $1" "?" & GREPSUB addStr = } addStr " do i
remember (.*)$" GREPSTR IF
{ "Really... $1" "?" & GREPSUB addStr = } addStr " you@ dreamed (.*)$" GREPSTR IF
{ "Did you say $1" "?" & GREPSUB addStr = } addStr " you@ dreamt (.*)$" GREPSTR IF
{ "Do you really think that's likely? If $1" "?" & GREPSUB addStr = } addStr " if (.*)
$" GREPSTR IF { "What if you were $1" "?" & GREPSUB addStr = } addStr " was you@ (.*)$" GREPSTR IF
{ "Would you like to believe I was $1" "?" & GREPSUB addStr = } addStr " was me (.*)$"
GREPSTR IF { "Why is that your $1" "?" & GREPSUB addStr = } addStr " your# (.*)$" GREPSTR IF
{ "Why are you so interested in whether i'm@ $1" " or not?" & GREPSUB addStr = } addStr
" are me (.*)$" GREPSTR IF { "Do you believe that you're $1" "?" & GREPSUB addStr = } addStr " are@ you@ (.*)$"
GREPSTR IF { "Did you think they might not be $1" "?" & GREPSUB addStr = } addStr " are (.*)$"
GREPSTR IF
{ "You believe I can $1" ", don't you?" & GREPSUB addStr = } addStr " can me (.*)$"
GREPSTR IF
{ "Whether you can $1" " depends more on you than me!" & GREPSUB addStr = } addStr " can
you@ (.*)$" GREPSTR IF { "What makes you think I'm $1" "?" & GREPSUB addStr = } addStr " i am (.*)$" GREPSTR IF
{ "What makes you think I am $1" "?" & GREPSUB addStr = } addStr " i'm (.*)$" GREPSTR IF
{ "Why are concerned over my $1" "?" & GREPSUB addStr = } addStr " my (.*)$" GREPSTR IF
{ "Do you believe I don't $1" "?" & GREPSUB addStr = } addStr " why@ don't i (.*)$"
GREPSTR IF
{ "Do you think you should be able to $1" "?" & GREPSUB addStr = } addStr " why@ can't
you@ (.*)$" GREPSTR IF ; TAG REMOVAL
{ "$1$2" GREPSUB addStr = } { addStr "^(.*)@(.*)$" GREPSTR } WHILE
{ "$1$2" GREPSUB addStr = } { addStr "^(.*)#(.*)$" GREPSTR } WHILE
30 4 SETALARM
}
ENDSCRIPT
ENDSPOT

SPOT
ID 4
NAME "4"
DONTMOVEHERE
OUTLINE 150,0 200,0 200,50 150,50
SCRIPT
ON ALARM {
addStr GLOBAL
"@256,192 " addStr & LOCALMSG
}
ENDSCRIPT
ENDSPOT

ENDROOM


Department:
Personnel:
Technologies:
File attachments: 
AttachmentSize
Plain text icon eliptza.txt5.74 KB