Tribble1991

Untitled

Jul 26th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Checking the file system --
  2.  
  3. if not fs.exists("OnlineStatus") then
  4.   StatusWriter = fs.open("OnlineStatus", "w")
  5.   StatusWriter .write("On")
  6.   StatusWriter .close()
  7. end
  8.  
  9. if not fs.exists("CurrentMob") then
  10.   MobWriter= fs.open("CurrentMob", "w")
  11.   MobWriter.write("None")
  12.   MobWriter.close()
  13. end
  14.  
  15.  
  16. --Variables --
  17. mouseWidth = 0
  18. mouseHeight = 0
  19.  
  20. currentMob = "None        "
  21. currentStatus = "On"
  22.  
  23. Title = Spawner control
  24.  
  25. --Set turtle connection --
  26. rednet.open("back")
  27. Turtle = 35
  28.  
  29.  
  30. --Set monitor properties
  31. monitor = peripheral.wrap("bottom")
  32. monitor.clear()
  33.  
  34. monitor.setCursorPos(1,1)
  35.  
  36. w,h=monitor.getSize()
  37.  
  38. monitor.setBackgroundColor((colors.red))
  39.  
  40. --Write Monitor data
  41. mon.setTextScale(10)
  42. monitor.setCursorPos(2,2)
  43. monitor.write("  Enderman  ")
  44.  
  45. --Write first list of mobs
  46. mon.setTextScale(3)
  47.  
  48. monitor.setCursorPos(2,2)
  49. monitor.write("  Enderman  ")
  50.  
  51. monitor.setCursorPos(2,4)
  52. monitor.write("  Skeleton  ")
  53.  
  54. monitor.setCursorPos(2,6)
  55. monitor.write("  Blaze     ")
  56.  
  57. monitor.setCursorPos(2,8)
  58. monitor.write("  Whisp     ")
  59.  
  60. monitor.setCursorPos(2,10)
  61. monitor.write("  Cow       ")
  62.  
  63. --Write second list of mobs
  64. monitor.setCursorPos(16,2)
  65. monitor.write("  Enderman  ")
  66.  
  67. monitor.setCursorPos(16,4)
  68. monitor.write("  Skeleton  ")
  69.  
  70. monitor.setCursorPos(16,6)
  71. monitor.write("  Blaze     ")
  72.  
  73. monitor.setCursorPos(16,8)
  74. monitor.write("  Whisp     ")
  75.  
  76. monitor.setCursorPos(16,10)
  77. monitor.write("  None      ")
  78.  
  79. --Write data --
  80. monitor.setBackgroundColor((colors.red))
  81. monitor.setCursorPos(2,12)
  82. monitor.write("Current Mob: ")
  83.  
  84.    
  85.  
  86. --Update mob data --
  87. function setCurrentMobData()
  88.     monitor.setBackgroundColor((colors.red))
  89.     monitor.setCursorPos(15,12)
  90.     monitor.write(currentMob)
  91. end
  92.  
  93. --Switch mob --
  94. function switchMob(mob)
  95.     print "Switching mob"
  96. end
  97.  
  98. --Remove mob --
  99. function removeMob()
  100.     print "Removing mob"
  101. end
  102. -- Perform clicked action --
  103. function checkClickPosition()
  104.     -- 1st Row --
  105.     if(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 2) then
  106.         --Clicked Enderman --
  107.         currentMob = "Enderman "
  108.         setCurrentMobData()
  109.         rednet.send(Turtle, 1) 
  110.     elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 2) then
  111.         --Clicked enderman --
  112.         currentMob = "Enderman "
  113.         setCurrentMobData()
  114.     -- 2nd Row --
  115.     elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 4) then
  116.         --Clicked Skeleton --
  117.         currentMob = "Skeleton "
  118.         setCurrentMobData()
  119.         rednet.send(Turtle, 2)     
  120.     elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 4) then
  121.         --Clicked Skeleton --
  122.         currentMob = "Skeleton "
  123.         setCurrentMobData()
  124.     -- 3rd Row --
  125.     elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 6) then
  126.         --Clicked Blaze
  127.         currentMob = "Blaze    "
  128.         setCurrentMobData()
  129.         rednet.send(Turtle, 3) 
  130.     elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 6) then
  131.         --Clicked Blaze --
  132.         currentMob = "Blaze    "
  133.         setCurrentMobData()
  134.  
  135.     -- 4th Row --
  136.     elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 8) then
  137.         --Clicked Whisp --
  138.         currentMob = "Whisp    "
  139.         setCurrentMobData()
  140.         rednet.send(Turtle, 4) 
  141.     elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 8) then
  142.         --Clicked Whisp --
  143.         currentMob = "Whisp    "
  144.         setCurrentMobData()
  145.  
  146.     -- 5th Row --
  147.     elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 10) then
  148.         --Clicked Cow --
  149.         currentMob = "Cow      "
  150.         setCurrentMobData()
  151.         rednet.send(Turtle, 5)     
  152.     elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 10) then
  153.         --Clicked Whisp --
  154.         currentMob = "None     "
  155.         setCurrentMobData()
  156.         rednet.send(Turtle, "Stop")
  157.     end
  158. end
  159.  
  160. repeat
  161.     event,p1,p2,p3 = os.pullEvent()
  162.  
  163.     if event == "monitor_touch" then
  164.         mouseWidth = p2
  165.         mouseHeight = p3
  166.         checkClickPosition()
  167.     end
  168. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment