- I am trying to make a simple code for a few spawners, and want to use bundled cables, but i've hit a brick wall… im not sure what im doing wrong.. the code works more or less,
but its not saving the colors thats allready active in the table i want to use for it..
(Sorry for the bad describtion)
http://pastebin.com/0ynx1UvH
Spoiler
col = {
[1] = 0, -- Inactive
[2] = 1, -- White
[3] = 2, -- Orange
[4] = 4, -- Magenta
[5] = 8, -- Light Blue
[6] = 16, -- Yellow
[7] = 32, -- Lime
[8] = 64, -- Pink
[9] = 128, -- Gray
[10] = 256, -- Light Gray
[11] = 512, -- Cyan
[12] = 1024, -- Purple
[13] = 2048, -- Blue
[14] = 4096, -- Brown
[15] = 8192, -- Green
[16] = 16384, -- Red
[17] = 32768, -- Black
}
on = {}
function getOn()
for i = 1,#col do
if rs.getBundledOutput("right") == col[i] then
table.insert(on, col[i])
end
end
end
getOn()
for i = 1,#on do
print(on[i])
end
input = read()
if input then
if input == "white" then
if not on == col[1] then
for i = 1,#on do
rs.setbundledOutput("right", col[2]+on[i])
end
else
rs.setBundledOutput("right", col[2])
end
end
if input == "green" then
if not on == col[1] then
for i = 1,#on do
rs.setbundledOutput("right", col[2]+on[i])
end
else
rs.setBundledOutput("right", col[15])
end
end
if input == "red" then
if not on == col[1] then
for i = 1,#on do
rs.setbundledOutput("right", col[2]+on[i])
end
else
rs.setBundledOutput("right", col[16])
end
end
end
Hope you can help me!!
Regards Plazter