Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function weichenkontrolle()
- local counter = 0;
- local changed = false
- local gleis1 = colors.orange
- local gleis2 = colors.yellow
- local gleis3 = colors.green
- local gleis4 = colors.gray
- print("Weichenkontrolle wird gestartet....")
- while true do
- if colors.test(redstone.getBundledInput("left"), 2048) == true then
- --print("zuuuug")
- if counter == 0 and colors.test(redstone.getBundledInput("right"), colors.white) then
- redstone.setBundledOutput("left", colors.orange)
- --print(counter .. " is the counter and white is green so go there")
- elseif counter == 1 and colors.test(redstone.getBundledInput("right"), colors.yellow) then
- redstone.setBundledOutput("left", colors.yellow)
- --print(counter .. " is the counter and yellow is green so go there")
- elseif counter == 2 and colors.test(redstone.getBundledInput("right"), colors.lime) then
- redstone.setBundledOutput("left", colors.green)
- --print(counter .. " is the counter and lime is green so go there")
- elseif counter == 3 and colors.test(redstone.getBundledInput("right"), colors.pink) then
- redstone.setBundledOutput("left", colors.gray)
- --print(counter .. " is the counter and pink is green so go there")
- elseif colors.test(redstone.getBundledInput("right"), colors.cyan) then
- --print(counter .. " is the counter and cyan is green so go there")
- redstone.setBundledOutput("left", 0)
- else
- if colors.test(redstone.getBundledInput("right"), colors.white) then
- --print("cwhite")
- redstone.setBundledOutput("left", colors.orange)
- elseif colors.test(redstone.getBundledInput("right"), colors.yellow) then
- --print("cyellow")
- redstone.setBundledOutput("left", colors.yellow)
- elseif colors.test(redstone.getBundledInput("right"), colors.lime) then
- --print("clime")
- redstone.setBundledOutput("left", colors.green)
- elseif colors.test(redstone.getBundledInput("right"), colors.pink) then
- --print("cpink")
- redstone.setBundledOutput("left", colors.gray)
- else
- --print("cyan")
- redstone.setBundledOutput("left", 0)
- end
- end
- changed = true
- counter = counter + 1
- if counter > 4 then
- counter = 0
- end
- end
- --print("kein zuuuug " .. redstone.getBundledInput("left") )
- if changed then
- sleep(2)
- changed = false
- else
- sleep(0.5)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment