Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Checking the file system --
- if not fs.exists("OnlineStatus") then
- StatusWriter = fs.open("OnlineStatus", "w")
- StatusWriter .write("On")
- StatusWriter .close()
- end
- if not fs.exists("CurrentMob") then
- MobWriter= fs.open("CurrentMob", "w")
- MobWriter.write("None")
- MobWriter.close()
- end
- --Variables --
- mouseWidth = 0
- mouseHeight = 0
- currentMob = "None "
- --Set turtle connection --
- rednet.open("back")
- Turtle = 35
- --Set monitor properties
- monitor = peripheral.wrap("bottom")
- monitor.clear()
- monitor.setCursorPos(1,1)
- w,h=monitor.getSize()
- monitor.setBackgroundColor((colors.blue))
- --Write first list of mobs
- monitor.setCursorPos(2,2)
- monitor.write(" Enderman ")
- monitor.setCursorPos(2,4)
- monitor.write(" Skeleton ")
- monitor.setCursorPos(2,6)
- monitor.write(" Blaze ")
- monitor.setCursorPos(2,8)
- monitor.write(" Whisp ")
- monitor.setCursorPos(2,10)
- monitor.write(" Cow ")
- --Write second list of mobs
- monitor.setCursorPos(16,2)
- monitor.write(" Enderman ")
- monitor.setCursorPos(16,4)
- monitor.write(" Skeleton ")
- monitor.setCursorPos(16,6)
- monitor.write(" Blaze ")
- monitor.setCursorPos(16,8)
- monitor.write(" Whisp ")
- monitor.setCursorPos(16,10)
- monitor.write(" None ")
- --Write data --
- monitor.setBackgroundColor((colors.red))
- monitor.setCursorPos(2,12)
- monitor.write("Current Mob: ")
- --Update mob data --
- function setCurrentMobData()
- monitor.setBackgroundColor((colors.red))
- monitor.setCursorPos(15,12)
- monitor.write(currentMob)
- end
- --Switch mob --
- function switchMob(mob)
- print "Switching mob"
- end
- --Remove mob --
- function removeMob()
- print "Removing mob"
- end
- -- Perform clicked action --
- function checkClickPosition()
- -- 1st Row --
- if(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 2) then
- --Clicked Enderman --
- currentMob = "Enderman "
- setCurrentMobData()
- rednet.send(Turtle, 1)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 2) then
- --Clicked enderman --
- currentMob = "Enderman "
- setCurrentMobData()
- -- 2nd Row --
- elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 4) then
- --Clicked Skeleton --
- currentMob = "Skeleton "
- setCurrentMobData()
- rednet.send(Turtle, 2)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 4) then
- --Clicked Skeleton --
- currentMob = "Skeleton "
- setCurrentMobData()
- -- 3rd Row --
- elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 6) then
- --Clicked Blaze
- currentMob = "Blaze "
- setCurrentMobData()
- rednet.send(Turtle, 3)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 6) then
- --Clicked Blaze --
- currentMob = "Blaze "
- setCurrentMobData()
- -- 4th Row --
- elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 8) then
- --Clicked Whisp --
- currentMob = "Whisp "
- setCurrentMobData()
- rednet.send(Turtle, 4)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 8) then
- --Clicked Whisp --
- currentMob = "Whisp "
- setCurrentMobData()
- -- 5th Row --
- elseif(mouseWidth > 1 and mouseWidth < 13 and mouseHeight == 10) then
- --Clicked Cow --
- currentMob = "Cow "
- setCurrentMobData()
- rednet.send(Turtle, 5)
- elseif(mouseWidth > 15 and mouseWidth < 27 and mouseHeight == 10) then
- --Clicked Whisp --
- currentMob = "None "
- setCurrentMobData()
- rednet.send(Turtle, "Stop")
- end
- end
- repeat
- event,p1,p2,p3 = os.pullEvent()
- if event == "monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- checkClickPosition()
- end
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment