Posted 24 June 2016 - 02:46 PM
Hello, I wanted to make program, witch uses redstone API, and it's not working!
Can you help me? :-)
Code:
local song = 0
while true do
left = rs.getOutput("left")
right = rs.getOutput("right")
top = rs.getOutput("top")
os.queueEvent("randomEvent")
os.pullEvent()
print(song)
if left then
song= song+1
end
if right then
song= song-1
end
if top then
if song == 0 then
rs.setBundledOutput("front", colors.white)
end
if song == 1 then
rs.setBundledOutput("front", colors.orange)
end
if song == 2 then
rs.setBundledOutput("front", colors.red)
end
if song == 3 then
rs.setBundledOutput("front", colors.yellow)
end
if song == 4 then
rs.setBundledOutput("front", colors.blue)
end
if song == 5 then
rs.setBundledOutput("front", colors.brown)
end
if song == 6 then
rs.setBundledOutput("front", colors.lime)
end
if song == 7 then
rs.setBundledOutput("front", colors.green)
end
if song == 8 then
rs.setBundledOutput("front", colors.gray)
end
if song == 9 then
rs.setBundledOutput("front", colors.pink)
end
if song == 10 then
rs.setBundledOutput("front", colors.lightBlue)
end
if song == 11 then
rs.setBundledOutput("front", colors.magenta)
end
if song == 12 then
rs.setBundledOutput("front", colors.black)
end
if song == 13 then
rs.setBundledOutput("front", colors.cyan)
end
if song == 14 then
rs.setBundledOutput("front", colors.purple)
end
if song == 15 then
rs.setBundledOutput("front", colors.lightGray)
end
end
end
Can you help me? :-)
Code:
local song = 0
while true do
left = rs.getOutput("left")
right = rs.getOutput("right")
top = rs.getOutput("top")
os.queueEvent("randomEvent")
os.pullEvent()
print(song)
if left then
song= song+1
end
if right then
song= song-1
end
if top then
if song == 0 then
rs.setBundledOutput("front", colors.white)
end
if song == 1 then
rs.setBundledOutput("front", colors.orange)
end
if song == 2 then
rs.setBundledOutput("front", colors.red)
end
if song == 3 then
rs.setBundledOutput("front", colors.yellow)
end
if song == 4 then
rs.setBundledOutput("front", colors.blue)
end
if song == 5 then
rs.setBundledOutput("front", colors.brown)
end
if song == 6 then
rs.setBundledOutput("front", colors.lime)
end
if song == 7 then
rs.setBundledOutput("front", colors.green)
end
if song == 8 then
rs.setBundledOutput("front", colors.gray)
end
if song == 9 then
rs.setBundledOutput("front", colors.pink)
end
if song == 10 then
rs.setBundledOutput("front", colors.lightBlue)
end
if song == 11 then
rs.setBundledOutput("front", colors.magenta)
end
if song == 12 then
rs.setBundledOutput("front", colors.black)
end
if song == 13 then
rs.setBundledOutput("front", colors.cyan)
end
if song == 14 then
rs.setBundledOutput("front", colors.purple)
end
if song == 15 then
rs.setBundledOutput("front", colors.lightGray)
end
end
end