Advertisement
Guest User

mobs

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