Advertisement
ArbitraryHubris

MobController

Dec 26th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Arbitrary ToDo List
  2. -- DONE code for turtle to place and retrieve safari net from spawner
  3. -- DONE remote communication from MobBoard to MobTurtle
  4. -- DONE badly - turtle loading interface (asks for safari nets to be placed in specific slots)
  5. -- DONE turtle listen program; must have ability to figure out what it has placed on restart and restore communication with board
  6. -- board program will need to listen for turtle and when it has a turtle put up the button board
  7. -- create dictionary of safari nets and change to one function for all nets
  8.  
  9.  
  10.  
  11. rs.setBundledOutput("back", 0)
  12. m = peripheral.wrap("right")
  13. m.setBackgroundColor(colors.black)
  14. m.setTextColor(colors.white)
  15. m.setTextScale(1)
  16. m.setCursorPos(1,1)
  17. m.setTextColor(colors.black)
  18. m.setBackgroundColor(colors.lightGray)
  19. m.write("    MFR Auto-Spawner Control Panel     ")
  20. m.setCursorPos(1,3)
  21. m.setTextColor(colors.black)
  22. m.setBackgroundColor(colors.lightGray)
  23. m.write("Current Mob:")
  24. e = "    None    "
  25. line1 = 2
  26. line2 = 15
  27. line3 = 28
  28. y = 0
  29. modem = peripheral.wrap("left")
  30.  
  31.  
  32. --Functions--
  33.  
  34. function selectMob(selection)
  35.     modem.transmit(1001,999,selection)
  36. end
  37.  
  38. function reset()
  39.     rs.setOutput("top", true)
  40.     sleep(1)
  41.     rs.setOutput("top", false)
  42. end
  43.  
  44. function format()
  45.     m.setTextColor(colors.black)
  46.     m.setBackgroundColor(colors.lightGray)
  47. end
  48.  
  49. function CurrMob()
  50.     m.setCursorPos(15, 3)
  51.     format()
  52.     m.write(e)
  53. end
  54.  
  55. --Main--
  56. reset()
  57. m.setCursorPos(line3 + 3, 3)
  58. format()
  59. m.write(" Reset ")
  60. m.setCursorPos(1,5)
  61. format()
  62. m.write("--------------Select One---------------")
  63. m.setCursorPos(line1, 7)
  64. format()
  65. m.write(" Enderman ")
  66. m.setCursorPos(line2, 7)
  67. format()
  68. m.write("  Ghast   ")
  69. m.setCursorPos(line3, 7)
  70. format()
  71. m.write("  Sheep   ")
  72. m.setCursorPos(line1, 9)
  73. format()
  74. m.write("  Blaze   ")
  75. m.setCursorPos(line2, 9)
  76. format()
  77. m.write("  Slime   ")
  78. m.setCursorPos(line3, 9)
  79. format()
  80. m.write("  Witch   ")
  81. m.setCursorPos(line3, 11)
  82. format()
  83. m.write(" Creeper  ")
  84. m.setCursorPos(line1, 11)
  85. format()
  86. m.write("   Cow    ")
  87. m.setCursorPos(line2, 11)
  88. format()
  89. m.write("Iron Golem")
  90. m.setCursorPos(line1, 13)
  91. format()
  92. m.write(" Wither Skeleton ")
  93.  
  94. -- Main event loop
  95. while true do
  96.     event, p1, p2, p3 = os.pullEvent("monitor_touch")
  97.     x = p2
  98.     y = p3
  99.     m.setCursorPos(15,3)
  100.     format()
  101.     m.write(e)
  102.  if x>line1 and x<12 and y == 7 then
  103.     e = " Enderman "
  104.     CurrMob()
  105.     reset()
  106.     y = 7
  107.     selectMob("enderman")
  108.  elseif x>line2 and x<25 and y == 7 then
  109.     e = "  Ghast   "
  110.     CurrMob()
  111.     reset()
  112.     y = 7
  113.     selectMob("ghast")
  114.  elseif x>line3 and x<38 and y == 7 then
  115.     e = "  Sheep   "
  116.     CurrMob()
  117.     reset()
  118.     y = 7
  119.     selectMob("sheep")
  120.  elseif x>line1 and x<12 and y == 9 then
  121.     e = "  Blaze   "
  122.     CurrMob()
  123.     reset()
  124.     y = 9
  125.     selectMob("blaze")
  126.  elseif x>line2 and x<25 and y == 9 then
  127.     e = "  Slime   "
  128.     CurrMob()
  129.     reset()
  130.     y = 9
  131.     selectMob("slime")
  132.  elseif x>line3 and x<38 and y == 9 then
  133.     e = "  Witch   "
  134.     CurrMob()
  135.     reset()
  136.     y = 9
  137.     selectMob("witch")
  138.  elseif x>line1 and x<12 and y == 11 then
  139.     e = "  Cow     "
  140.     CurrMob()
  141.     reset()
  142.     y = 11
  143.     selectMob("cow")
  144.  elseif x>line2 and x<25 and y == 11 then
  145.     e = "Iron Golem"
  146.     CurrMob()
  147.     reset()
  148.     y = 11
  149.     selectMob("ironGolem")
  150.  elseif x>line1 and x<19 and y == 13 then
  151.     e = "Wither Skelly"
  152.     CurrMob()
  153.     reset()
  154.     y = 13
  155.     selectMob("witherSkelly")
  156.  elseif x>line3 and x<38 and y == 11 then
  157.     e = " Creeper  "
  158.     CurrMob()
  159.     reset()
  160.     y = 13
  161.     selectMob("creeper")
  162.      elseif x>line3+2 and x<38 and y == 3 then
  163.         e = "    None     "
  164.         CurrMob()
  165.         m.setCursorPos(line3 + 3, 3)
  166.         m.setBackgroundColor(colors.red)
  167.         m.setTextColor(colors.black)
  168.         m.write(" Reset ")
  169.         reset()
  170.         sleep(.5)
  171.         m.setCursorPos(line3 + 3, 3)
  172.         format()
  173.         m.write(" Reset ")
  174.     selectMob("reset")
  175.      end
  176. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement