Guest User

control

a guest
Dec 26th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.13 KB | None | 0 0
  1. rs.setBundledOutput("back", 0)
  2. m = peripheral.wrap("right")
  3. m.setBackgroundColor(colors.black)
  4. m.setTextColor(colors.white)
  5. m.setTextScale(1)
  6. m.setCursorPos(1,1)
  7. m.setTextColor(colors.black)
  8. m.setBackgroundColor(colors.lightGray)
  9. m.write("    MFR Auto-Spawner Control Panel     ")
  10. m.setCursorPos(1,3)
  11. m.setTextColor(colors.black)
  12. m.setBackgroundColor(colors.lightGray)
  13. m.write("Current Mob:")
  14. e = "    None    "
  15. line1 = 2
  16. line2 = 15
  17. line3 = 28
  18. y = 0
  19.  
  20.  
  21. --Functions--
  22.  
  23. function enderman()
  24.  rs.setBundledOutput("back", colors.white)
  25.  sleep(1)
  26.  rs.setBundledOutput("back", 0)
  27. end
  28.  
  29. function witherSkeleton()
  30.  rs.setBundledOutput("back", colors.orange)
  31.  sleep(1)
  32.  rs.setBundledOutput("back", 0)
  33. end
  34.  
  35. function ghast()
  36.  rs.setBundledOutput("back", colors.magenta)
  37.  sleep(1)
  38.  rs.setBundledOutput("back", 0)
  39. end
  40.  
  41. function slime()
  42.  rs.setBundledOutput("back", colors.purple)
  43.  sleep(1)
  44.  rs.setBundledOutput("back", 0)
  45. end
  46.  
  47. function witch()
  48.  rs.setBundledOutput("back", colors.yellow)
  49.  sleep(1)
  50.  rs.setBundledOutput("back", 0)
  51. end
  52.  
  53. function blaze()
  54.  rs.setBundledOutput("back", colors.lime)
  55.  sleep(1)
  56.  rs.setBundledOutput("back", 0)
  57. end
  58.  
  59. function sheep()
  60.  rs.setBundledOutput("back", colors.pink)
  61.  sleep(1)
  62.  rs.setBundledOutput("back", 0)
  63. end
  64.  
  65. function cow()
  66.  rs.setBundledOutput("back", colors.gray)
  67.  sleep(1)
  68.  rs.setBundledOutput("back", 0)
  69. end
  70.  
  71. function creeper()
  72.  rs.setBundledOutput("back", colors.lightGray)
  73.  sleep(1)
  74.  rs.setBundledOutput("back", 0)
  75. end
  76.  
  77. function ironGolem()
  78.  rs.setBundledOutput("back", colors.cyan)
  79.  sleep(1)
  80.  rs.setBundledOutput("back", 0)
  81. end
  82.  
  83. function reset()
  84.  rs.setOutput("top", true)
  85.  sleep(1)
  86.  rs.setOutput("top", false)
  87. end
  88.  
  89. function format()
  90.  m.setTextColor(colors.black)
  91.  m.setBackgroundColor(colors.lightGray)
  92. end
  93.  
  94. function CurrMob()
  95.  m.setCursorPos(15, 3)
  96.  format()
  97.  m.write(e)
  98. end
  99.  
  100. --Main--
  101.  
  102. reset()
  103. m.setCursorPos(line3 + 3, 3)
  104. format()
  105. m.write(" Reset ")
  106. m.setCursorPos(1,5)
  107. format()
  108. m.write("--------------Select One---------------")
  109. m.setCursorPos(line1, 7)
  110. format()
  111. m.write(" Enderman ")
  112. m.setCursorPos(line2, 7)
  113. format()
  114. m.write("  Ghast   ")
  115. m.setCursorPos(line3, 7)
  116. format()
  117. m.write("  Sheep   ")
  118. m.setCursorPos(line1, 9)
  119. format()
  120. m.write("  Blaze   ")
  121. m.setCursorPos(line2, 9)
  122. format()
  123. m.write("  Slime   ")
  124. m.setCursorPos(line3, 9)
  125. format()
  126. m.write("  Witch   ")
  127. m.setCursorPos(line3, 11)
  128. format()
  129. m.write(" Creeper  ")
  130. m.setCursorPos(line1, 11)
  131. format()
  132. m.write("   Cow    ")
  133. m.setCursorPos(line2, 11)
  134. format()
  135. m.write("Iron Golem")
  136. m.setCursorPos(line1, 13)
  137. format()
  138. m.write(" Wither Skeleton ")
  139.  
  140. --where the magic happens--
  141.  
  142. while true do
  143.  event, p1, p2, p3 = os.pullEvent("monitor_touch")
  144.  x = p2
  145.  y = p3
  146.  m.setCursorPos(15,3)
  147.  format()
  148.  m.write(e)
  149.  if x>line1 and x<12 and y == 7 then
  150.   e = " Enderman "
  151.   CurrMob()
  152.   reset()
  153.   y = 7
  154.   enderman()
  155.  elseif x>line2 and x<25 and y == 7 then
  156.   e = "  Ghast   "
  157.   CurrMob()
  158.   reset()
  159.   y = 7
  160.   ghast()
  161.  elseif x>line3 and x<38 and y == 7 then
  162.   e = "  Sheep   "
  163.   CurrMob()
  164.   reset()
  165.   y = 7
  166.   sheep()
  167.  elseif x>line1 and x<12 and y == 9 then
  168.   e = "  Blaze   "
  169.   CurrMob()
  170.   reset()
  171.   y = 9
  172.   blaze()
  173.  elseif x>line2 and x<25 and y == 9 then
  174.   e = "  Slime   "
  175.   CurrMob()
  176.   reset()
  177.   y = 9
  178.   slime()
  179.  elseif x>line3 and x<38 and y == 9 then
  180.   e = "  Witch   "
  181.   CurrMob()
  182.   reset()
  183.   y = 9
  184.   witch()
  185.  elseif x>line1 and x<12 and y == 11 then
  186.   e = "  Cow     "
  187.   CurrMob()
  188.   reset()
  189.   y = 11
  190.   cow()
  191.  elseif x>line2 and x<25 and y == 11 then
  192.   e = "Iron Golem"
  193.   CurrMob()
  194.   reset()
  195.   y = 11
  196.   ironGolem()
  197.  elseif x>line1 and x<19 and y == 13 then
  198.   e = "Wither Skelly"
  199.   CurrMob()
  200.   reset()
  201.   y = 13
  202.   witherSkeleton()
  203.  elseif x>line3 and x<38 and y == 11 then
  204.   e = " Creeper  "
  205.   CurrMob()
  206.   reset()
  207.   y = 13
  208.   creeper()
  209.  elseif x>line3+2 and x<38 and y == 3 then
  210.   e = "    None     "
  211.   CurrMob()
  212.   m.setCursorPos(line3 + 3, 3)
  213.   m.setBackgroundColor(colors.red)
  214.   m.setTextColor(colors.black)
  215.   m.write(" Reset ")
  216.   reset()
  217.   sleep(.5)
  218.   m.setCursorPos(line3 + 3, 3)
  219.   format()
  220.   m.write(" Reset ")
  221.  end
  222. end
Advertisement
Add Comment
Please, Sign In to add comment