User blog:Bocajls/Computercraft Color

Currently working om some lua.

Lastest prjoect:

Wire colors need to be in line.

1 = white / just write "white"

2 = orange / Just write "orange"

And so on.

Here's the code:

print (" ")

write (" Choose Color: ")

print (" ")

print (" ")

write (" white. ")

write (" orange. ")

print (" ")

write (" magenta. ")

write (" light blue. ")

print (" ")

write (" yellow. ")

write (" lime. ")

print (" ")

write (" pink. ")

write (" gray. ")

print (" ")

write (" light gray. ")

write (" cyan. ")

print (" ")

write (" purple. ")

write (" blue. ")

print (" ")

write (" brown. ")

write (" green. ")

print (" ")

write (" red. ")

write (" black. ")

term.setCursorPos(16,2)

v = read

if v == "white" then

rs.setBundledOutput("back", 1, true)

elseif v == "orange" then

rs.setBundledOutput("back", 2, true)

elseif v == "magenta" then

rs.setBundledOutput("back", 4, true)

elseif v == "light blue" then

rs.setBundledOutput("back", 8, true)

elseif v == "yellow" then

rs.setBundledOutput("back", 16, true)

elseif v == "lime" then

rs.setBundledOutput("back", 32, true)

elseif v == "pink" then

rs.setBundledOutput("back", 64, true)

elseif v == "gray" then

rs.setBundledOutput("back", 128, true)

elseif v == "light gray" then

rs.setBundledOutput("back", 256, true)

elseif v == "cyan" then

rs.setBundledOutput("back", 512, true)

elseif v == "purple" then

rs.setBundledOutput("back", 1024, true)

elseif v == "blue" then

rs.setBundledOutput("back", 2048, true)

elseif v == "brown" then

rs.setBundledOutput("back", 4096, true)

elseif v == "green" then

rs.setBundledOutput("back", 8192, true)

elseif v == "red" then

rs.setBundledOutput("back", 16384, true)

elseif v == "black" then

rs.setBundledOutput("back", 32768, true)

end

sleep(2)

os.reboot