Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("top")
- w,h = m.getSize()
- w = w + 1
- h = h + 1
- col = { ["white"]=1, ["orange"]=2, ["magenta"]=4, ["lightblue"]=8, ["yellow"]=16, ["lime"]=32, ["pink"]=64, ["gray"]=128, ["lightgray"]=256, ["cyan"]=512, ["purple"]=1024, ["blue"]=2048, ["brown"]=4096, ["green"]=8192, ["red"]=16384, ["black"]=32768 }
- active = 65535
- redstone.setBundledOutput("right",active)
- function toggle(color,bool)
- if bool then
- active = active + col[color]
- else
- active = active - col[color]
- end
- redstone.setBundledOutput("right",active)
- print(active)
- end
- function swrite(str,x,y,color)
- m.setCursorPos(x,y)
- m.setTextColor(col[color])
- m.write(str)
- end
- function swritecenter(str,y,color)
- m.setCursorPos((w/2-#str/2)+1,y)
- m.setTextColor(col[color])
- m.write(str)
- end
- function drawbox(str,x1,x2,y1,y2,strcol,color)
- m.setCursorPos(x1,y1)
- m.setBackgroundColor(col[color])
- m.setTextColor(col[strcol])
- local bw = x2-x1
- local bh = y2-y1
- local bstr = " "
- while #bstr < bw do
- bstr = bstr.." "
- end
- for i=1,bh do
- m.setCursorPos(x1,y1+i-1)
- m.write(bstr)
- end
- m.setCursorPos(x1+bw/2-#str/2,y1+bh/2)
- m.write(str)
- m.setBackgroundColor(col["black"])
- return { [1]=x1, [2]=x2, [3]=y1, [4]=y2 }
- end
- function drawtext(str,x,y,color)
- m.setCursorPos(x,y)
- m.setTextColor(col[color])
- m.write(str)
- return { [1]=x, [2]=x+1, [3]=y, [4]=y+#str }
- end
- function press(but)
- if event == "monitor_touch" then
- if pr2 >= but[1] and pr2 < but[2] and pr3 >= but[3] and pr3 < but[4] then
- return true
- else
- return false
- end
- end
- end
- function drawoutline(str,strcol,color)
- m.setBackgroundColor(col[color])
- m.setTextColor(col[strcol])
- drawbox(str,1,w,1,2,strcol,color)
- drawbox("",1,2,1,h,strcol,color)
- drawbox("",w-1,w,1,h,strcol,color)
- drawbox("",1,w,h-1,h,strcol,color)
- end
- function check(color)
- return colors.test(active,col[color])
- end
- function drawmenu()
- m.clear()
- drawoutline("Fair's Mobfarm system","black","white")
- enderman = drawbox("Enderman",4,19,3,6,"black","red")
- blaze = drawbox("Blaze",22,37,3,6,"black","red")
- zombie = drawbox("Zombie",4,19,7,10,"black","red")
- spider = drawbox("Spider",22,37,7,10,"black","red")
- creeper = drawbox("Creeper",4,19,11,14,"black","red")
- na = drawbox("N/A",22,37,11,14,"black","red")
- na = drawbox("N/A",4,19,15,18,"black","red")
- na = drawbox("N/A",22,37,15,18,"black","red")
- na = drawbox("N/A",4,19,19,22,"black","red")
- na = drawbox("N/A",22,37,19,22,"black","red")
- end
- drawmenu()
- while true do
- event,pr1,pr2,pr3 = os.pullEvent()
- if press(enderman) then
- if check("white") then
- toggle("white",false)
- enderman = drawbox("Enderman",4,19,3,6,"black","green")
- else
- toggle("white",true)
- enderman = drawbox("Enderman",4,19,3,6,"black","red")
- end
- elseif press(blaze) then
- if check("orange") then
- toggle("orange",false)
- blaze = drawbox("Blaze",22,37,3,6,"black","green")
- else
- toggle("orange",true)
- blaze = drawbox("Blaze",22,37,3,6,"black","red")
- end
- elseif press(zombie) then
- if check("yellow") then
- toggle("yellow",false)
- zombie = drawbox("Zombie",4,19,7,10,"black","green")
- else
- toggle("yellow",true)
- zombie = drawbox("Zombie",4,19,7,10,"black","red")
- end
- elseif press(spider) then
- if check("red") then
- toggle("red",false)
- spider = drawbox("Spider",22,37,7,10,"black","green")
- else
- toggle("red",true)
- spider = drawbox("Spider",22,37,7,10,"black","red")
- end
- elseif press(creeper) then
- if check("black") then
- toggle("black",false)
- creeper = drawbox("Creeper",4,19,11,14,"black","green")
- else
- toggle("black",true)
- creeper = drawbox("Creeper",4,19,11,14,"black","red")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment