AIML

Basic

<!-- groups a pattern and other things together -->
<!-- one pattern and template per category -->
<category>
	<!-- questions are case insensitve and ignore symbols -->
	<!-- do not put symbols in a pattern tag -->
	<pattern>QUESTION</pattern>
	<template>Ans!</template>
</category>

Wildcards and srai

<category>
	<pattern>MY NAME IS *</pattern>
	<template> <star /> </template> <!-- repeats the wild card -->
</category>

<category>
	<pattern>* IS *</pattern>
	<template> <star index="2" /> </template> <!-- repeats the second wildcard -->
</category>

// srai
<category>
	<pattern>TELL ME WHAT * IS</pattern>
	<template><srai>Thing is <star /><srai></template> <!-- calls another category aka the second one -->
</category>

That

<category>
	<pattern>YOUR FIRST QUESTION</pattern>
	<template>FIRST RESPONSE</template> 
</category>

<category>
	<pattern>TELL ME MORE</pattern>
	<that>FIRST RESPONSE</that> <!-- must be a copy and paste of first reponse -->
	<template>FINAL RESPONSE</template> <!-- what aiml responds with given the first question was asked -->
</category>

<category>
	<pattern>TELL ME MORE</pattern>
	<that>response from another question</that>
	<template>diff response</template>
</category>

Random

<category>
	<pattern>YOUR FIRST QUESTION</pattern>
	<template>
		<random>
			<li>random response 1</li>
			<li>random response 2</li>
		</random>
	</template> 
</category>

Variables

<!-- set -->
<category>
	<pattern>MY NAME IS *</pattern>
	<template>Hi <set name="username"><star /></set></template> 
</category>

<!-- set but dont say anything to the user -->
<category>
	<pattern>MY NAME IS *</pattern>
	<template>Hi <think><set name="username"><star /></set></think></template> 
</category>

<!-- get -->
<category>
	<pattern>WHAT IS MY NAME</pattern>
	<template><get name="username" /></template> 
</category>

Condition

<category>
	<pattern>QUESTION *</pattern>
	<template>
		<think><set name="wildcard"><star /></set></think>
		
		<condition name="wildcard" value="word1"> you said word1 </condition>
		<condition name="wildcard" value="word2"> you said word2 </condition>
	</template> 
</category>

Topic Tag

<category>
	<pattern>LETS TALK ABOUT *</pattern>
	<template>okay lets talk about <set name="topic"><star /></set></template> 
</category>

<topic name="apples">
	<category>
		<pattern>WHAT DOES IT LOOK LIKE</pattern>
		<template>round and red</template> 
	</category>
	<category>
		<pattern>WHO BIG IS IT</pattern>
		<template>around the size of your hand</template> 
	</category>
</topic>