Posted 29 July 2012 - 03:31 AM
wifi piston menu code startup:84:attempt to call nil error
hello all i am new to computercraft and have been messing about with it for the last few day i know a little vb and c# but this has stumped me the pistons open and close open is fine but when i close them it crashes hope some one can help me here is code for doors and menu ohhh and i am using ComputerCraft1.33 minecraft 1.2.5 thanks sooo much if you can help
menu code id 6
Piston door one id 10
piston door two id 11
hello all i am new to computercraft and have been messing about with it for the last few day i know a little vb and c# but this has stumped me the pistons open and close open is fine but when i close them it crashes hope some one can help me here is code for doors and menu ohhh and i am using ComputerCraft1.33 minecraft 1.2.5 thanks sooo much if you can help
menu code id 6
rednet.open("top")
x = "test"
while x ~= "exit" do
------main
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
print "|Welcome please type command below|"
print "| |"
print "|1 = station gates |"
print "| |"
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
x = io.read()
if x == "1" then
term.clear()
term.setCursorPos(1,1)
y = "test"
while y ~= "exit" do
------station gates
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
print "| Station gate |"
print "| access |"
print "| |"
print "| 1 = open 2 = close |"
print "| exit = main menu |"
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
y = io.read()
---open
if y == "1" then
term.clear()
term.setCursorPos(1,1)
rednet.send(10, "open")
id,message = rednet.receive(10)
if id == 10 and message == "open" then
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
print " station gate 1 open "
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
end
rednet.send(11, "open")
id,message = rednet.receive(10)
if id == 11 and message == "open" then
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
print " station gate 2 open "
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
end
sleep(2)
term.clear()
term.setCursorPos(1,1)
end
if y == "2" then
rednet.send(10, "closed")
id,message = rednet.receive(10)
if id == 10 and message == "closed" then
print("worked")
end
rednet.send(11, "closed")
id,message = rednet.recieve(1)
if id == 11 and message == "closed" then
print("worked")
end
end
end
end
end
Piston door one id 10
side = "back"
rednet.open(side)
function clear()
term.clear()
term.setCursorPos(1,1)
end
clear()
while true do
event, param1, param2 = os.pullEvent("rednet_message")
----on
if param2 == "open" then
print("i am on")
rednet.send(6, "open")
redstone.setOutput("left",false)
end
----off
if param2 == "closed" then
print("i got stopped")
rednet.send(6, "closed")
redstone.setOutput("left", true)
end
----check
if param2 == "check" then
if redstone.getOutput("left") == false then
print("got check")
rednet.send(8, "open")
end
if redstone.getOutput("left") == true then
print("got check")
rednet.send(8, "closed")
end
end
end
clear()
piston door two id 11
side = "bottom"
rednet.open(side)
function clear()
term.clear()
term.setCursorPos(1,1)
end
clear()
while true do
event, param1, param2 = os.pullEvent("rednet_message")
----open
if param2 == "open" then
print("i am on")
rednet.send(6, "open")
redstone.setOutput("left",false)
end
----close
if param2 == "closed" then
print("i got stopped")
rednet.send(6, "closed")
redstone.setOutput("left", true)
end
----check
if param2 == "check" then
if redstone.getOutput("left") == false then
print("got check")
rednet.send(8, "open")
end
if redstone.getOutput("left") == true then
print("got check")
rednet.send(8, "closed")
end
end
end
clear()