Advertisement
maxtorcd55

printer

Apr 16th, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.99 KB | None | 0 0
  1. local moni = peripheral.wrap("left")
  2. moni.setTextScale(1)
  3. local x, y = moni.getSize()
  4. local kleurtje
  5. local colorCount = {{},{},{},{},{},{},{},{},{},{},{},{},{},{}}
  6.  
  7. local bluePrint = {}
  8. for i = 1, 60 do
  9.     bluePrint[i] = {}
  10.     for j = 1, 25 do
  11.         bluePrint[i][j] = {}
  12.         for d = 1, 35 do
  13.             bluePrint[i][j][d] = colors.blue
  14.         end
  15.     end
  16. end
  17. for i = 1, #colorCount do colorCount[i] = 0 end
  18.  
  19. print("X: "..x ..",Y: "..y)
  20.  
  21. while true do
  22. moni.clear()
  23. for i = 1, #colorCount do colorCount[i] = 0 end
  24. for i = 2 , #bluePrint do
  25.     for j = 2, #bluePrint[i] do
  26.         moni.setCursorPos(i,j)
  27.         --moni.setTextColor(bluePrint[i][j][1])
  28.         --moni.write("0")
  29.         moni.setBackgroundColor(bluePrint[i][j][1])
  30.         moni.write(" ")
  31.         moni.setBackgroundColor(colors.black)
  32.  
  33.        
  34.         if bluePrint[i][j][1] == colors.white then colorCount[1] = colorCount[1] + 1 end
  35.         if bluePrint[i][j][1] == colors.orange then colorCount[2] = colorCount[2] + 1 end
  36.         if bluePrint[i][j][1] == colors.magenta then colorCount[3] = colorCount[3] + 1 end
  37.         if bluePrint[i][j][1] == colors.lightBlue then colorCount[4] = colorCount[4] + 1 end
  38.         if bluePrint[i][j][1] == colors.yellow then colorCount[5] = colorCount[5] + 1 end
  39.         if bluePrint[i][j][1] == colors.lime then colorCount[6] = colorCount[6] + 1 end
  40.         if bluePrint[i][j][1] == colors.pink then colorCount[7] = colorCount[7] + 1 end
  41.         if bluePrint[i][j][1] == colors.gray then colorCount[8] = colorCount[8] + 1 end
  42.         if bluePrint[i][j][1] == colors.lightGray then colorCount[9] = colorCount[9] + 1 end
  43.         if bluePrint[i][j][1] == colors.cyan then colorCount[10] = colorCount[10] + 1 end
  44.         if bluePrint[i][j][1] == colors.purple then colorCount[11] = colorCount[11] + 1 end
  45.         if bluePrint[i][j][1] == colors.brown then colorCount[12] = colorCount[12] + 1 end
  46.         if bluePrint[i][j][1] == colors.green then colorCount[13] = colorCount[13] + 1 end
  47.         if bluePrint[i][j][1] == colors.red then colorCount[14] = colorCount[14] + 1 end
  48.  
  49.     end
  50. end
  51.  
  52.  
  53.  
  54. moni.setCursorPos(63,2) moni.setBackgroundColor(colors.white) moni.write("  "..colorCount[1].."  ")
  55. moni.setCursorPos(63,3) moni.setBackgroundColor(colors.orange) moni.write("  "..colorCount[2].."  ")
  56. moni.setCursorPos(63,4) moni.setBackgroundColor(colors.magenta) moni.write("  "..colorCount[3].."  ")
  57. moni.setCursorPos(63,5) moni.setBackgroundColor(colors.lightBlue) moni.write("  "..colorCount[4].."  ")
  58. moni.setCursorPos(63,6) moni.setBackgroundColor(colors.yellow) moni.write("  "..colorCount[5].."  ")
  59. moni.setCursorPos(63,7) moni.setBackgroundColor(colors.lime) moni.write("  "..colorCount[6].."  ")
  60. moni.setCursorPos(63,8) moni.setBackgroundColor(colors.pink) moni.write("  "..colorCount[7].."  ")
  61. moni.setCursorPos(63,9) moni.setBackgroundColor(colors.gray) moni.write("  "..colorCount[8].."  ")
  62. moni.setCursorPos(63,10) moni.setBackgroundColor(colors.lightGray) moni.write("  "..colorCount[9].."  ")
  63. moni.setCursorPos(63,11) moni.setBackgroundColor(colors.cyan) moni.write("  "..colorCount[10].."  ")
  64. moni.setCursorPos(63,12) moni.setBackgroundColor(colors.purple) moni.write("  "..colorCount[11].."  ")
  65. moni.setCursorPos(63,13) moni.setBackgroundColor(colors.brown) moni.write("  "..colorCount[12].."  ")
  66. moni.setCursorPos(63,14) moni.setBackgroundColor(colors.green) moni.write("  "..colorCount[13].."  ")
  67. moni.setCursorPos(63,15) moni.setBackgroundColor(colors.red) moni.write("  "..colorCount[14].."  ")
  68. moni.setCursorPos(63,16) moni.setBackgroundColor(colors.blue) moni.write("     ")
  69. moni.setCursorPos(63,17) moni.setBackgroundColor(colors.blue) moni.write("     ")
  70.  
  71. moni.setBackgroundColor(colors.black)
  72.  
  73. event, side, xPos, yPos = os.pullEvent("monitor_touch")
  74.  
  75.  
  76. if (tonumber(xPos) == 1) and (tonumber(yPos) == 1) then
  77.     kleurtje = colors.blue
  78. end
  79. if (tonumber(xPos) == 1) and (tonumber(yPos) == 2) then
  80.     kleurtje = colors.yellow
  81. end
  82. if (tonumber(xPos) == 1) and (tonumber(yPos) == 3) then
  83.     kleurtje = colors.red
  84. end
  85. if (tonumber(xPos) == 1) and (tonumber(yPos) == 4) then
  86.     kleurtje = colors.green
  87. end
  88.  
  89.  
  90.  
  91. bluePrint[xPos][yPos][1] = kleurtje
  92.  
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement