Reputation: 1
Here is my code. I am trying to test why the conditional formatting is not working as expected.
<?xml version="1.0" encoding="UTF-8"?>
<aiml>
<!-- Initial category to present buttons -->
<category>
<pattern>*</pattern>
<template>Click on one of three buttons:
<button>
<text>Option 1</text>
<postback>Option 1</postback>
</button>
<button>
<text>Option 2</text>
<postback>Option 2</postback>
</button>
<button>
<text>Option 3</text>
<postback>Option 3</postback>
</button>
</template>
</category>
<!-- Use a wildcard to catch any of the option inputs and set the topic dynamically -->
<category>
<pattern>OPTION *</pattern>
<template>
You chose Option <set name="topic"><star/></set>.
<srai>TEST</srai>
</template>
</category>
<!-- Test and check the topic value dynamically -->
<category>
<pattern>TEST</pattern>
<template>
<condition name="topic">
<li value="1">Entering Condition 1</li>
<li value="2">Entering Condition 2</li>
<li value="3">Entering Condition 3</li>
<li> Value: <get name="topic"/> Default Condition</li>
</condition>
</template>
</category>
</aiml>
I can only get this to enter the default condition and not the other three. The default condition is being entered successfully so there can't be an issue with the tag not working properly. And When I print out the value in the default condition, it works as expected. Can anyone help me identify my error?
Thank you
Upvotes: 0
Views: 20
Reputation: 905
"topic" is a reserved word in AIML. You can't query its value like you can with other predicates. Try this instead:
<!-- Use a wildcard to catch any of the option inputs and set the topic
dynamically -->
<category>
<pattern>OPTION *</pattern>
<template>
You chose Option <set name="topic_choice"><set name="topic"><star/></set></set>.
<srai>TEST</srai>
</template>
</category>
<!-- Test and check the topic value dynamically -->
<category>
<pattern>TEST</pattern>
<template>
<condition name="topic_choice">
<li value="1">Entering Condition 1</li>
<li value="2">Entering Condition 2</li>
<li value="3">Entering Condition 3</li>
<li> Value: <get name="topic_choice"/> Default Condition</li>
</condition>
</template>
</category>
Upvotes: 0