Posted 18 August 2012 - 04:33 PM
Hi,
I am trying to make a program and it doesn't do what I want it to do. I am a bit confused why it doesn't work.
The redstone output wont go on.
The program is a door lock, with a client computer and an server to check the password.
Here is the client code:
And this is the server code:
I can see that the client accesses the server, but the server does not communicate back.
Or my client code is so crappy I can't see it communicate back :(/>/>
I hope someone can explain what I am doing wrong!
Thomas
I am trying to make a program and it doesn't do what I want it to do. I am a bit confused why it doesn't work.
The redstone output wont go on.
The program is a door lock, with a client computer and an server to check the password.
Here is the client code:
rednet.open("top")
local serverId = 12
while true do
write("Pass:")
local input = read("*")
rednet.send(serverId, input)
senderId,message,distance = rednet.receive()
print("Binnenkomend wachtwoord")
if message == "ok" then do
redstone.setOutput("left", true)
sleep(2)
redstone.setOutput("left", false)
end
if message == "nok" then do
print("Fout wachtwoord!")
end
end
end
end
And this is the server code:
local password = pass
local clientId = 10
rednet.open("right")
print("Online")
while true do
senderId,message,distance = rednet.receive()
print("Login poging")
if senderId == clientId then do
if message == password then do
rednet.send(11, ok)
end
end
end
end
end
I can see that the client accesses the server, but the server does not communicate back.
Or my client code is so crappy I can't see it communicate back :(/>/>
I hope someone can explain what I am doing wrong!
Thomas