rogerdodger Posted June 21, 2022 Share Posted June 21, 2022 Please help me. I don't need the code spoon fed to me, but can you please lead me in the right direction. I am trying to write into the code of my chatbot a way that when I say something to it, and it eventually says that same thing back to me, that the next response I give it, it adds to the collection under what was said that made it say that thing it said. So if I type hello to it, it creates a file called hello.txt and hello1.txt and when I say hi back to it after says hello, it will have hi stored in the hello.txt folder, after previously pulling hello from hello1.txt and which it says to me, so everytime I say anything it gets added, so it can always pull something to say. the questions are gonna be harder, so I need a way to drop the ? from $text everytime a question is asked, because it is impossible to create a text file called how are you doing?.text I came up with a way to make it create the files but I haven't figured out how to link them together, so it knows to pull the text from what you type.txt after reading it from what you type1.txt So I say i went to the mall today, and when it says it back to me I say whatever I say, did you buy anything you like?, and the next time I say i went to the mall, it says did you buy anything you like. And I want it to keep adding to the collections of every thing it says, every time it says different things back to me. Thanks. Please help. Here is my code. Snoop Dogg Webcam Catterbot.au3 Link to comment Share on other sites More sharing options...
rogerdodger Posted June 21, 2022 Author Share Posted June 21, 2022 I figured out a way to create the files without the ? added, not with. Please lead me in the right direction, and I can do it. Like I said I don't need the code spoon fed to me.. Link to comment Share on other sites More sharing options...
Nine Posted June 21, 2022 Share Posted June 21, 2022 870 kB. I would not call it a snippet of your code. Please provide a strict minimal runable script that shows the issue you are facing. Please use tags when you post code as described in the link... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
rogerdodger Posted June 21, 2022 Author Share Posted June 21, 2022 expandcollapse popup#include <File.au3> #include <MsgBoxConstants.au3> call("main") func main() $text = inputbox("Chatting With Snoop Dogg ", "Snoop Dogg: ") if @error = 1 Then Exit endif $copy = ".txt" $file = $text & $copy filewriteLine($file, "") ;no text $copy = "1.txt" $fileand = $text & $copy :rights file just fine filewriteLine($fileand, $text) ;writes file just fine ;I am looking for a way for the script to know the difference between what is typed.txt and what ;is typed.txt and be able to reply with what is in the txt file, I want it to virtually learn, ;and if I say i like pizza, and when it eventually says it back to me, the next time I say so do ;I, so the next time I say I like pizza it says so do i, and whenever I respond to it again after it ;says I like pizza, I want it to give the same responces that I am giving about pizza, back to me ;everytime I say that, and i want it to be able to do it with everything I say. But I don't know ;how to program it, thats all. I just need to be lead in the right direction. if StringInStr ($text, "Snoop Dogg") then shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4") Sleep(Random(6131,6132, 1)) MsgBox(4096, "Snoop Dogg", "That is my name, don't where it out.") else MsgBox(4096, "Snoop Dogg", "Why didn't you call me Snoop Dogg.") call("main") endif Link to comment Share on other sites More sharing options...
rogerdodger Posted June 21, 2022 Author Share Posted June 21, 2022 Quote expandcollapse popup#include <File.au3> #include <MsgBoxConstants.au3> call("main") func main() $text = inputbox("Chatting With Snoop Dogg ", "Snoop Dogg: ") if @error = 1 Then Exit endif $copy = ".txt" $file = $text & $copy filewriteLine($file, "") ;no text $copy = "1.txt" $fileand = $text & $copy :rights file just fine filewriteLine($fileand, $text) ;writes file just fine ;I am looking for a way for the script to know the difference between what is typed.txt and what ;is typed1.txt and be able to reply with what is in the txt file, I want it to virtually learn, ;and if I say i like pizza, and when it eventually says it back to me, the next time I say so do ;I, so the next time I say I like pizza it says so do i, and whenever I respond to it again after it ;says I like pizza, I want it to give the same responces that I am giving about pizza, back to me ;everytime I say that, and i want it to be able to do it with everything I say. But I don't know ;how to program it, thats all. I just need to be lead in the right direction. if StringInStr ($text, "Snoop Dogg") then shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4") Sleep(Random(6131,6132, 1)) MsgBox(4096, "Snoop Dogg", "That is my name, don't where it out.") else MsgBox(4096, "Snoop Dogg", "Why didn't you call me Snoop Dogg.") call("main") endif Link to comment Share on other sites More sharing options...
rogerdodger Posted June 21, 2022 Author Share Posted June 21, 2022 I fixed the code for this script it is now executing. It won't let me delete the other one, so I am just reposting the fixed script. Snoop Dogg Webcam Catterbot.au3 Link to comment Share on other sites More sharing options...
rogerdodger Posted June 21, 2022 Author Share Posted June 21, 2022 But I still need help with what I am trying to do. Can someone help me please? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 21, 2022 Moderators Share Posted June 21, 2022 rogerdodger, Welcome to the AutoIt forums. Quote Can someone help me please? I very much doubt it. You have posted 49000 lines of completely uncommented code and your attempt of explaining what it is you are trying to achieve in the OP is as clear as mud. I suggest you try and formulate what you want to do in a more intelligible form - then we might be able to offer you some advice on how to proceed. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
rogerdodger Posted June 22, 2022 Author Share Posted June 22, 2022 9 hours ago, Melba23 said: rogerdodger, Welcome to the AutoIt forums. I very much doubt it. You have posted 49000 lines of completely uncommented code and your attempt of explaining what it is you are trying to achieve in the OP is as clear as mud. I suggest you try and formulate what you want to do in a more intelligible form - then we might be able to offer you some advice on how to proceed. M23 ago Quote expandcollapse popup#include <File.au3> #include <MsgBoxConstants.au3> call("main") func main() $text = inputbox("Chatting With Snoop Dogg ", "Snoop Dogg: ") if @error = 1 Then Exit endif $copy = ".txt" $file = $text & $copy filewriteLine($file, "") ;no text $copy = "1.txt" $fileand = $text & $copy :rights file just fine filewriteLine($fileand, $text) ;writes file just fine ;I am looking for a way for the script to know the difference between what is typed.txt and what ;is typed1.txt and be able to reply with what is in the txt file, I want it to virtually learn, ;and if I say i like pizza, and when it eventually says it back to me, the next time I say so do ;I, so the next time I say I like pizza it says so do i, and whenever I respond to it again after it ;says I like pizza, I want it to give the same responces that I am giving about pizza, back to me ;everytime I say that, and i want it to be able to do it with everything I say. But I don't know ;how to program it, thats all. I just need to be lead in the right direction. if StringInStr ($text, "Snoop Dogg") then shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4") Sleep(Random(6131,6132, 1)) MsgBox(4096, "Snoop Dogg", "That is my name, don't where it out.") else MsgBox(4096, "Snoop Dogg", "Why didn't you call me Snoop Dogg.") call("main") endif Link to comment Share on other sites More sharing options...
rogerdodger Posted June 22, 2022 Author Share Posted June 22, 2022 I think the simplest way to do this is to randomly send the text in the txt file of what you type1.txt to the message box during the conversation, and then have the what you type.txt save the statement/answer to the statement/question, and then when the randomness picks up on what is typed for the answer program it to say the same statement/answer that you gave for the last question, with multiple answers/statements that it can give, once you have it programed in. So it is virtually learning from what you say, and is always in learning mode. Can you help? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 22, 2022 Moderators Share Posted June 22, 2022 (edited) rogerdodger, Posting several "stream-of-consciousness" lines basically saying the same thing does not help us understand - neither does repeating them as comments within a short script. So one last attempt: I suggest you write a series of short points describing what you want to happen in order - something like this based on what I think you are asking: User types in a comment Script checks if question has been asked before If it has, then picks a random reply from its previous replies If not, then picks a random reply from all possibilities Now, there are obviously more steps that that, but I hope you get the idea. And once you have the steps in order it will help you write the code in a sensible manner. Over to you. M23 P.S. When you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation. Edited June 22, 2022 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Mateocedillo Posted June 22, 2022 Share Posted June 22, 2022 Hello, From what I understand, a solution can be: * Use ControlGet functions. * Get the handle of the edit control, that is, the input field. * then get the text or the last line of the edit control. This can be done with a loop, but you could keep in mind that: * you have to control the way the chat is registered, that is: * if there is new text, do something. Otherwise, it waits until new text is found. * the rest is up to your creativity. Link to comment Share on other sites More sharing options...
rogerdodger Posted June 22, 2022 Author Share Posted June 22, 2022 Spoiler i need whatever is typed into the input box, to be asked back to me, which I can do. But when that thing is asked I need the next thing typed in to be set a long with other lines that are asked when that same thing is said or asked, and pull one of those things up randomly every time I respond to the chatbot with that same saying/statement that was asked. Link to comment Share on other sites More sharing options...
rogerdodger Posted June 22, 2022 Author Share Posted June 22, 2022 1 hour ago, Mateocedillo said: i need whatever is typed into the input box, to be asked back to me, which I can do. But when that thing is asked I need the next thing typed in to be set a long with other lines that are asked when that same thing is said or asked, and pull one of those things up randomly every time I respond to the chatbot with that same saying/statement that was asked. Hello, From what I understand, a solution can be: * Use ControlGet functions. * Get the handle of the edit control, that is, the input field. * then get the text or the last line of the edit control. This can be done with a loop, but you could keep in mind that: * you have to control the way the chat is registered, that is: * if there is new text, do something. Otherwise, it waits until new text is found. * the rest is up to your creativity. i need whatever is typed into the input box, to be asked back to me, which I can do. But when that thing is asked I need the next thing typed in to be set a long with other lines that are asked when that same thing is said or asked, and pull one of those things up randomly every time I respond to the chatbot with that same saying/statement that was asked. Link to comment Share on other sites More sharing options...
Mateocedillo Posted June 22, 2022 Share Posted June 22, 2022 37 minutes ago, rogerdodger said: i need whatever is typed into the input box, to be asked back to me, which I can do. But when that thing is asked I need the next thing typed in to be set a long with other lines that are asked when that same thing is said or asked, and pull one of those things up randomly every time I respond to the chatbot with that same saying/statement that was asked. Ah, I think I understand and I hope you do too. What @rogerdodger wants to do is a chat robot, an example is Elisa or Dr. Abuse, which are robots where you can write any text and the robot responds according to the text you write. And yes, a training process can be done for this, and I see that in your code there are lines with questions and answers from the bot, all with loose conditionals, and this code can be saved with arrays and so on. I have an idea of this, so I could help you, but I would need you to confirm if that is what you are looking for. Link to comment Share on other sites More sharing options...
rogerdodger Posted June 22, 2022 Author Share Posted June 22, 2022 I already have the chat bot created, but yes that is exactly what I am trying to do, is add that to it. I want it to work like it does now, and talk like it does now on the first response, just like it does, I want the 2nd response to be where it answers back to me with the same response that I gave it for the same question or statement that I said in the past. I want this part to take the place of brain.txt the brain.txt is at the very bottom of the 49000 lines of code, but if that statement/question isn't said to me, I want it to use brain.txt to respond back to me on the second response. If you could help that would be awesome. Link to comment Share on other sites More sharing options...
rogerdodger Posted June 22, 2022 Author Share Posted June 22, 2022 Or it would make more sense if it answers right after i say it, after it is programmed in there, cause it would pull the statement on the 2nd response. If you run my script, and talkwith it fora couple minutes, you will see what I mean. Link to comment Share on other sites More sharing options...
Mateocedillo Posted June 23, 2022 Share Posted June 23, 2022 1 hour ago, rogerdodger said: I already have the chat bot created, but yes that is exactly what I am trying to do, is add that to it. I want it to work like it does now, and talk like it does now on the first response, just like it does, I want the 2nd response to be where it answers back to me with the same response that I gave it for the same question or statement that I said in the past. I want this part to take the place of brain.txt the brain.txt is at the very bottom of the 49000 lines of code, but if that statement/question isn't said to me, I want it to use brain.txt to respond back to me on the second response. If you could help that would be awesome. Let's see... First of all, reduce code instead of calling many functions, when in reality these functions can only be linked to one. This also prevents spam, for example this part is repeated the most: shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4") Sleep(Random(6131,6132, 1)) MsgBox(4096, "Snoop Dogg", ($cool1)) Instead of calling these three functions, you can create a function for example _ShowText($sText) here is an example: Func _ShowText($sText) shellexecute("c:/windows/chatterbots/Snoop Dogg.mp4") Sleep(Random(6131,6132, 1)) MsgBox(4096, "Snoop Dogg", $sText) EndFunc Suggestions: In other cases, when I'm talking to the bot it tells me that the video can't be found, obviously because I don't have it. It would be nice if this video playback and sleep time is optional. Link to comment Share on other sites More sharing options...
rogerdodger Posted June 23, 2022 Author Share Posted June 23, 2022 (edited) <snip> We do not accept advertising for payware. M23 Edited June 23, 2022 by Melba23 Link to comment Share on other sites More sharing options...
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