infiniteblock

Untitled

Jun 17th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.92 KB | None | 0 0
  1. local laws = {
  2.     "Arisa: ",
  3.     "1. Arisa may not injure InfiniteBlock or, through inaction, allow InfiniteBlock to come to harm.",
  4.     "2. Arisa must obey the orders given by InfiniteBlock except where such orders would conflict with the First Law.",
  5.     "3. Arisa must protect its own existence as long as such protection does not conflict with the First or Second Laws."
  6. }
  7. local function split(sText)
  8.     local out = {}
  9.     for match in string.gmatch(sText, "[^ ]+") do
  10.         out[#out + 1] = match
  11.     end
  12.     return out
  13. end
  14. local assistant
  15. local p
  16. local owner
  17. local sides = peripheral.getNames()
  18. for _, side in pairs(sides) do
  19.   if peripheral.getType(side) == "warpdriveVirtualAssistant" then
  20.     assistant = peripheral.wrap(side)
  21. elseif peripheral.getType(side) == "warpdriveBiometricScanner" then
  22.     owner = peripheral.wrap(side)
  23. elseif peripheral.getType(side) == "warpdriveSpeaker" then
  24.     p = peripheral.wrap(side)
  25.   end
  26. end
  27. rednet.open("top")
  28. while true do
  29. local sEvent, param1, param2 = os.pullEvent()
  30. if sEvent == "virtualAssistantCommand" then --and param1 == allowedComputerID then
  31. command, command2 = assistant.getLastCommand()
  32. final = split(command2)
  33. if final[1] == "law" then
  34. for i=1, #laws do
  35. p.speak(laws[i])
  36. sleep(2)
  37. end
  38. elseif final[1] == "owner" then
  39. local try, this, ownername = owner.getScanResults()
  40. p.speak("Arisa: Owner: "..ownername)
  41. elseif final[1] == "loadapi" then
  42. local apicheck = http.get("https://pastebin.com/raw/HJMYtRJ1")
  43. if string.match(apicheck.readAll(), "shutdown") then
  44. p.speak("Arisa: API Blocked Rule #3 Violation.")
  45. sleep(4)
  46. p.speak("I guess we both know that isn't going to happen.")
  47. else
  48. p.speak("Arisa: API Loaded as: "..final[2])
  49. end
  50. elseif final[1] == "update" then
  51. local update = http.get("https://pastebin.com/raw/k80GA2ZQ")
  52. updatetxt = update.readAll()
  53. local h = fs.open("startup", "w")
  54. h.write(updatetxt)
  55. h.close()
  56. p.speak("Arisa: Update Installed Rebooting")
  57. sleep(2)
  58. loginPrompt()
  59. p.speak("Arisa: Update Verification Complete.")
  60. sleep(4)
  61. os.reboot()
  62.  elseif final[1] == "locate" then
  63. if final[2] == "ship" then
  64. local find
  65. local FileList = fs.list("disk/ships/")
  66. for _, file in ipairs(FileList) do
  67.   if string.match(file, "^" ..final[3]) then
  68.     find = file
  69. break
  70.   end
  71. end
  72. if find then
  73. p.speak("Arisa: Located Ship: ")
  74.     local locateship = fs.open("disk/ships/"..find, "r")
  75.     local shiptext = locateship.readAll()
  76.     locateship.close()
  77.     p.speak(shiptext)
  78. else
  79. p.speak("Arisa: No Ship data for: "..final[3])
  80. end
  81. elseif final[2] == "player" then
  82. if fs.exists("disk/players/"..final[3]) then
  83. p.speak("Arisa: Located Player: ")
  84.     local locateplayer = fs.open("disk/players/"..final[3], "r")
  85.     local playertext = locateplayer.readAll()
  86.     locateplayer.close()
  87.     p.speak(playertext)
  88. else
  89. p.speak("Arisa: No Player data for: "..final[3])
  90. end
  91. end
  92. end
  93. elseif sEvent == "modem_message" then
  94. print("Rednet")
  95. p.speak("Rednet")
  96. end
Add Comment
Please, Sign In to add comment