After a brief battle with some basic code design problems which lead me to write and rewrite a very complex and important piece of code, I was able to quickly and easily (using 12 lines of code I might add) make the following addition:
waitfor OBJ who, STR speach type, STR response variable
�<who> is who you want to wait for a response from
�<speach type> is the 'response type' you want to wait for. Presently only "speach" is supported.
�<response variable> is the variable to hold what the response was.
�This causes the NPC to wait for <who> to say something to them, and puts what they said in the variable <response variable>. It returns 1 if it got a response within 2 minuits, else 0.
Why is this useful you ask?
Let's give an example.
Your NPC says something to the player, then needs to wait for a response from them. Depending on what the player says, (assuming he says anything at all) the NPC might do different things.
So Let's just do a basic script with this example.
say "Say something."
if waitfor %player "speach" "response"
�say "You said: " %response
�if match %response "fuck" or match %response "shit"
� �say "Hey man, that's a dirty word."
�say "I didn't hear you say anything."
We can call this the 'polly parrot' script because it makes the NPC say something, then repeats what the player says, and potentially makes a comment about it. In the case where the player dosn't say anything in 2 minuits or less, the NPC says "I didn't hear you say anything." after the 2 minuits are up.
Yes, 2 minuits is easily adjusted. No, we don't have a way to set it but were thinking there should be one.
Questions, comments, screams of agony, and other cries for help go below.
As an aside: In embarking in the journey that was writing all the complex underlying code necessary to make something like this possible, and even simple, (and changing a few existing things in the process) I was make very aware of the following interesting bit of trivia:
The average person dosn't like 'big' words. I define big words as ones that are not commonly used in every day usage like 'Transient' and 'Mutually Exclusive'. They see or hear them and are daunted by them. They cry out 'You use big words, and I don't understand!', yet they are english words with dictionary definitions. They even go as far in their fear of these words as to accuse the user of the words of having a 'superiority complex', which is ironic because 'superiority complex' are big words. They ignore their context, and their provided definition. They can't see past the number of letters and through to the meaning.
To these people I offer my appologies. My intention was not to confuse you, but to enlighten you. I use big words because we have a rich language which supports complex concepts such as 'Transient' when refering to something that is on the move, temporary, or fleeting, or 'Mutually exclusive' when refering to two conditions which cannot co-exist. I provide definitions of these words there with their usage so that you need not look further than the words after the word you don't understand in the hopes to allow you to easily follow.
If I had a superiority complex, I would not bother to do these things. I would say, "Bah, your all dumb. Figgure it out your damn self." and just use big words to spite you. But that's not the case.
Instead I'll use another big word: Ignorant.
Because we all are. You, me, and everyone else in this world, there's all things we don't know; that were ignorant about. But we learn. We grow. Don't be afraid of doing it.
(Edited by Kevlar at 3:01 am on Oct. 30, 2002)