Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MonitorSide = "bottom"
- Monitor = term
- function ClearMonitor()
- Monitor.setTextColor(colours.black)
- Monitor.setBackgroundColor(colours.black)
- Monitor.clear()
- Monitor.setCursorPos(1,1)
- end
- function DrawText(xPos, yPos, text, textColour, backgroundColour)
- Monitor.setBackgroundColor(backgroundColour)
- Monitor.setTextColor(textColour)
- Monitor.setCursorPos(xPos,yPos)
- Monitor.write(text)
- end
- function StringToColour(colourName)
- if (colourName == "black" ) then return colours.black end
- if (colourName == "red" ) then return colours.red end
- if (colourName == "green" ) then return colours.green end
- if (colourName == "brown" ) then return colours.brown end
- if (colourName == "blue" ) then return colours.blue end
- if (colourName == "purple" ) then return colours.purple end
- if (colourName == "cyan" ) then return colours.cyan end
- if (colourName == "lightgrey") then return colours.lightGrey end
- if (colourName == "grey" ) then return colours.grey end
- if (colourName == "pink" ) then return colours.pink end
- if (colourName == "lime" ) then return colours.lime end
- if (colourName == "yellow" ) then return colours.yellow end
- if (colourName == "lightblue") then return colours.lightBlue end
- if (colourName == "magenta" ) then return colours.magenta end
- if (colourName == "orange" ) then return colours.orange end
- if (colourName == "white" ) then return colours.white
- else return colours.white end
- end
- function Main()
- term.clear()
- DrawText(1, 1, "Avaliable Colours:", colours.white, colours.black)
- DrawText(1, 2, "black " , colours.white, colours.black )
- DrawText(1, 3, "red " , colours.white, colours.red )
- DrawText(1, 4, "green " , colours.white, colours.green )
- DrawText(1, 5, "brown " , colours.white, colours.brown )
- DrawText(1, 6, "blue " , colours.white, colours.blue )
- DrawText(1, 7, "purple " , colours.white, colours.purple )
- DrawText(1, 8, "cyan " , colours.white, colours.cyan )
- DrawText(1, 9, "lightgrey " , colours.white, colours.lightGrey )
- DrawText(12, 2, "grey " , colours.white, colours.grey )
- DrawText(12, 3, "pink " , colours.white, colours.pink )
- DrawText(12, 4, "lime " , colours.white, colours.lime )
- DrawText(12, 5, "yellow " , colours.white, colours.yellow )
- DrawText(12, 6, "lightblue " , colours.white, colours.lightBlue )
- DrawText(12, 7, "magenta " , colours.white, colours.magenta )
- DrawText(12, 8, "orange " , colours.white, colours.orange )
- DrawText(12, 9, "white " , colours.black, colours.white )
- DrawText(1, 10, "What colours should the chest be?", colours.white, colours.black)
- DrawText(1, 11, "Colour 1: ", colours.white, colours.black)
- local colour1 = read()
- DrawText(1, 12, "Colour 2: ", colours.white, colours.black)
- local colour2 = read()
- DrawText(1, 13, "Colour 3: ", colours.white, colours.black)
- local colour3 = read()
- while true do
- local chest = peripheral.wrap("left")
- if (chest == nil) then
- DrawText(1, 15, "Chest is not on the left.", colours.white, colours.red)
- else
- DrawText(1, 15, "Setting colours to ", colours.white, colours.green)
- local actualColour1 = StringToColour(colour1)
- local actualColour2 = StringToColour(colour2)
- local actualColour3 = StringToColour(colour3)
- DrawText(1, 16, " ", actualColour1, actualColour1)
- DrawText(6, 16, " ", actualColour2, actualColour2)
- DrawText(11, 16, " ", actualColour3, actualColour3)
- chest.setColours(actualColour1, actualColour2, actualColour3)
- end
- sleep(0.5)
- end
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement