James Posted June 30, 2007 Posted June 30, 2007 (edited) Hey,I made a small example chat bot. Basically, it uses the same principles as i542's command interpreter but used slighlty differently.expandcollapse popup#cs Name: AutoChat Bot Author: James Brooks Version: 0.01 #ce #include <GUIConstants.au3> #include <Array.au3> #include <Misc.au3> Global $BrainBank = @ScriptDir & '\brain\bw.ini' Global $Brain[10] $Brain[0] = "Hello" $Brain[1] = @UserName $Brain[2] = "Goodbye" $Brain[3] = "How are you, " & $Brain[1] & "?" $Brain[4] = "I am" $Brain[5] = "How have you been?" $Brain[6] = "I have been" $Brain[7] = "Please" $Brain[8] = "Thankyou" $Brain[9] = "What have you been upto?" Global $Active[3] $Active[0] = "Not alot" $Active[1] = "I have been doing some random things!" $Active[2] = "Nothing. I have been so bored!" Global $Emotion[6] $Emotion[0] = "bad" $Emotion[1] = "OK" $Emotion[2] = "medioka" $Emotion[3] = "great" $Emotion[4] = "not too good" $Emotion[5] = "brilliant" $GUI = GUICreate("AutoChat Bot :: James Brooks", 458, 330, -1, -1) GUISetBkColor(0xC0DCC0) $ChatText = GUICtrlCreateEdit("", 0, 0, 457, 297, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) $ChatInput = GUICtrlCreateInput("", 0, 304, 369, 21) $Send = GUICtrlCreateButton("&Send", 376, 304, 81, 25, 0) GUICtrlSetState($ChatInput,$GUI_FOCUS) ; AUTOMATICALLY FOCUSSES ON THE INPUT GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Send, $ChatInput ; PRESS ENTER WHILE IN THE INPUT BOX TO SEND THE MESSAGE $string = StringSplit(GuiCtrlRead($ChatInput), Chr(44)) Switch $String[1] Case "Hey", "Hi", "Howdy", "Hello" _WriteBack("Hello, " & @Username) GuiCtrlSetData($ChatInput, "") Case "How are you?" $Random = Random(0, UBound($Emotion)-1, 1) $Result = $Emotion[$Random] _WriteBack($Brain[4] & " " & $Result & ". What about yourself?") GuiCtrlSetData($ChatInput, "") Case "What have you been up to?", "What you upto?" $Random1 = Random(0, UBound($Active)-1, 1) $Result1 = $Active[$Random1] _WriteBack($Brain[6] & " " & $Result1 & $Brain[9]) GuiCtrlSetData($ChatInput, "") Case "I am not too good!", "I am not good" _WriteBack("How come?") GuiCtrlSetData($ChatInput, "") Case "I cannot tell you!", "I dont want to say!" _WriteBack("OK, but you just remember I cannot tell anyone else!") GuiCtrlSetData($ChatInput, "") Case Else _WriteBack("I do not understand you. Please try adding that sentence to my brainbank!") GuiCtrlSetData($ChatInput, "") EndSwitch EndSwitch WEnd Func _Brain() $DataRead = GuiCtrlRead($ChatInput) EndFunc Func _AddWord() $NewWord = InputBox("AutoChat Bot", "Please enter a new word for Dillan's brain:") $NewReply = InputBox("AutoChat Bot", "Please enter a reply for, " & $NewWord) IniWrite($BrainBank, "Words", $NewWord, $NewWord) IniWrite($BrainBank, "Reply", $NewReply, $NewReply) _WriteBack($NewWord & " " & $NewReply & " have been successfully added to brain") EndFunc Func _WriteBack($text) GUICtrlSetData($ChatText, $text & @crlf, GUICtrlRead($ChatInput)) EndFuncThanks,JamesEdit: I know that not all $Brain is used! Also, thanks to Manadar for some error solving. Edited July 1, 2007 by Secure_ICT Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
kp3 Posted June 30, 2007 Posted June 30, 2007 Omg! U created a monster ! xD J/K But its cool... You just have to make it more Ai... If i say how are you? Its sais I am bad. What about you. Then i answers: I am hungry. Its sais that it didnt understand me But, i couldnt have made it anny better myself. [s]My scripts =)Password protect process (with tray menu lol)Clickous meousDisable ctrl+alt+del and password protect folder...Andous herous lolKp3s security center v.1Click me[/s]Ok... You shouldnt use annyone of them cuz they use alot of memory and contain alot of errors and stuff.. I was a n00b :P Ignore it... And if u for some reason want to use them... Watch out for my realy bad spelling :I
Toady Posted June 30, 2007 Posted June 30, 2007 Pretty cool, you should check this out.The Turing TestEliza the therapist - the first AI chat bot.Talk with Eliza now! www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding
Gif Posted June 30, 2007 Posted June 30, 2007 (edited) funny!! add more replies , and use $BS_DEFPUSHBUTTON to the send button Edited June 30, 2007 by c4nm7
James Posted July 1, 2007 Author Posted July 1, 2007 Thanks everyone. Toady, I will look at them now and see if there is anything I can do to make it reply with certain words are involved. James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
James Posted July 1, 2007 Author Posted July 1, 2007 I am just wandering, does anyone know if there is away of doing some like Eliza? Where it will look for certain words then reply to that with a question about what has been entered? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
thenewkid Posted July 1, 2007 Posted July 1, 2007 this is somethink like what you are makeing maybe it will give you ideas?http://www.autoitscript.com/forum/index.ph...p;hl=brainbreak some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with
James Posted July 1, 2007 Author Posted July 1, 2007 (edited) Thanks thenewkid.. Thats what I needed! Edited July 1, 2007 by Secure_ICT Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
jvanegmond Posted July 1, 2007 Posted July 1, 2007 (edited) I changed a bit to make it more userfriendly. expandcollapse popup#cs Name: AutoChat Bot Author: James Brooks Version: 0.01 #ce #include <GUIConstants.au3> #include <Array.au3> #include <Misc.au3> Global $BrainBank = @ScriptDir & '\brain\bw.ini' Global $Brain[10] $Brain[0] = "Hello" $Brain[1] = @UserName $Brain[2] = "Goodbye" $Brain[3] = "How are you, " & $Brain[1] & "?" $Brain[4] = "I am" $Brain[5] = "How have you been?" $Brain[6] = "I have been" $Brain[7] = "Please" $Brain[8] = "Thankyou" $Brain[9] = "What have you been upto?" Global $Active[3] $Active[0] = "Not alot" $Active[1] = "I have been doing some random things!" $Active[2] = "Nothing. I have been so bored!" Global $Emotion[6] $Emotion[0] = "bad" $Emotion[1] = "OK" $Emotion[2] = "medioka" $Emotion[3] = "great" $Emotion[4] = "not too good" $Emotion[5] = "brilliant" $GUI = GUICreate("AutoChat Bot :: James Brooks", 458, 330, -1, -1) GUISetBkColor(0xC0DCC0) $ChatText = GUICtrlCreateEdit("", 0, 0, 457, 297, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) $ChatInput = GUICtrlCreateInput("", 0, 304, 369, 21) $Send = GUICtrlCreateButton("&Send", 376, 304, 81, 25, 0) GUICtrlSetState($ChatInput,$GUI_FOCUS) ; AUTOMATICALLY FOCUSSES ON THE INPUT GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Send, $ChatInput ; PRESS ENTER WHILE IN THE INPUT BOX TO SEND THE MESSAGE $string = StringSplit(GuiCtrlRead($ChatInput), Chr(44)) Switch $String[1] Case "Hey", "Hi" ; PROBLEM SOLVED _WriteBack("Hello, " & @Username) GuiCtrlSetData($ChatInput, "") Case "How are you?" $Random = Random(0, UBound($Emotion)-1, 1) $Result = $Emotion[$Random] _WriteBack($Brain[4] & " " & $Result & ". What about yourself?") GuiCtrlSetData($ChatInput, "") Case "What have you been up to?" $Random1 = Random(0, UBound($Active)-1, 1) $Result1 = $Active[$Random1] _WriteBack($Brain[6] & " " & $Result1 & $Brain[9]) GuiCtrlSetData($ChatInput, "") Case "I am not too good!" _WriteBack("How come?") GuiCtrlSetData($ChatInput, "") Case "I cannot tell you!" _WriteBack("OK, but you just remember I cannot tell anyone else!") GuiCtrlSetData($ChatInput, "") Case Else _WriteBack("I do not understand you. Please try adding that sentence to my brainbank!") GuiCtrlSetData($ChatInput, "") EndSwitch EndSwitch WEnd Func _Brain() $DataRead = GuiCtrlRead($ChatInput) EndFunc Func _AddWord() $NewWord = InputBox("AutoChat Bot", "Please enter a new word for Dillan's brain:") $NewReply = InputBox("AutoChat Bot", "Please enter a reply for, " & $NewWord) IniWrite($BrainBank, "Words", $NewWord, $NewWord) IniWrite($BrainBank, "Reply", $NewReply, $NewReply) _WriteBack($NewWord & " " & $NewReply & " have been successfully added to brain") EndFunc Func _WriteBack($text) GUICtrlSetData($ChatText, $text & @crlf, GUICtrlRead($ChatInput)) EndFunc Edited July 1, 2007 by Manadar github.com/jvanegmond
James Posted July 1, 2007 Author Posted July 1, 2007 Thanks Manadar. That is what I was trying to do. I just forgot what to add. Thanks again! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
oploader Posted December 21, 2008 Posted December 21, 2008 I got a error on line 41"$ChatText=GUICtrlCreateEdit("",0,0,457,297,BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSSCROLL))$ChatText=GUICtrlCreateEdit("",0,0,457,297,BitOR(^ERRORError: Variable used without being declared
oploader Posted December 21, 2008 Posted December 21, 2008 I got a error on line 41"$ChatText=GUICtrlCreateEdit("",0,0,457,297,BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSSCROLL))$ChatText=GUICtrlCreateEdit("",0,0,457,297,BitOR(^ERRORError: Variable used without being declaredCan someone please help Me.Thanks
Soru Posted December 21, 2008 Posted December 21, 2008 Can someone please help Me. Thanks I had a similar error. I added the following lines to the top: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> [b][/b]
oploader Posted December 21, 2008 Posted December 21, 2008 I had a similar error. I added the following lines to the top: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> COOL! Thanks! It works now!
oploader Posted December 21, 2008 Posted December 21, 2008 Is there anyway i can make this bot say this stuff on my xat chat?Thanks By the way: Awesome script
James Posted December 21, 2008 Author Posted December 21, 2008 Wow this is old. For chatting on other programs such as xchat, you would need to read the control which could be a little tricky. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
DexterMorgan Posted December 21, 2008 Posted December 21, 2008 Wow this is old.For chatting on other programs such as xchat, you would need to read the control which could be a little tricky.This reminds me of this http://www.titane.ca/igod/real good job! code
AlmarM Posted December 21, 2008 Posted December 21, 2008 I also created some kinda script a long while ago, just with random words. expandcollapse popup$GUI = GUICreate("Sigh,'", 220, 140, -1, -1) GUICtrlCreateLabel("Typ your text", 10, 10) $Input1 = GUICtrlCreateInput("<Text here>", 10, 30, 200, 20) $Button1 = GUICtrlCreateButton("Tell", 10, 60, 60, 25) GUICtrlCreateLabel("Answer back", 10, 90) $Input2 = GUICtrlCreateInput("", 10, 110, 200, 20, 2048) GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = -3 Exit Case $nMsg = $Button1 $Read = GUICtrlRead($Input1) If StringRight($Read, 1) = "?" Then GUICtrlSetData($Input2, _MsgBack2()) ElseIf StringRight($Read, 1) = "!" Then GUICtrlSetData($Input2, _MsgBack3()) Else GUICtrlSetData($Input2, _MsgBack()) EndIf EndSelect WEnd Func _MsgBack() Local $n_Msg[18] $n_Msg[0] = "Hello!" $n_Msg[1] = "Don't want to talk right now." $n_Msg[2] = "Realy?!" $n_Msg[3] = "Oops! Sorry!" $n_Msg[4] = "Well, OK!" $n_Msg[5] = "Oh, hello again!" $n_Msg[6] = "Ye, I know." $n_Msg[7] = "Life is hard..." $n_Msg[8] = "Talk to your friend about it." $n_Msg[9] = "Do I look like I care?" $n_Msg[10] = "Tell you parents!" $n_Msg[11] = "Tralala LIE!" $n_Msg[12] = "Humptie Dumpie!" $n_Msg[13] = "How do you feel about it?" $n_Msg[14] = "What?" $n_Msg[15] = "Whoooohooooo!" $n_Msg[16] = "Wanne hear a story?" $n_Msg[17] = "I love AutoIt, do you?" Return $n_Msg[Random(18)] EndFunc Func _MsgBack2() Local $n_Msg[11] $n_Msg[0] = "I can't answer that question." $n_Msg[1] = "Hmmmm... Don't know that one!" $n_Msg[2] = "Well, ask you parents." $n_Msg[3] = "You already asked that." $n_Msg[4] = "What did u do?" $n_Msg[5] = "Why you ask me?" $n_Msg[6] = "Stop asking questions!" $n_Msg[7] = "Yes." $n_Msg[8] = "No." $n_Msg[9] = "I Fine." $n_Msg[10] = "Bad." Return $n_Msg[Random(11)] EndFunc Func _MsgBack3() Local $n_Msg[8] $n_Msg[0] = "Stop shouting at me!" $n_Msg[1] = "Stop yelling at me!" $n_Msg[2] = "I wont answer if you yell at me." $n_Msg[3] = "*IGNORE*" $n_Msg[4] = "I hate people who shout at me!" $n_Msg[5] = "Did I already say, STOP YELLING!" $n_Msg[6] = "Can you stop shouting?" $n_Msg[7] = "OK!" Return $n_Msg[Random(8)] EndFunc AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now