Posted 18 November 2013 - 09:08 AM
Hello all,
I am currently working on a project with sliding doors (via frame motors), but I am a little bit stuck when it commes to executing the commands from a central computer.
Set up:
I have a central computer A which distributes the commands.
I also have 2 computers (B and C) that control the up movement (computer B)/> and the down movement (computer C).
I had a look a quick look at google and this forums and threw together these 2 'controller scripts'.
computer B:
computer C:
The problem that I have is that when I try to run the above scripts (just starting them up)
I get a error ('then' expected on line 4). I am not sure what went wrong there.
The only problem I can come up with is that I am using the tostring command wrong, but the wiki is not very clear to me.
http://computercraft.info/wiki/Tostring
My central computer (computer A) just reads input and than sends it to the proper id (with rednet.send(id, message))
depending on what the input is.
Thanks in advance
enforcer
I am currently working on a project with sliding doors (via frame motors), but I am a little bit stuck when it commes to executing the commands from a central computer.
Set up:
I have a central computer A which distributes the commands.
I also have 2 computers (B and C) that control the up movement (computer B)/> and the down movement (computer C).
I had a look a quick look at google and this forums and threw together these 2 'controller scripts'.
computer B:
rednet.open("top")
while true do
_,message = rednet.receive()
if tostring(message) = "open" then
shell.run("redpulse", "back, "2", "1)
end
end
computer C:
rednet.open("top")
while true do
_, message = rednet.receive()
if tostring(message) = "close" then
shell.run("redpulse", "back", "2", "1")
end
end
The problem that I have is that when I try to run the above scripts (just starting them up)
I get a error ('then' expected on line 4). I am not sure what went wrong there.
The only problem I can come up with is that I am using the tostring command wrong, but the wiki is not very clear to me.
http://computercraft.info/wiki/Tostring
My central computer (computer A) just reads input and than sends it to the proper id (with rednet.send(id, message))
depending on what the input is.
Thanks in advance
enforcer