#include "XML.au3" #include #include ;~ #include #include MsgBox (64, "AIML Bot", "Welcome to the AIML Bot made in AutoIt. Your bot is being prepared.") Global $contents = _XMLLoad("brain.aiml") Global $categories_num = __StringNumOccur ($contents, "") MsgBox (0, "info", "found "&$categories_num&" categories.") Global $patterns[$categories_num + 1], $templates[$categories_num + 1] If $categories_num = 0 Then Exit MsgBox (48, "AIML Bot", "AIML Syntax Error:"&@CRLF&@CRLF&"There are no tags. Please check your code and try again.") If $categories_num > __StringNumOccur ($contents, "") Then Exit MsgBox (48, "AIML Bot", "AIML Syntax Error:"&@CRLF&@CRLF&"There is one or more tag without an ending tag. Please check your code and try again.") If $categories_num < __StringNumOccur ($contents, "") Then Exit MsgBox (48, "AIML Bot", "AIML Syntax Error:"&@CRLF&@CRLF&"There is one or more extra tags without beginning tags. Please check your code and try again.") $botinfo = _XMLGet ($contents, "botinfo") If @error Then Exit MsgBox (48, "AIML Bot", "AIML Syntax Error:"&@CRLF&@CRLF&"There is no tag. This tag should contain a tag with the name of your bot, and an tag containing your bot's default response for when a user inputs a message that is unknown to the bot. Please check your code and try again.") $bot_name = _XMLGet ($botinfo, "name") If @error Then Exit MsgBox (48, "AIML Bot", "AIML Syntax Error:"&@CRLF&@CRLF&"There is no tag inside your tag. The tag should contain the bot's name. Please check your code and try again.") $unknown_reply = _XMLGet ($botinfo, "unknown") If @error Then Exit MsgBox (48, "AIML Bot", "AIML Syntax Error:"&@CRLF&@CRLF&"There is no tag inside your tag. The tag should contain your bot's default response for when a user inputs a message that is unknown to the bot. Please check your code and try again.") For $i=1 To $categories_num $cat_contents = _XMLGet ($contents, "category", $i) $cat_pattern = StringLower (StringReplace (StringLower(_XMLGet ($cat_contents, "pattern")), "&botname;", $bot_name)) __StringStripPunct ($cat_pattern) If @error Then Exit MsgBox (48, "AIML Bot", "AIML Syntax Error:"&@CRLF&@CRLF&"Category number "&$i&" does not have a tag. Please check your code and try again.") If $cat_pattern = "" Then Exit MsgBox (48, "AIML Bot", "AIML Syntax Error:"&@CRLF&@CRLF&"The tag in category number "&$i+1&" is empty. Please check your code and try again.") $patterns[$i] = $cat_pattern $cat_template = StringReplace (_XMLGet ($cat_contents, "template"), "&botname;", $bot_name) If @error Then Exit MsgBox (48, "AIML Bot", "AIML Syntax Error:"&@CRLF&@CRLF&"Category number "&$i&" does not have a