Advertisement
Guest User

mobs

a guest
Jul 23rd, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.29 KB | None | 0 0
  1. rednet.open("right")
  2. if not fs.exists("it") then
  3.   pop = fs.open("it", "w")
  4.   pop.write("On")
  5.   pop.close()
  6. end
  7. if not fs.exists("Current") then
  8.   pip = fs.open("Current", "w")
  9.   pip.write("Empty")
  10.   pip.close()
  11. end
  12. title = "Pokeball Spawner v1"
  13. message = "Pokeball Switched"
  14. m = peripheral.wrap("top")
  15. m.setBackgroundColor(colors.white)
  16. m.clear()
  17. going = true
  18. term.redirect(m)
  19. function ok(current)
  20. going = false
  21.   term.setBackgroundColor(colors.white)
  22.   term.setTextColor(colors.black)
  23.   term.clear()
  24.   term.setCursorPos(w/2-#message/2, h/2)
  25.   print(message)
  26.   shell.run("delete Current")
  27.   a = fs.open("Current", "w")
  28.   a.write(current)
  29.   a.close()
  30.   os.sleep(3)
  31.   --term.clear()
  32.   --going = true
  33.   shell.run("mobs")
  34. end
  35. term.setTextColor(colors.black)
  36. w, h = term.getSize()
  37. term.setCursorPos(1, 1)
  38. term.setCursorPos(w/2-#title/2, 1)
  39. print("Pokeball Spawner v1")
  40. paintutils.drawLine(2, 3, 10,3, colors.black)
  41. term.setTextColor(colors.purple)
  42. term.setCursorPos(2, 3)
  43. print("Enderman")
  44. term.setTextColor(colors.black)
  45. paintutils.drawLine(13, 3, 21, 3, colors.brown)
  46. term.setCursorPos(14, 3)
  47. print("Zombie")
  48. paintutils.drawLine(w-20, 3, w-12, 3, colors.green)
  49. term.setCursorPos(w-19, 3)
  50. print("Creeper")
  51. paintutils.drawLine(w-9, 3, w-1, 3, colors.lightGray)
  52. term.setCursorPos(w-9, 3)
  53. print("Skeleton")
  54. paintutils.drawLine(2, 5, 10, 5, colors.green)
  55. term.setCursorPos(4, 5)
  56. print("Dryad")
  57. paintutils.drawLine(13, 5, 21, 5, colors.purple)
  58. term.setCursorPos(15, 5)
  59. print("Witch")
  60. paintutils.drawLine(w-20, 5, w-12, 5, colors.brown)
  61. term.setCursorPos(w-17, 5)
  62. print("Cow")
  63. paintutils.drawLine(w-9, 5, w-1, 5, colors.black)
  64. term.setTextColor(colors.white)
  65. term.setCursorPos(w-8, 5)
  66. print("Wither")
  67. --term.setTextColor(colors.black)
  68. paintutils.drawLine(2, 7, 10, 7, colors.black)
  69. term.setCursorPos(3, 7)
  70. print("Spider")
  71. term.setTextColor(colors.black)
  72. paintutils.drawLine(13, 7, 21, 7, colors.lightGray)
  73. term.setCursorPos(14, 7)
  74. print("Sheep")
  75. paintutils.drawLine(w-20, 7, w-12, 7, colors.green)
  76. term.setCursorPos(w-18, 7)
  77. print("Slime")
  78. paintutils.drawLine(w-9, 7, w-1, 7, colors.red)
  79. term.setCursorPos(w-9, 7)
  80. print("Mooshroom")
  81. paintutils.drawLine(2, 9, 10, 9, colors.orange)
  82. term.setCursorPos(4, 9)
  83. print("Blaze")
  84. paintutils.drawLine(w-20, 9, w-12, 9, colors.lightGray)
  85. term.setCursorPos(w-18, 9)
  86. print("Wolf")
  87. --paintutils.drawLine(1, h-1, 7, h-1, colors.red)
  88. term.setBackgroundColor(colors.white)
  89. term.setCursorPos(1, h-1)
  90. print("Remove")
  91. term.setCursorPos(w-14, h-1)
  92. print("Currently:")
  93. term.setCursorPos(w-3, h-1)
  94. er = fs.open("it", "r")
  95. ab = er.readAll()
  96. if ab == "Off" then
  97. print("Off")
  98. elseif ab == "On" then
  99. print("On")
  100. end
  101. er.close()
  102. b = fs.open("Current", "r")
  103. c = b.readAll()
  104. inside = c
  105. term.setCursorPos(w/2-9/2-7, h-1)
  106. print("Current: "..c)
  107. b.close()
  108. paintutils.drawLine(13, 9, 21, 9, colors.lightGray)
  109. term.setCursorPos(14, 9)
  110. print("Ghast")
  111. paintutils.drawLine(w-9, 9, w-1, 9, colors.red)
  112. term.setCursorPos(w-8, 9)
  113. print("Hellcow")
  114. while going do
  115.   er = fs.open("it", "r")
  116.   ab = er.readAll()
  117.   event, side, xpos, ypos = os.pullEvent("monitor_touch")
  118.     if xpos >= 2 and xpos <= 10 and ypos == 3 then
  119.       rednet.send(1, "one")
  120.       ok("Enderman")
  121.     elseif xpos >= 13 and xpos <= 21 and ypos == 3 then
  122.       rednet.send(1, "two")
  123.       ok("Zombie")
  124.     elseif xpos >= w-20 and xpos <= w-12 and ypos == 3 then
  125.       rednet.send(1, "three")
  126.       ok("Creeper")
  127.     elseif xpos >= w-9 and xpos <= w-1 and ypos == 3 then
  128.       rednet.send(1, "four")
  129.       ok("Skeleton")
  130.     elseif xpos >= 2 and xpos <= 10 and ypos == 5 then
  131.       rednet.send(1, "five")
  132.       ok("Dryad")
  133.     elseif xpos >= 13 and xpos <= 21 and ypos == 5 then
  134.       rednet.send(1, "six")
  135.       ok("Witch")
  136.     elseif xpos >= w-20 and xpos <= w-12 and ypos == 5 then
  137.       rednet.send(1, "seven")
  138.       ok("Cow")
  139.     elseif xpos >= w-9 and xpos <= w-1 and ypos == 5 then
  140.       rednet.send(1, "eight")
  141.       ok("Wither")
  142.     elseif xpos >= 2 and xpos <= 10 and ypos == 7 then
  143.       rednet.send(1, "nine")
  144.       ok("Spider")
  145.     elseif xpos >= 13 and xpos <= 21 and ypos == 7 then
  146.       rednet.send(1, "ten")
  147.       ok("Sheep")
  148.     elseif xpos >= w-20 and xpos <= w-12 and ypos == 7 then
  149.       rednet.send(1, "eleven")
  150.       ok("Slime")
  151.     elseif xpos >= w-9 and xpos <= w-1 and ypos == 7 then
  152.       rednet.send(1, "twelve")
  153.       ok("Mooshroom")
  154.     elseif xpos >= 2 and xpos <= 10 and ypos == 9 then
  155.       rednet.send(1, "thirteen")
  156.       ok("Blaze")
  157.     elseif xpos >= 13 and xpos <= 21 and ypos == 9 then
  158.       rednet.send(1, "fourteen")
  159.       ok("Ghast")
  160.     elseif xpos >= w-20 and xpos <= w-12 and ypos == 9 then
  161.       rednet.send(1, "fifteen")
  162.       ok("Wolf")
  163.     elseif xpos >= w-9 and xpos <= w-1 and ypos == 9 then
  164.       rednet.send(1, "sixteen")
  165.       ok("Hellcow")
  166.     elseif xpos >= 1 and xpos <= 6 and ypos == h-1 then
  167.       rednet.send(1, "stop")
  168.       term.setBackgroundColor(colors.white)
  169.       term.setTextColor(colors.black)
  170.       term.clear()
  171.       term.setCursorPos(w/2-16/2, h/2)
  172.       print("Pokeball Removed")
  173.       os.sleep(3)
  174.       shell.run("delete Current")
  175.       g = fs.open("Current", "w")
  176.       g.write("Empty")
  177.       g.close()
  178.       shell.run("mobs")
  179.     elseif xpos >= w-3 and xpos <= w and ypos == h-1 then
  180.       term.setBackgroundColor(colors.white)
  181.       if ab == "On" then
  182.       rednet.send(1, "off")
  183.       er.close()
  184.       shell.run("delete it")
  185.       to = fs.open("it", "w")
  186.       to.write("Off")
  187.       to.close()
  188.       term.setCursorPos(1, h-1)
  189.       term.clearLine()
  190.       term.setCursorPos(1, h-1)
  191.       print("Remove")
  192.       term.setCursorPos(w/2-9/2-7, h-1)
  193.       print("Current: "..inside)
  194.       term.setCursorPos(w-14, h-1)
  195.       print("Currently:")
  196.       term.setCursorPos(w-3, h-1)
  197.       print("Off")
  198.       elseif ab == "Off" then
  199.       rednet.send(1, "on")
  200.       er.close()
  201.       shell.run("delete it")
  202.       to = fs.open("it", "w")
  203.       to.write("On")
  204.       to.close()
  205.       term.setCursorPos(1, h-1)
  206.       term.clearLine()
  207.       term.setCursorPos(1, h-1)
  208.       print("Remove")
  209.       term.setCursorPos(w/2-9/2-7, h-1)
  210.       print("Current: "..inside)
  211.       term.setCursorPos(w-14, h-1)
  212.       print("Currently:")
  213.       term.setCursorPos(w-3, h-1)
  214.       print("On")
  215.      
  216.       end
  217.     end
  218.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement