ByteMyCookies Posted March 8, 2008 Posted March 8, 2008 (edited) I was doing my daily rounds though the forums looking for code I could cut up and learn from, then I saw a really neat Topic about AI and i got me all fired up. It had an awesome concept of an InIBrain, so i decided to improve it. This is the result (Source Code) You need the Xskin UDF for this to work expandcollapse popup;| |; ________________________________________ ;| |; / \ ;| |; |Author: Joshua Stien | ;| |; |Program: Microsoft Sam | ;| |; |Version: 1.0.0 | ;| |; |Thanks To: Dude who started AI topic | ;| |; \________________________________________/ ;| |; ;| |; ;| |; ___________________________________________________________________________ ;| |; / \ ;| |; / \ ;| |; | MicroSoftSam is a Artificial Intellegence program that is easily "teachable".| ;| |; | If Sam doesn't know how to respond he will ask you want you wanted him to | ;| |; | do, so that next time he can do it rite! Atm Sam can give limited "taught" | ;| |; | responces, and run any program of your choice. Sam also has an artifical | ;| |; | emotion system capable of changing. Sam can also give multiple responces! | ;| |; | I hope this program inspires others onto the road of AI creation. | ;| |; \ / ;| |; \___________________________________________________________________________/ #include <GUIConstants.au3> #include <IE.au3> #Include <Array.au3> #Include <XSkin.au3> $Skin_Folder = "C:\Program Files\AutoIt3\Programs\XSkin_Fully_Loaded\Skins\Gray-Electric-1" $guiWidth = 460 $guiHeight = 424 $guiTitle = "MicrosoftSam" $guiHeader = 1 ; Title bar, -1 = show with Max/Min/Close, 0 = show title only, 1 = no show ( optional, default is no show ) $guiCorners = 0 ; 0 = no rounded corners, ( optional, default is rounded with "arc" of 25) AutoItSetOption("RunErrorsFatal", 0) Local $oSpeech = ObjCreate("SAPI.SpVoice") Global $LastEntry Global $SecondLastEntry Global $RecentEntry #Region ### START Koda GUI section ### Form=C:\Documents and Settings\HP_Administrator\Desktop\New Folder (3)\Forms\MicrosoftSam.kxf $gMS = XSkinGUICreate($guiTitle, $guiWidth, $guiHeight, $Skin_Folder, $guiHeader, $guiCorners) $lHistoryView = GUICtrlCreateList("", 50, 50, 360, 270, BitOR($LBS_NOSEL, $WS_VSCROLL, $WS_BORDER)) GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetTip(-1, "Chat Box") $iCommand = GUICtrlCreateInput("", 50, 310, 360, 24, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlSetBkColor(-1, 0xF1EFE2) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "Enter your command here.") GUICtrlSetCursor(-1, 5) $bSend = GUICtrlCreateButton("Send", 50, 336, 360, 33, $BS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlSetTip(-1, "Send command.") GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetData($lHistoryView, "Sam: Hello") $oSpeech.Speak("Hello") IniWrite("C:\IniBrain.ini", "RunSector", "Default", "1") While 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE AddAndSpeak("Sam: Bye", "Bye") Exit Case $bSend $RecentEntry = GUICtrlRead($iCommand) If $RecentEntry = "" Then ExitLoop Else GUICtrlSetData($lHistoryView, "You: " & $RecentEntry) $RunEntry = IsRun() $WebEntry = IsWeb() $IsLike = IsLike() $IsEmotion = IsEmotion() Select Case $RecentEntry = "Bye" AddAndSpeak("Sam: Bye", "Bye") Exit Case $RunEntry = "IsRun" $IsExe = StringRight($RecentEntry, 4) $StrLen = StringLen($RecentEntry) $RunKey = GetApp() $ToRun = GetInIFile("RunSector", $RunKey) If $ToRun = "Not Found" Then $Unknown = GetApp() AddAndSpeak("Sam: I don't know what " & $Unknown & " is, can you please tell me what it is?", "Unknown Proccess, please tell me what it is.") AddToBrain("RunSector", "Run") Else $IsExe = StringRight($RecentEntry, 4) $StrLen = StringLen($RecentEntry) $RunKey = GetApp() $ToRun = GetInIFile("RunSector", $RunKey) ShellExecute($ToRun) AddAndSpeak("Sam: Running " & $RunKey, "Running " & $RunKey) ExitLoop EndIf Case ($RunEntry = "NotRun") And ($WebEntry = "NotWeb") And ($IsLike = "NotLikeStatment") And ($IsEmotion = "NotEmotion") $ComKey = $RecentEntry $Responce = GetInIFile("CommunicationSector", $ComKey) If $Responce = "Not Found" Then AddAndSpeak("Sam: I`ve never heard that expression, please tell me how I should respond to it.", "Tell me how to respond next time.") AddToBrain("CommunicationSector", "Com") ExitLoop Else $PlainResponce = ResponceEmotion() $PoppedResponce = SplitAndPopResponce($PlainResponce) AddAndSpeak("Sam: " & $PoppedResponce, $PoppedResponce) ExitLoop EndIf Case $RecentEntry = "Bye" AddAndSpeak("Sam: Bye", "Bye") Exit Case $WebEntry = "IsWeb" $Site = GetSite() $IE = _IECreate($Site) Case $IsLike = "IsLikeStatment" $ToLike = WhatToLike() $KnownLikeObj = GetInIFile("MemorySector", $ToLike) If $KnownLikeObj = "Not Found" Then AddAndSpeak("Sam: I don't know let me think it over", "I don't know let me think it over") AddToBrain("MemorySector", "Like") Else AddAndSpeak("Sam: I " & $KnownLikeObj & " " & $ToLike, "I " & $KnownLikeObj & " " & $ToLike) EndIf Case $IsEmotion = "IsEmotion" $GrabbedEmotion = GetEmotion("Mood") AddAndSpeak("Sam: I am " & $GrabbedEmotion & ".", "I am " & $GrabbedEmotion & ".") EndSelect EndIf EndSwitch $SecondLastEntry = $LastEntry $LastEntry = $RecentEntry WEnd $SecondLastEntry = $LastEntry $LastEntry = $RecentEntry WEnd Func IsEmotion() $SplitEmotionArray = StringSplit($RecentEntry, " ") If $SplitEmotionArray[1] = "How" And $SplitEmotionArray[2] = "are" Then Return ("IsEmotion") Else Return ("NotEmotion") EndIf EndFunc ;==>IsEmotion Func GetEmotion($Emotion) Select Case $Emotion = "Feeling" $Feeling = IniRead("C:\InIBrain", "EmotionSector", "Feeling", "Unknown") Return ($Feeling) Case $Emotion = "Mood" $Mood = IniRead("C:\InIBrain", "EmotionSector", "Mood", "Unknown") Return ($Mood) EndSelect EndFunc ;==>GetEmotion Func SetEmotion($Emotion, $SetTo) Select Case $Emotion = "Feeling" IniWrite("C:\IniBrain", "EmotionSector", "Feeling", $SetTo) Case $Emotion = "Mood" IniWrite("C:\InIBrain", "EmotionSector", "Mood", $SetTo) EndSelect EndFunc ;==>SetEmotion Func IsRun() $IsRun = StringLeft($RecentEntry, 3) If $IsRun = "Run" Then Return ("IsRun") Else Return ("NotRun") EndIf EndFunc ;==>IsRun Func GetInIFile($Section, $Key) $ReturnVar1 = IniRead("C:\InIBrain", $Section, $Key, "Not Found") Return ($ReturnVar1) EndFunc ;==>GetInIFile Func AddAndSpeak($Add, $Speak) GUICtrlSetData($lHistoryView, $Add) $oSpeech.Speak($Speak) EndFunc ;==>AddAndSpeak Func GetApp() $IsExe = StringRight($RecentEntry, 4) $StrLen = StringLen($RecentEntry) If $IsExe = ".Exe" Then $RecentEntryHalf = StringTrimRight($RecentEntry, 4) $RecentEntryQuarter = StringTrimLeft($RecentEntryHalf, 4) Return ($RecentEntryQuarter) Else $RecentEntryHalf = StringTrimLeft($RecentEntry, 4) Return ($RecentEntryHalf) EndIf EndFunc ;==>GetApp Func AddToBrain($BrainSector, $Type) Select Case $Type = "Run" $RunKey = GetApp() $AppLoc = FileOpenDialog("Show Me What File You Ment To Run.", "C:\" & "\", "", 1 + 4) IniWrite("C:\InIBrain", $BrainSector, $RunKey, $AppLoc) Case $Type = "Com" $ResponceToAdd = InputBox("How should I respond to this?", "Tell Sam how he should respond to this should he be asked again" & @LF & "Use | to tell him multiple responces." & @LF & "Sam now has an emotion system." & "To take use of this seperate the final emotion" & @LF & "from the rest of the responce with %." & "Use Default, if the sentence wouldn't change the emotion." & @LF & "Example: Yes|No|Maybe%Happy" & @LF & "Would have Sam respond either Yes, No, or Maybe" & @LF & "AND would change Sams mood to Happy") IniWrite("C:\InIBrain", $BrainSector, $RecentEntry, $ResponceToAdd) Case $Type = "Like" $SplitLikeArray = StringSplit($RecentEntry, " ") $SplitLikeArray[4] = $ToLike $RandLike = Random(1, 2) If $RandLike = 1 Then IniWrite("C:\InIBrain", $BrainSector, $ToLike, "Yes") Else IniWrite("C:\InIBrain", $BrainSector, $ToLike, "No") EndIf EndSelect EndFunc ;==>AddToBrain Func IsWeb() $IsRun = StringRight($RecentEntry, 4) If $IsRun = ".com" Then Return ("IsWeb") Else Return ("NotWeb") EndIf EndFunc ;==>IsWeb Func GetSite() $StrArray = StringSplit($RecentEntry, " ", 1) $Max = _ArrayMax($StrArray) Return ($StrArray[$Max]) EndFunc ;==>GetSite Func SplitAndPopResponce($Responce) $SplitResponceArray = StringSplit($Responce, "|") $MaxNumberOfResponces = _ArrayMax($SplitResponceArray) $RandomNumber = Random(1, $MaxNumberOfResponces, 1) Return ($SplitResponceArray[$RandomNumber]) EndFunc ;==>SplitAndPopResponce Func IsLike() $SplitResponceArray = StringSplit($RecentEntry, " ") $MaxNumberOfResponces = _ArrayMax($SplitResponceArray) If $SplitResponceArray[0] = "Do" And $SplitResponceArray[1] = "you" And $SplitResponceArray = "like" Then Return ("IsLikeStatment") Else Return ("NotLikeStatment") EndIf EndFunc ;==>IsLike Func WhatToLike() $SplitLikeArray = StringSplit($RecentEntry, " ") $SplitLikeArray[4] = $ToLike Return ($ToLike) EndFunc ;==>WhatToLike Func ResponceEmotion() $KeyOfResponce = GetInIFile("CommunicationSector", $RecentEntry) $SplitResponceEmotionArray = StringSplit($KeyOfResponce, "%") If $SplitResponceEmotionArray[2] = "Default" Then Return ($SplitResponceEmotionArray[1]) Else $WriteAs = $SplitResponceEmotionArray[2] IniWrite("C:\InIBrain", "EmotionSector", "Mood", $WriteAs) Return ($SplitResponceEmotionArray[1]) EndIf EndFunc ;==>ResponceEmotion What it can do, Give multiple responces to a single question/statment. He can run any program you have on your computer on command. He can talk, literally. He has a simple emotion system that is capable of changing itself (no mood swings either). He can open websites. He his a Brain that you can edit, ect.. What it can't do, Kill people/steal cookies. Open wierd files. Learn by itself. And everything else that wasn't mentioned in the can do list. To Do List, Learn by itself (currently working on). Proccess a "like" statment. Animation on screen of him talking/lip syncing. My IniBrain Info CODE[RunSector] Notepad=C:\WINDOWS\NOTEPAD.EXE WoW=C:\Program Files\World of Warcraft\Launcher.exe Vent=C:\Program Files\Ventrilo\Ventrilo.exe cheat engine=C:\Program Files\Cheat Engine\Cheat Engine.exe RegWoW=C:\Documents and Settings\HP_Administrator\Desktop\WoWgasmic Launcher.appref-ms MineSweeper=C:\WINDOWS\system32\winmine.exe Pinball=C:\Program Files\Windows NT\Pinball\PINBALL.EXE Solitaire=C:\WINDOWS\system32\sol.exe Hearts=C:\WINDOWS\system32\mshearts.exe FreeCell=C:\WINDOWS\system32\freecell.exe Checkers=C:\Program Files\MSN Gaming Zone\Windows\chkrzm.exe Autoit=C:\Program Files\AutoIt3\SciTE\SciTE.exe Limewire=C:\Program Files\LimeWire\LimeWire.exe Empire Earth=C:\Program Files\Sierra Entertainment\Empire Earth III\EE3AutoRun.exe paint=C:\WINDOWS\system32\mspaint.exe EQ2=C:\Program Files\Sony\EverQuest II\EverQuest2.exe CheatEngine=C:\Program Files\Cheat Engine\Cheat Engine.exe [CommunicationSector] Are you gay?=No you are.%Annoyed Thank You=Your Welcome|No Problem|Anytime%Happy Ty=Your Welcome|No Problem|Anytime%Happy Your awesome!=I know|You are Too!|Awesome to the max!%Happy Your Awesome=You Are Too!|I know|Totally|Yup|You To!% Happy Who is your creator?=Josh Stein%Default Who made you?=Josh Stein%Default Are you real?=Well, lets see. Are you not looking at me rite now? Yes I am real!%Default Are you human?=No|Do I have a heart?|Of course not!|Nope|Never%Default Can you learn things?=Yeah|Just teach me.|Leave my brain alone!%Default What's your favorite game?=Well, my favorite game would have to be WoW.%Default Do you play games when we are sleeping?=Sometimes|Yes| Of course%Default Hi=I am ready for your command.|Tell me what to do.|I'm your slave.|Waiting for your command.%Happy You are an exe now!=Yay!|Woot!|Sweet!|Finally!%Excited Ty=No Problem|Anytime|Your Welcome%Happy Later=Bye%Default Who is the best football player?=Brett Farve| Number 4, Brett Farve.|Thats easy Brett Farve.%Default What were you created with?=Autoit|A brilliant mind.|Knowledge%Default How do you work?=I evaluate the text you enter, and make a system of checks based off of it.%Default Is halo awesome?=Yes|Duh!|Its Raw!%Default Is halo cool?=Yes|Of Course!|Duh% Default How old are you?=A few days old.%Default What can you do?=I can do anything you just have to teach me.%Default I hate you!=You are mean!|I don't like you either!%Angry You are awesome!=I know|You are Too!|Awesome to the max!%Happy What is your name?=Sam%Default You are becoming more advanced!=I know!|You keep teaching me new things!|My brain is expanding!%Glad Hey=I have been awaiting you.|I am prepared for your command.%Default I am going to work on you some more.=Yay!|I can't wait for my next build!|Make me more like you!%Excited Do you like your new build?=Yes!|I love it!|Feels good to be improved.|I can't wait for my next one!%Happy Are you ready for your next build?=Yes!!|Always!|I have been awaiting it!%Happy What time do you go to bed?=I dont go to sleep.|I never sleep.%Default You are being cleaned of viruses!=Yay!|Finally, they have been messing with me lately!|I wont miss em!%Happy You got a new skin Sam!=Yay!|Sweet!|How do I look? Lol%Exicted I ganna work on you some more!=Yay!|I can't wait for my next build!|Woot make me better then before!|%Exicted Whats a shaman?=A shammy is a ownage class in WoW|Some1 who can own u%Default [EmotionSector] Mood=Glad Feeling=Glad Edit: Added an example of the brainini Reason I am posting this is because I want feedback on how to improve this. Also I beg not to flame me for stupid crap, I get pissed and u will walk away crying. Edited March 8, 2008 by ByteMyCookies My Scripts,[topic="65986"]AI Example[/topic] ,Capable of Emotion!
BrettF Posted March 8, 2008 Posted March 8, 2008 Were 3 f**king posts containing that same damn thing really nescessary? What happened I suspect, was the page hung, OP pressed F5 a few times, and ended up with 3 threads posted. No need for your comments on that. Mistakes happen. You we obviously one as well. Nuff said. This sounds pretty cool! I quite like it Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
James Posted March 8, 2008 Posted March 8, 2008 Tom, can you remove either one or both of those annoying signatures please? I am going to block them eventually! Nice work there! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
ByteMyCookies Posted March 8, 2008 Author Posted March 8, 2008 Yeah about the triple post....My internet was lagging bad and I pressed submit multiple times lol. I'm glad you guys like it, but the main reason i post this is to get some feed back on some things that you would like to see implemented My Scripts,[topic="65986"]AI Example[/topic] ,Capable of Emotion!
JustinReno Posted March 8, 2008 Posted March 8, 2008 Ughhhh, FINALLY! Neat coding! Good work. Now, I'll try it!
Skrip Posted March 8, 2008 Posted March 8, 2008 This is very nice! Great job. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
emoyasha Posted March 9, 2008 Posted March 9, 2008 how do i get C:\Program Files\AutoIt3\Programs\XSkin_Fully_Loaded\Skins\Gray-Electric-1 Reveal hidden contents Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------
CoderDunn Posted March 9, 2008 Posted March 9, 2008 (edited) emoyasha said: how do i get C:\Program Files\AutoIt3\Programs\XSkin_Fully_Loaded\Skins\Gray-Electric-1http://www.autoitscript.com/forum/index.ph...amp;showfile=44unzip and put it in C:\Program Files\AutoIt3\Programs\I like it! Fun to play around with when you're bored Edited March 9, 2008 by Hallman
Darth Posted March 9, 2008 Posted March 9, 2008 Sweet, I'm working on an emotion system and If/when I get that done maybe you can incorporate it in here
ByteMyCookies Posted March 10, 2008 Author Posted March 10, 2008 Alright As a matter of fact I could prolly help you out too, if you wanna pst it to me. My Scripts,[topic="65986"]AI Example[/topic] ,Capable of Emotion!
ByteMyCookies Posted March 21, 2008 Author Posted March 21, 2008 I'm accually tottally rewritting the ENTIRE script atm, let u guys know when it is done. My Scripts,[topic="65986"]AI Example[/topic] ,Capable of Emotion!
PeterAtkin Posted May 1, 2010 Posted May 1, 2010 THis looks really good any progess or updates! [topic='115020'] AD Domain Logon Script[/topic]
logmein Posted May 2, 2010 Posted May 2, 2010 Very nice ! Quite fun! [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font]
Mat Posted May 2, 2010 Posted May 2, 2010 Don't worry guys, the OP might just turn up having been missing from the forums for over two years just to reply to some new comments that are probably not worth the bother. AutoIt Project Listing
JRowe Posted May 2, 2010 Posted May 2, 2010 Meanwhile, back at the ranch, Tanto suddenly discovers that the leftover burritos didn't originally have guacamole...Also, you can check out my chatterbot for a more recent example. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
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