AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

How can I get wildcards to work with Variables?
 
 

<category>
  i would like * </pattern>
  <template>Allow me to get that <set name=“nameUser”> <star> </set> for ya</template> <set name=“topic”>supply</set>
  </category>
 
  <category>
  ^ get ^ *</pattern>
  <template><srai>i would like *</srai></template>
  </category>

I am currently making a merchant for one of my classes and he is able to sell whatever the user wants. In the first line of coding I set a response that stores the user’s input and responds with “Allow me to get that _____ for ya” However, since there are many ways one could ask to purchase items, I attempted to use wildcards so that when the program sees these words it will respond with the desired response. However, I have been unable to get it to work, please help DX

 

 
  [ # 1 ]

So you can use the srai tag to reuse a basic pattern.  You can have many patterns and ways of asking to purchase items that all call the same response. 

I could not make out your code above because the website strips out unsafe characters.  If you use the advanced response tab and click the code button you will get a pair of code tags and you can paste your code in between them and then we can see your actual pattern properly.  It will look formatted like the code block below after you submit it.  The following patterns work for me:

<category>
    <
pattern>i would like a *</pattern>
    <
template>
        <
srai>i would like <star/></srai>
    </
template>
</
category>

<
category>
    <
pattern>i would like an *</pattern>
    <
template>
        <
srai>i would like <star/></srai>
    </
template>
</
category>

<
category>
    <
pattern>i would like *</pattern>
    <
template>
        <
set name="product"><star/></set>
        
Allow me to get that <get name="Product"/> for you.
    </
template>
</
category
 

 
  login or register to react