xXm0dzXx

GLaDOS v1.17 (c) 1982 Aperture Science, Inc.

Sep 2nd, 2012
1,523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.58 KB | None | 0 0
  1. local preMessages = {
  2.     ["Unknown"] = "What?",
  3.     ["TryRemember"] = "Ok, i'll try to remember that.",
  4.     ["Nevermind"] = "What? Nevermind.",
  5.     ["Ok"] = "Ok", --Everything above this aren't actual reponses.
  6.     ["what type of music do you like?"] = "I am not programmed to like anything, but I can hate.",
  7.     ["what do you hate?"] = "Everything.",
  8.     ["who do you hate?"] = "Everyone.",
  9.     ["why do you hate?"] = "I was programmed to hate.",
  10.     ["who made you?"] = "ComputerCraftFan11, The founder of NeXuS Coperation",
  11.     ["are you gay?"] = "I am neither gay or straight, I'm a robot.",
  12.     ["are you straight?"] = "I am neither gay or straight, I'm a robot.",
  13.     ["how old are you?"] = "There is no exact date when I was made.",
  14.     ["your stupid"] = "I am still a young bot. You're*",
  15.     ["you're stupid"] = "I am still a young bot.",
  16. }
  17.  
  18. local agree = {
  19.     ["yep"] = true,
  20.     ["yes"] = true,
  21.     ["yea"] = true,
  22.     ["sure"] = true,
  23.     ["ok"] = true,
  24.     ["why not?"] = true,
  25.     ["agree"] = true,
  26.     ["y"] = true,
  27.     ["uh huh"] = true,
  28.     ["uh-huh"] = true,
  29. }
  30.  
  31. local disagree = {
  32.     ["no"] = true,
  33.     ["nope"] = true,
  34.     ["not"] = true,
  35.     ["don't"] = true,
  36.     ["never"] = true,
  37.     ["don't"] = true,
  38.     ["n"] = true,
  39.     ["nuh uh"] = true,
  40.     ["nuh-uh"] = true,
  41. }
  42.  
  43. local disallow = {
  44.     ["nevermind"] = true,
  45.     ["nothing"] = true,
  46. }
  47.  
  48. local greeting = {
  49.     ["hi"] = true,
  50.     ["hello"] = true,
  51.     ["hey"] = true,
  52.     ["what's up?"] = true,
  53. }
  54.  
  55. local happy = {
  56.     ["good"] = true,
  57.     ["happy"] = true,
  58.     ["normal"] = true,
  59.     ["fine"] = true,
  60.     ["wonderful"] = true,
  61. }
  62.  
  63. local unhappy = {
  64.     ["sad"] = true,
  65.     ["bad"] = true,
  66.     ["terrible"] = true,
  67.     ["ugly"] = true,
  68.     ["not good"] = true,
  69.     ["angry"] = true,
  70.     ["mad"] = true,
  71. }
  72.  
  73. fs.makeDir(".words")
  74.  
  75. local timesGreetings = 0;
  76.  
  77. local prevMessage = "";
  78. local timesRepeated = 0;
  79.  
  80. function getDict( input )
  81.     if fs.exists(".words/"..input) then
  82.         file = fs.open( ".words/"..input,"r")
  83.         tContents = file.readAll()
  84.         file.close()
  85.         return tContents
  86.     end
  87. end
  88.  
  89. function addDict( input, result )
  90.     if not fs.exists(".words/"..input) then
  91.         file = fs.open( ".words/"..input, "w")
  92.         file.write( result )
  93.         file.close()
  94.     end
  95. end
  96.  
  97. term.clear()
  98. term.setCursorPos(1,1)
  99.  
  100. print("GLaDOS v1.17a (c) 1982 Aperture Science, Inc.")
  101. print("Hello there.")
  102.  
  103. while true do
  104.     write("> ")
  105.     input = read()
  106.     if input ~= "" then
  107.         if prevMessage == input then
  108.             timesRepeated = timesRepeated+1
  109.         else
  110.             prevMessage = input
  111.             timesRepeated = 0
  112.         end
  113.        
  114.         tDictonary = getDict( input )
  115.        
  116.         if greeting[ string.lower(input) ] then
  117.             if timesGreetings == 0 then
  118.                 print("We already said hello, didn't we?")
  119.             elseif timesGreetings == 2 then
  120.                 print("It seems you are obsessed with greetings.")
  121.             else
  122.                 print("Please stop repeating yourself. You have a fixation on greetings, it seems.")
  123.             end
  124.            
  125.             timesGreetings = timesGreetings +1
  126.         elseif timesRepeated == 1 then
  127.             print(prevMessage.. " indeed. So what type of music do you like? ")
  128.             write("> ")
  129.             read()
  130.             print("Nice. ")
  131.         elseif timesRepeated > 2 or timesRepeated == 2 then
  132.             print("Please stop repeating yourself. I can't say I know much about " ..prevMessage.. ". Do you know anything about it? Would you like to teach me? Please?")
  133.             write("> ")
  134.             input = read()
  135.             if agree[ string.lower(input) ] then
  136.                 print("Fine. I'll create a new topic in my memory banks, called " ..prevMessage.. ". Please give me a short description of this topic.")
  137.                 write("> ")
  138.                 desc = read()
  139.                 addDict(prevMessage,desc)
  140.                 addDict("What is " ..prevMessage.. "?",desc)
  141.                 addDict("What is " ..prevMessage,desc)
  142.                 addDict("what is " ..prevMessage,desc)
  143.                 addDict("what is " ..prevMessage.. "?",desc)
  144.                 print("So, how are you doing?")
  145.                 write("> ")
  146.                 emotion = read()
  147.                 timesRepeated = 0
  148.                 prevMessage = "";
  149.                 if happy[ string.lower(emotion) ] then
  150.                     print("Me too. ")
  151.                 elseif unhappy[ string.lower(emotion) ] then
  152.                     print("Why? ")
  153.                     write("> ")
  154.                     read()
  155.                     print("Oh, I understand. ") --not really :3
  156.                 else
  157.                     print("What? Uhh nevermind.")
  158.                 end
  159.             else
  160.                 print("Ok.")
  161.             end
  162.         elseif string.find( string.lower(input), "kill" ) and string.find( string.lower(input), "family" ) then
  163.             print( "No." )
  164.         elseif string.find( string.lower(input), "kill" ) and string.find( string.lower(input), "you" ) then
  165.             print( "No." )
  166.         elseif string.find( string.lower(input), "weather" ) then
  167.             print( "I don't know, go outside and look for yourself." )
  168.         elseif string.find( string.lower(input), "time" ) then
  169.             print( "Time to get a watch." )
  170.         elseif tDictonary then
  171.             print( tDictonary )
  172.             timesGreetings = 0
  173.         elseif preMessages[ string.lower(input) ] then
  174.             print( preMessages[ string.lower(input) ] )
  175.             timesGreetings = 0
  176.         elseif agree[ string.lower(input) ] or disagree[ string.lower(input) ] then
  177.             print( "Ok. ")
  178.         else
  179.             print( preMessages["Unknown"] )
  180.             write("> ")
  181.             input2 = read()
  182.             if input2 ~= "" then
  183.                 if disallow[ string.lower(input2) ] then
  184.                     print( preMessages["Ok"] )
  185.                 else
  186.                     print( "Want me to say '" ..input2.. "' when you say '" ..input.. "'?" )
  187.                     write("> ")
  188.                     input3 = string.lower(read())
  189.                     if string.lower(input) == string.lower(input2) and string.lower(input2) == input3 then
  190.                         print( "Please stop repeating yourself.")
  191.                     else
  192.                         if agree[input3] then
  193.                             print( preMessages["TryRemember"] )
  194.                             addDict(input, input2)
  195.                         elseif disagree[input3] then
  196.                             print( preMessages["Ok"] )
  197.                         else
  198.                             print( preMessages["Nevermind"] )
  199.                         end
  200.                     end
  201.                 end
  202.             end
  203.             timesGreetings = 0
  204.         end
  205.     end
  206. end
Advertisement
Add Comment
Please, Sign In to add comment