Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Apps
- shell.run("energy")
- --Statuses
- local WheatFarm = true
- -- IDs
- local Wheat = 676
- -- Peripherals
- rednet.open("back")
- local m = peripheral.wrap("top")
- -- Labels
- local Labels = {
- {["name"]="lblWheat", ["x"]=5, ["y"]=5, ["text"]="Online", ["color"]=colors.green}
- }
- --rednet.send(Wheat, "toggle")
- function SetLabel(lbl, txt)
- Labels[lbl]["text"] = txt
- PrintControls()
- end
- function SetLabelColor(lbl, color)
- Label[lbl]["color"] = color
- PrintControls()
- end
- function PrintControls()
- m.clear()
- for k,v in pairs(Labels) do
- m.setCursorPos(Labels[k]["x"], Labels[k]["y"])
- m.setTextColor(Labels[k]["color"])
- m.write(Labels[k]["text"])
- end
- end
- PrintControls()
- while true do
- local ev,p1,p2,p3 = os.pullEvent()
- if(ev=="rednet_message") then
- if(p1==Wheat) then
- if(p2=="true") then
- SetLabelColor("lblWheat", colors.green)
- SetLabel("lblWheat", "Online")
- WheatFarm = true
- elseif(p2=="false") then
- SetLabelColor("lblWheat", colors.red)
- SetLabel("lblWheat", "Suspended")
- WheatFarm = false
- end
- end
- elseif(ev=="monitor_touch") then
- for k,v in pairs(Labels) do
- print(p2.." >= "..Labels[k]["x"])
- print(p2.." <= "..string.len(Labels[k]["text"]))
- if(p2 >= Labels[k]["x"] and string.len(Labels[k]["text"]) <= p2) then
- print("success")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement