Sign in to follow this  
Followers 0
oploader

Chat bot help

2 posts in this topic

Hi i keep getting a error in JamesBrooks script "Chat Bot"

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(^ERROR

Error: Variable used without being declared

Please help.

Thanks :)

PS: Here is the script. (Made by JamesBrooks)

#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))

EndFunc

Share this post


Link to post
Share on other sites



Need to add

#include <WindowsConstants.au3>
#include <EditConstants.au3>

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0