fake A.I. conversations
fabiobasile
14 Nov 2007, 18:05Is there a way to produce the same result as with rand() but with text?
What i want to do is to have my character and possibly some NPC selecting random responses from a list so that they "sound" more natural.
Something like:
--------pseudo code----------------
If TalkToNPC
{
1=type("hello")
2=("hi")
3=("hey there!")
4=("what???")
5=("don't bother me")
}
type rand(1,5);
-------end pseudo code-------------
does it make sense?
What i want to do is to have my character and possibly some NPC selecting random responses from a list so that they "sound" more natural.
Something like:
--------pseudo code----------------
If TalkToNPC
{
1=type("hello")
2=("hi")
3=("hey there!")
4=("what???")
5=("don't bother me")
}
type rand(1,5);
-------end pseudo code-------------
does it make sense?
Elexxorine
14 Nov 2007, 22:15define object <character>
speak {
set string <talk[1]; Hello>
set string <talk[2]; Hi>
set string <talk[3]; What?>
set <talknum; $rand(1; 3)$>
msg <Character says, "#talk[talknum]#">
}
That should do it... If you're unsure how to put it in, just ask.