[pandorabots-general] conditions based on > or < values

R. B. Chandler rbchandler at hotmail.com
Wed Apr 25 21:16:17 PDT 2007


There are a number of ways <condition> tags work: <condition name="X" 
value="Y">, <condition name="X">, <li name="X" value="Y">, and <li 
value="Y">. A simple example follows:
<aiml>
    <category>
        <pattern>YES</pattern>
        <template>I see how it could work</template>
    </category>
    <category>
        <pattern>NO</pattern>
        <template>It will never work</template>
    </category>

    <category>
        <pattern>TELL ME</pattern>
        <template>Then say yes or no</template>
    </category>
    <category>
        <pattern>*</pattern>
        <that>THEN SAY YES OR NO</that>
        <template>
            <condition>
                <li value="YES"><srai>YES</srai></li>
                <li value="NO"><srai>NO</srai></li>
            </condition>
        </template>
    </category>
    <category>
        <pattern></pattern>
        <template></template>
    </category>
</aiml>
The above is a simple conditional branch test for the values "Yes" and "No" 
with a completely blank brain. Without some changes the program above could 
clash with the Interjection.aiml file which lumps "yes", "no," and "maybe" 
together. However the responses could be redirected to other categories as 
desired and still use the "yes," "no" value. I could have used any number of 
values but I was only testing "Yes" and "No."

Gaitobot editor can have problems with higher levels of programing within 
the tags it is setup for. www.xmlmarker.com has a free xml editor I find 
useful. The <category> below assumes that the age has been set. If the age 
has not been set there is no value that can be identified and the bot will 
not be able to respond. I'm not sure how a greater than> less than< equation 
would work or even if they would work.

SuperPotent wrote:
>
>Hi, Im new to AIML and have been using gaitobot editor.
>I am trying to set up conditions in a template where the response will
>depend on a person's age.
>so for instance if i have this:
>
>000001: <category>
>000002:     <pattern>
>000003:         I LIKE TO DRINK
>000004:     </pattern>
>000005:     <template>
>000006:         <condition name="age" value=">20">
>000007:             we should get a drink together sometime
>000008:         </condition>
>000009:         <condition name="age" value="<21">
>000010:             you're not even old enough!
>000011:         </condition>
>000012:     </template>
>000013: </category>
>
>now this doesn't work, presumably because i have the > or <  sign within
>the quotation marks, but in gaitobot, they don't seem let you change
>"value="20" to value>"20".  Does anyone know if there is a way to do
>something like this?

_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office 
Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/



More information about the pandorabots-general mailing list