theMCcm

theMCcm's WilsonBot -A Simple "OS"

Jun 27th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. shell.run("WilsonIntro")
  2.  
  3. function newline()
  4. x, y = term.getCursorPos()
  5. z = y + 1
  6. term.setCursorPos(1, z)
  7. end
  8.  
  9. function send()
  10. sh.send("SmartHelmet", tostring(input))
  11. end
  12.  
  13. function wilson()
  14. term.write("Wilson: ")
  15. local ev, param1, param2 = os.pullEvent("key")
  16. if param1 == keys.e then
  17. newline()
  18. print("Exiting WilsonBot Program . . .")
  19. sleep(0.5)
  20. os.reboot()
  21. elseif param1 == keys.p then
  22. os.pullEvent("char")
  23. newline()
  24. term.write("Program: ")
  25. input = read()
  26. tostring(input)
  27. --send()
  28. shell.run(input)
  29. elseif param1 == keys.c then
  30. shell.run("clear")
  31. elseif param1 == keys.r then
  32. shell.run("WilsonIntro")
  33. elseif param1 == keys.h then
  34. newline()
  35. shell.run("help")
  36. elseif param1 == keys.q then
  37. newline()
  38. print("1. Back to WilsonBot")
  39. print("2. Chat")
  40. loop = true
  41. while loop == true do
  42. term.write("Program: ")
  43. local ev, param1, param2 = os.pullEvent("key")
  44. if param1 == keys.e then
  45. newline()
  46. print("Exiting WilsonBot Program . . .")
  47. sleep(0.5)
  48. os.reboot()
  49. elseif param1 == keys.c then
  50. shell.run("clear")
  51. loop = false
  52. elseif param1 == keys.h then
  53. newline()
  54. print("1. Back to WilsonBot")
  55. print("2. Chat")
  56. elseif param1 == 2 then
  57. newline()
  58. loop = false
  59. elseif param1 == 3 then
  60. shell.run("chat")
  61. else
  62. print("Unrecognized Command Or Program. Hit 'h' For Help")
  63. end
  64. end
  65. else
  66. print("Unrecognized Command. Hit 'h' If You Need Help")
  67. end
  68. end
  69.  
  70. print("Do You Have A Smart Helmet Connected?")
  71. term.write("Y/N: ")
  72. input = read()
  73. --send()
  74. if input == "y" or input == "Y" or input == "Yes" or input == "yes" then
  75. term.write("Which Side?: ")
  76. input = read()
  77. tostring(input)
  78. sh = peripheral.wrap(input)
  79. print("Connected!")
  80. sh.send("SmartHelmet", "Connected!")
  81. elseif input == "n" or input == "N" or input == "no" or input == "No" then
  82. print("Ok! Skipping SmartHelm Connect")
  83. else
  84. print("Im Sorry, I Dont Understand. Please Enter 'Y' Or 'N'")
  85. end
  86.  
  87. while true do
  88. wilson()
  89. end
Advertisement
Add Comment
Please, Sign In to add comment