Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- m=peripheral.wrap("left")
- rednet.open("back")
- local sheepon = false
- local sugaron = false
- local digon = false
- local xpon = false
- local meaton = false
- function drawHeading()
- button.heading("--------- BaseControl v2.0 ---------")
- end
- function drawButtons()
- button.setTable("Toggle Sheep",sheep,3,16,6,10)
- button.setTable("Toggle Sugar",sugar,19,32,6,10)
- button.setTable("Toggle Dig",dig,35,48,6,10)
- button.setTable("Toggle XP",xp,51,64,6,10)
- button.setTable("Toggle Meat",meat,67,80,6,10)
- button.screen()
- end
- function drawText()
- button.label(3,3,"Sheep farm:")
- button.label(19,3,"Sugar farm:")
- button.label(35,3,"Digging Rig:")
- button.label(51,3,"XP Farm:")
- button.label(67,3,"Meat Farm:")
- button.label(69,12,"by: dodedodo33")
- end
- function drawStatus()
- if sheepon then
- button.label(3,4,"active")
- else
- button.label(3,4,"inactive")
- end
- if sugaron then
- button.label(19,4,"active")
- else
- button.label(19,4,"inactive")
- end
- if digon then
- button.label(35,4,"active")
- else
- button.label(35,4,"inactive")
- end
- if xpon then
- button.label(51,4,"active")
- else
- button.label(51,4,"inactive")
- end
- if meaton then
- button.label(67,4,"active")
- else
- button.label(67,4,"inactive")
- end
- end
- function drawScreen()
- m.clear()
- drawHeading()
- drawText()
- drawButtons()
- drawStatus()
- end
- function sheep()
- button.flash("Toggle Sheep")
- sheepon = not sheepon
- if sheepon then
- shell.run("redset","right","yellow","true")
- else
- shell.run("redset","right","yellow","false")
- end
- end
- function sugar()
- button.flash("Toggle Sugar")
- sugaron = not sugaron
- if sugaron then
- shell.run("redset","right","red","true")
- else
- shell.run("redset","right","red","false")
- end
- end
- function dig()
- button.flash("Toggle Dig")
- digon = not digon
- if digon then
- shell.run("redset","right","green","true")
- else
- shell.run("redset","right","green","false")
- end
- end
- function xp()
- button.flash("Toggle XP")
- xpon = not xpon
- if xpon then
- shell.run("redset","right","blue","false")
- else
- shell.run("redset","right","blue","true")
- end
- end
- function meat()
- meaton = not meaton
- if meaton then
- button.toggleButton("Toggle Meat")
- shell.run("sendmsg","89","place")
- id,msg,dist = rednet.receive()
- button.toggleButton("Toggle Meat")
- else
- button.toggleButton("Toggle Meat")
- shell.run("sendmsg","89","remove")
- id,msg,dist = rednet.receive()
- button.toggleButton("Toggle Meat")
- end
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- drawScreen()
- shell.run("redset","right","blue","true")
- shell.run("sendmsg","89","remove")
- while true do
- getClick()
- drawScreen()
- end
Advertisement
Add Comment
Please, Sign In to add comment