Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Coded by HPWebcamAble--
- -- Reuploaded per request, It isn't officially supported though --
- --Colors--
- 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
- --User Variables--
- local ColorMonitor = "monitor_2" --This has the color selection
- local AxilleryMonitor = "monitor_3" --This has the 'lock' and 'clear' features
- local defaultC = white --The default color of the monitors
- local monitors= {"monitor_0","monitor_1"} --Any other monitors that are part of the system
- --Variables--
- local version = "1.0"
- local p = peripheral.call
- local cM = ColorMonitor
- local aM = AxilleryMonitor
- local lock = false
- local bg = "setBackgroundColor"
- local bColor = black
- local tColor = white
- local cBColor = black
- local cTColor = white
- local clearM = false
- local curColor = black
- local colors = {white , orange , magenta , lightBlue , yellow , lime , pink , gray , lightGray , cyan , purple , blue , brown , green , red , black}
- --Functions--
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function type()
- p(cM,"write"," ")
- end
- function drawColorSelection() --Draws the Color Selection
- if lock then
- p(cM,bg,black)
- p(cM,"clear")
- p(cM,"setCursorPos",1,2)
- p(cM,"write","System ")
- p(cM,"setCursorPos",1,3)
- p(cM,"write","Locked ")
- else
- p(cM,bg,curColor)
- p(cM,"clear")
- p(cM,"setCursorPos",2,2)
- for i = 1, 5 do
- p(cM,bg,colors[i])
- type()
- end
- p(cM,"setCursorPos",2,3)
- for i = 1, 5 do
- p(cM,bg,colors[i+5])
- type()
- end
- p(cM,"setCursorPos",2,4)
- for i = 1, 5 do
- p(cM,bg,colors[i+10])
- type()
- end
- end
- end
- function drawAMenu() --Draws the Axillary Menu
- if lock then
- bColor = white
- tColor = black
- else
- bColor = black
- tColor = white
- end
- if clearM then
- cBColor = white
- cTColor = black
- else
- cBColor = black
- cTColor = white
- end
- p(aM,bg,bColor)
- p(aM,"setTextColor",tColor)
- p(aM,"setCursorPos",1,1)
- p(aM,"write"," ")
- p(aM,"setCursorPos",1,2)
- p(aM,"write"," Lock ")
- p(aM,"setCursorPos",1,3)
- p(aM,bg,lightGray)
- p(aM,"write"," ")
- p(aM,"setCursorPos",1,4)
- p(aM,bg,cBColor)
- p(aM,"setTextColor",cTColor)
- p(aM,"write"," Clear ")
- p(aM,"setCursorPos",1,5)
- p(aM,"write"," ")
- end
- --Program--
- clear()
- print("Sarting...")
- sleep(1)
- for i = 1, #monitors do
- p(monitors[i],bg,blue)
- p(monitors[i],"clear")
- end
- p(cM,bg,blue)
- p(cM,"clear")
- p(aM,bg,blue)
- p(aM,"clear")
- sleep(1)
- for i = 1, #monitors do
- p(monitors[i],bg,defaultC)
- p(monitors[i],"clear")
- end
- p(cM,bg,defaultC)
- p(cM,"clear")
- p(aM,bg,defaultC)
- p(aM,"clear")
- print("System ready...")
- print("LOG:")
- while true do
- drawColorSelection()
- drawAMenu()
- event,peripheral,x,y = os.pullEvent("monitor_touch")
- print("Touch on " ..peripheral.." at "..x..","..y)
- if peripheral == cM then
- clearM = false
- if x == 2 then
- if y == 1 or y == 5 then
- curColor = black
- elseif y == 2 then
- curColor = white
- elseif y == 3 then
- curColor = lime
- elseif y == 4 then
- curColor = purple
- end
- elseif x == 3 then
- if y == 1 or y == 5 then
- curColor = black
- elseif y == 2 then
- curColor = orange
- elseif y == 3 then
- curColor = pink
- elseif y == 4 then
- curColor = blue
- end
- elseif x == 4 then
- if y == 1 or y == 5 then
- curColor = black
- elseif y == 2 then
- curColor = magenta
- elseif y == 3 then
- curColor = gray
- elseif y == 4 then
- curColor = brown
- end
- elseif x == 5 then
- if y == 1 or y == 5 then
- curColor = black
- elseif y == 2 then
- curColor = lightBlue
- elseif y == 3 then
- curColor = lightGray
- elseif y == 4 then
- curColor = green
- end
- elseif x == 6 then
- if y == 1 or y == 5 then
- curColor = black
- elseif y == 2 then
- curColor = yellow
- elseif y == 3 then
- curColor = cyan
- elseif y == 4 then
- curColor = red
- end
- else
- print("Changing to black...")
- curColor = black
- end
- elseif peripheral == aM then
- if y <= 2 then
- lock = not lock
- elseif y >= 4 then
- clearM = not clearM
- end
- else
- if not lock then
- if clearM then
- p(peripheral,bg,defaultC)
- p(peripheral,"clear")
- else
- p(peripheral,"setCursorPos",x,y)
- p(peripheral,bg,curColor)
- p(peripheral,"write"," ")
- end
- end
- end
- print("Current color:"..curColor)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement