CCCPaste

Dom Log

monitor = peripheral.wrap("monitor_1")
function pos(...) return term.setCursorPos(...) end
function cls(...) return term.clear() end
function tCol(...) return term.setTextColor(...) end
function bCol(...) return term.setBackgroundColor(...) end
function box(...) return paintutils.drawFilledBox(...) end
function line(...) return paintutils.drawLine(...) end
function write(...) return term.write(...) end
term.redirect(monitor)
w, h = monitor.getSize()

function getSize() w,h = monitor.getSize() end
tCol(colors.white)
local darkmode = true
local darkmodec

local boolArray = {false, false, false, false}

local function log()
    monitor.setTextScale(1.5)
    getSize()
    cls()
    if darkmode then
    darkmodec = colours.black
else
    darkmodec = colours.blue
end
    box(1,1,w,h,darkmodec)
    pos(w/2-#"LOG"/2,1)
    write("LOG")

    pos(5,3)
    write("Woodcutter")
    if boolArray[1]==false then
        box(23,3,26,3,colors.red) else box(23,3,26,3,colors.lime)
    end

    pos(5,5)
    bCol(darkmodec)
    write("Sap")
    if boolArray[2]==false then
        box(23,5,26,5,colors.red) else box(23,5,26,5,colors.lime)
    end

    pos(5,7)
    bCol(darkmodec)
    write("Charcoal")
    if boolArray[3]==false then
        box(23,7,26,7,colors.red) else box(23,7,26,7,colors.lime)
    end

    pos(5,9)
    bCol(darkmodec)
    write("Stripped R.L")
    if boolArray[4]==false then
        box(23,9,26,9,colors.red) else box(23,9,26,9,colors.lime)
    end

    pos(1,h)
    bCol(colors.black)
    write("EXIT")
    while true do
        local event, button, mx, my = os.pullEvent()
        if event == "monitor_touch" then
            if mx >= 1 and mx <= (1+#"EXIT") and my == h then
                return "menu"
            elseif mx >= 23 and mx<= 26 and my == 3 then
                boolArray[1] = not boolArray[1]
                log()
            elseif mx >= 23 and mx<= 26 and my == 5 then
                boolArray[2] = not boolArray[2]
                log()
            elseif mx >= 23 and mx<= 26 and my == 7 then
                boolArray[3] = not boolArray[3]
                log()
            elseif mx >= 23 and mx<= 26 and my == 9 then
                boolArray[4] = not boolArray[4]
                log()
            elseif mx >= w/2-#"LOG"/2 and mx <= w/2+#"LOG"/2 and my == 1 then
                darkmode = not darkmode
                log()
            end
        end
    end
end

return {log = log}