Posted 14 June 2015 - 12:13 AM
ok, so i am making a frame elvator to be controlled by 6 computers, while conveluted it has to be done this way. I am kind of a newbie at computer craft and wrote some of the program, but i can't seem to get it to work at all. Below is my code, if anyone could help me out that would be much appriciated.
local side = "back"
function pulse(color, amount, length)
for i = 1, amound do
rs.setBundledOutput(side, color)
os.sleep(length)
rs.setBundledOutput(side, 0)
os.sleep(length)
end
end
local floor = 0
if rs.getBundledInput("top", colors.blue) then
floor = 1
end
if rs.getBundledInput("top", colors.red) then
floor = 2
end
if rs.getBundledInput("top", colors.white) then
floor = 3
end
if rs.getBundledInput("top", colors.lime) then
floor = 4
end
if rs.getBundledInput("top", colors.yellow) then
floor = 5
end
if rs.getBundledInput("top", colors.orange) then
floor = b
end
while true do
term.clear()
term.setCursorPos(1,1)
print("Please Enter Call or a floor number B-5")
write("Input: ")
local input = read()
if floor == 1 and input == call then
pulse(8, 0, 0)
end
if floor == 2 and input == call then
pulse(8, 6, .4)
end
if floor == 3 and input == call then
pulse(8, 12, .4)
end
if floor == 3 and input == call then
pulse(8, 18, .4)
end
if floor == 4 and input == call then
pulse(8, 24, .4)
end
if floor == 5 and input == call then
pulse(8, 30, .4)
end
if floor == b and input == call then
pulse(4, 6, .4)
end
if input == b then
pulse(8, 6, .4)
end
if input == 1 then
pulse(0, 0, 0)
end
if input == 2 then
pulse(4, 6, .4)
end
if input == 3 then
pulse(4, 12, .4)
end
if input == 4 then
pulse(4, 18, .4)
end
if input == 5 then
pulse(4, 24, .4)
end
end
Thanks
ShamefulChris
local side = "back"
function pulse(color, amount, length)
for i = 1, amound do
rs.setBundledOutput(side, color)
os.sleep(length)
rs.setBundledOutput(side, 0)
os.sleep(length)
end
end
local floor = 0
if rs.getBundledInput("top", colors.blue) then
floor = 1
end
if rs.getBundledInput("top", colors.red) then
floor = 2
end
if rs.getBundledInput("top", colors.white) then
floor = 3
end
if rs.getBundledInput("top", colors.lime) then
floor = 4
end
if rs.getBundledInput("top", colors.yellow) then
floor = 5
end
if rs.getBundledInput("top", colors.orange) then
floor = b
end
while true do
term.clear()
term.setCursorPos(1,1)
print("Please Enter Call or a floor number B-5")
write("Input: ")
local input = read()
if floor == 1 and input == call then
pulse(8, 0, 0)
end
if floor == 2 and input == call then
pulse(8, 6, .4)
end
if floor == 3 and input == call then
pulse(8, 12, .4)
end
if floor == 3 and input == call then
pulse(8, 18, .4)
end
if floor == 4 and input == call then
pulse(8, 24, .4)
end
if floor == 5 and input == call then
pulse(8, 30, .4)
end
if floor == b and input == call then
pulse(4, 6, .4)
end
if input == b then
pulse(8, 6, .4)
end
if input == 1 then
pulse(0, 0, 0)
end
if input == 2 then
pulse(4, 6, .4)
end
if input == 3 then
pulse(4, 12, .4)
end
if input == 4 then
pulse(4, 18, .4)
end
if input == 5 then
pulse(4, 24, .4)
end
end
Thanks
ShamefulChris