This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
tobi6369's profile picture

visualizing text positions?

Started by tobi6369, 21 March 2016 - 09:11 PM
tobi6369 #1
Posted 21 March 2016 - 10:11 PM
is there a way to visualizing text positions? like with random colors or a checker board pattern
moTechPlz #2
Posted 21 March 2016 - 11:10 PM
Yes sure, lots of ways. Be more specific in what you are doing and what you need.
tobi6369 #3
Posted 21 March 2016 - 11:16 PM
i am making an elevator using buttons on monitors to control it, and i keep misplacing the buttons. so i was wondering if there were a way to color each pixel a random color to visualizing text positions
KingofGamesYami #4
Posted 22 March 2016 - 01:01 AM
A checkerboard pattern is really simple:


local tColorIndex = {
  [0] = { [0] = colors.white, [1] = colors.black },
  [1] = { [0] = colors.black, [1] = colors.white },
}

local maxx, maxy = term.getSize()
for x = 1, maxx do
  for y = 1, maxy do
    term.setCursorPos( x, y )
    term.setBackgroundColor( tColorIndex[ x % 2 ][ y % 2 ] )
    term.write( " " )
  end
end