This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Aracan's profile picture

[rednet] receive form multiple Senders ...?

Started by Aracan, 25 March 2013 - 02:45 AM
Aracan #1
Posted 25 March 2013 - 03:45 AM
Hi there !

I've come across a "small" problem… i wanted to do a frame motor moved MiningWell Quarry like Direwolf did in his lets play.
But i dont wanna copy his computercraft programs plus i want to have some extra in it he dont has.

So here is the problem. 8 Turtles place the Mining Well's infront of them. The Mining Wells eject their mined ores and stones in the Turtles,
and the Turtles empty their Inventory in an Enderchest beneath them. Now when the turtles are finished with empty their inventory
i'd like to send a rednet message from every turtle, to the main computer, that they have finished their process.
But i cant realize how to do this.
I suggest that when i go with

rednet.open("side")
local senderId, message, distance=rednet.receive()

and then something like

if (turtle01 says "finish") and (turtle02 says "finish") and (turtle03 says "finish") then
rs.setOutput
end

i think i unwillingly override the messeges from every turtle, am i right ?

After hours of testing… i need to get a hind from the pro's how to receive multiple messages and binds them together in an "if, and" condition.

Please help me :(/>

PS: Dont look at my spelling … im awake for so long trying to get that program working … im exhausted
Aracan #2
Posted 25 March 2013 - 06:15 AM
Okay, we can close this Topic.
I've solved the problem, letting each turtle return ("01") ("02") and so on
and setting the main computer if message== ("01") and ("02") ….
that seems to work .. :)/>
thank you anyways
Doyle3694 #3
Posted 25 March 2013 - 10:52 AM
'if message == "01" and "02" then' will always be true since "02" is a string and strings become true inside if statements
immibis #4
Posted 25 March 2013 - 06:38 PM
message is the most recently received message. It can't be more than one thing at a time.
You need to use a table to keep track of which turtles have finished.
LordIkol #5
Posted 26 March 2013 - 01:18 AM
Cause i was bored at work i wrote some script that should do what you want

You can find it here. Im not a Pro but maybe it helps: http://pastebin.com/3X6BWxzM

PS. if you dont get the Comments feel free to ask

Greets
Loki