Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mouseWidth = 0
- mouseHeight = 0
- monitor = peripheral.wrap("top")
- monitor.clear()
- monitor.setCursorPos(1,1)
- w,h=monitor.getSize()
- print(w)
- print(h)
- -- Draw buttons
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,2)
- monitor.write(" Wither Skelly ")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,4)
- monitor.write(" Blaze ")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,6)
- monitor.write(" Enderman ")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,8)
- monitor.write(" Ghast ")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,10)
- monitor.write(" Green Slime ")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,12)
- monitor.write(" Blizz ")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,14)
- monitor.write(" Mob 7 ")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,16)
- monitor.write(" Villagers ")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,18)
- monitor.write(" STOP ")
- monitor.setBackgroundColour((colours.black))
- -- Check click function
- -- white: remove safari net
- -- orange: mob 1 Wither skeleton
- -- magenta: mob 2 Blaze
- -- lightBlue: mob 3 Enderman
- -- yellow: mob 4 Ghast
- -- lime: mob 5 Slime
- -- pink: mob 6 Blizz
- -- gray: mob 7
- -- lightgray: mob 8 Villagers
- function checkClickPosition()
- if mouseWidth > 1 and mouseWidth < 18 and mouseHeight == 2 then
- -- button 1 clicked
- redstone.setBundledOutput("bottom", colors.white)
- sleep(1)
- redstone.setBundledOutput("bottom", colors.orange)
- elseif mouseWidth > 1 and mouseWidth < 18 and mouseHeight == 4 then
- -- button 2 clicked
- redstone.setBundledOutput("bottom", colors.white)
- sleep(1)
- redstone.setBundledOutput("bottom", colors.magenta)
- elseif mouseWidth > 1 and mouseWidth < 18 and mouseHeight == 6 then
- -- button 3 clicked
- redstone.setBundledOutput("bottom", colors.white)
- sleep(1)
- redstone.setBundledOutput("bottom", colors.lightBlue)
- elseif mouseWidth > 1 and mouseWidth < 18 and mouseHeight == 8 then
- -- button 4 clicked
- redstone.setBundledOutput("bottom", colors.white)
- sleep(1)
- redstone.setBundledOutput("bottom", colors.yellow)
- elseif mouseWidth > 1 and mouseWidth < 18 and mouseHeight == 10 then
- -- button 5 clicked
- redstone.setBundledOutput("bottom", colors.white)
- sleep(1)
- redstone.setBundledOutput("bottom", colors.lime)
- elseif mouseWidth > 1 and mouseWidth < 18 and mouseHeight == 12 then
- -- button 6 clicked
- redstone.setBundledOutput("bottom", colors.white)
- sleep(1)
- redstone.setBundledOutput("bottom", colors.pink)
- elseif mouseWidth > 1 and mouseWidth < 18 and mouseHeight == 14 then
- -- button 7 clicked
- redstone.setBundledOutput("bottom", colors.white)
- sleep(1)
- redstone.setBundledOutput("bottom", colors.gray)
- elseif mouseWidth > 1 and mouseWidth < 18 and mouseHeight == 16 then
- -- button 8 clicked (Villagers, auto stop after sleep period)
- redstone.setBundledOutput("bottom", colors.white)
- sleep(1)
- redstone.setBundledOutput("bottom", colors.lightGray)
- sleep(40)
- redstone.setBundledOutput("bottom", colors.white)
- elseif mouseWidth > 1 and mouseWidth < 18 and mouseHeight == 18 then
- -- button 9 stop clicked
- redstone.setBundledOutput("bottom", colors.white)
- end
- end
- repeat
- event,p1,p2,p3 = os.pullEvent()
- if event=="monitor_touch" then
- mouseWidth = p2 -- sets mouseWidth
- mouseHeight = p3 -- and mouseHeight
- checkClickPosition() -- this runs our function
- end
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement