5 posts
Posted 08 September 2012 - 12:13 AM
receiving computer
rednet.open"right"
function open()
redstone.setOutput("left", true)
sleep(1)
redstone.setOutput("left", false)
sleep(1)
redstone.setOutput("left", true) this is to bring the frames down
sleep(1)
redstone.setOutput("left", false) use this because it needs a pulse to move frames
sleep(1)
redstone.setOutput("left", true)
sleep(1)
redstone.setOutput("left", true)
end
function close()
restone.setOutput("top", true)
sleep(1)
redstone.setOutput("top", false)
sleep(1)
redstone.setOutput("top", true)
sleep(1)
redstone.setOutput("top", false) this to raise the frames
sleep(1)
redstone.setOutput("top", true)
sleep(1)
redstone.setOutput("top", false)
end
id, msg = rednet.receive()
if message == "open" then
open()
end
id, msg = rednet.receive()
if message == "close" then
close()
end
sending computer through lua
rednet.open"right"
rednet.send(id, "open")
it comes out true but gates dose not move
can anyone tell me if this is right or what I doing wrong. I new to this and been trying to figure it out. It takes the program in the receiving computer but when I send through lua on another computer it comes out true but gate does not move.
5 posts
Posted 08 September 2012 - 12:15 AM
oh the parts in the progra where it says used to open or close gates or to make pulse to make motors move frames are not part of the program just notes so you know the functions
55 posts
Location
Everywhere.
Posted 08 September 2012 - 12:57 AM
The last line of function open() is wrong, it should set it to false.
Im afraid I cant help you with red net, im still afraid of it :D/>/>
864 posts
Location
Sometime.
Posted 08 September 2012 - 01:06 AM
Just a pro tip
Use rs (its a clone of redstone, just shorter).
rednet.open("right")
Last redstone is true, set to false
209 posts
Location
In your fridge.
Posted 08 September 2012 - 01:12 AM
For a test, tell it to reply to the computer with "Message Received!" And then open/close to tell you whether it understood the message. So if the string == "open" it reads out: "Message Received! Open Sesame!" or something similar.
Please be more specific. Tell us all exactly what returns true. What function? And please put code tags around your code, and spoilers. Like so:
[*spoiler]
[*code]
–code goes here.
[*/code]
[*/spoiler]
Remove the asterisks. It's a courtesy we use, makes it easier to read.
5 posts
Posted 08 September 2012 - 01:15 AM
yea its set to false in the program though I just typed it wrong on here
5 posts
Posted 08 September 2012 - 01:30 AM
For a test, tell it to reply to the computer with "Message Received!" And then open/close to tell you whether it understood the message. So if the string == "open" it reads out: "Message Received! Open Sesame!" or something similar.
Please be more specific. Tell us all exactly what returns true. What function? And please put code tags around your code, and spoilers. Like so:
[*spoiler]
[*code]
–code goes here.
[*/code]
[*/spoiler]
Remove the asterisks. It's a courtesy we use, makes it easier to read.
ok sorry will do that for now on. as for what comes out true is when I type in through lua to send message open it comes up true under it when I hit enter
ex: rednet.open"right"
rednet.send(5, "open")
true
than it goes back to lua
209 posts
Location
In your fridge.
Posted 08 September 2012 - 01:42 AM
It's telling you it sent the message, not that its partner received it. As I said, tell your subordinate computer (the one that receives the message) to reply with a
"if rednet.receive() then" command.
Don't be sorry for not knowing the code tags, you didn't know they existed, that's why I told you.
–Lettuce
5 posts
Posted 08 September 2012 - 04:34 AM
It's telling you it sent the message, not that its partner received it. As I said, tell your subordinate computer (the one that receives the message) to reply with a
"if rednet.receive() then" command.
Don't be sorry for not knowing the code tags, you didn't know they existed, that's why I told you.
–Lettuce
I had put the test in and it did not receive the message any reason why it did not the computers are within 10 blocks of each other just diaginal do they have to be in a straight line?
209 posts
Location
In your fridge.
Posted 08 September 2012 - 04:54 AM
Diagonal or straight makes no difference. It's a radius.
Try to do
while true do
if os.pullEvent("rednet_message")
msg = os.pullEvent("rednet_message")
return false
end
end
I'm inexperienced with rednet, but this should yield the computer until the os.pullEvent() receives a message. Then it will make msg equal that message, and return false, breaking the "while true do" loop. Then it will run the rest of the program. This should be entered at the beginning of the subordinate computer program. HOPEFULLY that works.
–Lettuce