Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- list = {{"HV-Farm",0,2,2,colors.green},{"Essenfarm",0,2,4,colors.red},{"Baumfarm",0,2,6,colors.blue}}
- mon = peripheral.wrap("back")
- sbcol = colors.black
- stcol = colors.green
- gx, gy = mon.getSize()
- if fs.exists("rList") == false then
- cFile = fs.open("rList","w")
- cFile.writeLine(textutils.serialize(list))
- cFile.close()
- else
- rFile = fs.open("rList","r")
- list = textutils.unserialize(rFile.readLine())
- rFile.close()
- end
- function save(input)
- sFile = fs.open("rList","w")
- sFile.writeLine(textutils.serialize(input))
- sFile.close()
- end
- function cbut(cx,cy,text,bcol,tcol)
- if bcol == nil then
- bcol = sbcol
- end
- if tcol == nil then
- tcol = stcol
- end
- mon.setCursorPos(cx,cy)
- mon.setBackgroundColor(bcol)
- mon.setTextColor(tcol)
- mon.write(text)
- mon.setBackgroundColor(sbcol)
- mon.setTextColor(stcol)
- end
- mon.setTextScale(2)
- mon.clear()
- while true do
- x = 2
- y = 2
- cbut(gx-1,1,"R",colors.red,colors.black)
- for i = 1, table.maxn(list),1 do
- if string.len(list[i][1]) <= 9 then
- for v = string.len(list[i][1]), 9,1 do
- list[i][1] = list[i][1] .. " "
- end
- end
- if list[i][2] == 0 then
- col = colors.red
- elseif list[i][2] == 1 then
- col = colors.green
- end
- cbut(x,y," " .. list[i][1] .. " ",col,colors.black)
- y = y + 2
- end
- evt, side, x,y = os.pullEvent("monitor_touch")
- if x == gx - 1 and y == 1 then
- cbut(gx-1,1,"R")
- sleep(1)
- mon.clear()
- shell.run("reboot")
- else
- for v = 1,table.maxn(list),1 do
- if x > list[v][3] and x < list[v][3]+10 and y == list[v][4] then
- if list[v][2] == 1 then
- rs.setBundledOutput("bottom",colors.subtract(rs.getBundledOutput("bottom"),list[v][5]))
- list[v][2] = 0
- elseif list[v][2] == 0 then
- rs.setBundledOutput("bottom",colors.combine(rs.getBundledOutput("bottom"),list[v][5]))
- list[v][2] = 1
- end
- end
- end
- end
- save(list)
- print(x .. ":" .. y)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement