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

Game Table Map Color Assign Help!

Started by Lewisk3, 19 November 2013 - 12:42 AM
Lewisk3 #1
Posted 19 November 2013 - 01:42 AM
Heres My Code
term.clear()
term.setCursorPos(1,1)
back = {
"1111111111111";
"1000000000001";
"1111000000001";
"1000000001111";
"1000000000001";
"1000011100001";
"1000000000001";
"1111111111111";
}
for t=1,#back do
term.setBackgroundColor(colors.black)
print(back[t])

end

Now how do i make it so it assigns a special color to 1 and to 0
Edited on 19 November 2013 - 12:42 AM
amtra5 #2
Posted 19 November 2013 - 02:25 AM
Have you tried having an embedded table for each line, and have the 1 or 0 as an individual table entry. Then have a secondary for loop

term.clear()
term.setCursorPos(1,1)
back = {
{1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,1},
--etc
}
for y=1,#back do
term.setBackgroundColor(colors.black)
for x=1, #back[y] do
term.setCursorPos(x, y)
if back[y[x]] == 1 then
--code
else
--code
end
end
end
Should work, but I don't have time to test it right now
Edited on 19 November 2013 - 01:30 AM