In aiml how to make bot answer questions like what is your name, your age, where do you live only once I did not understand this code
<category>
<pattern>INQUIRY AGE</pattern>
<template><srai>INQUIRY AGE <get name="age"/></srai></template>
</category>
<category>
<pattern>INQUIRY AGE HOW MANY</pattern>
<template>How old are you?</template>
</category>
<category>
<pattern>INQUIRY AGE *</pattern>
<template><srai>RANDOM PICKUP LINE</srai>
</template>
</category>
Also from UDC
<random>
<li>INQUIRY AGE</li>
</random>
How to make bot ask these questions once?
Instead of using the <random>
tag, you need to set a counter so the bot knows which question to ask and increase it each time. This will do it:
<category>
<pattern>ASK ME A QUESTION</pattern>
<template>
<condition name="question">
<li value="unknown">
<think>
<set name="question">1</set>
</think>
How old are you?
</li>
<li value="1">How old are you?</li>
<li value="2">What is your name?</li>
<li value="3">Where do you live?</li>
<li>no more questions to ask...</li>
</condition>
<think>
<set name="question">
<map name="successor"><get name="question"/></map>
</set>
</think>
</template>
</category>