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

Rednet send message

Started by infizl, 06 July 2013 - 01:18 PM
infizl #1
Posted 06 July 2013 - 03:18 PM
Im trying to send a message with rednet to another computer but it dosent seem to want to work.

im using open peripherals to get a signal from a quarry so that i can tell if its active or not and sending that through rednet to a computer that connects to a monitor and prints the true false message that should be being sent but it dosent seem to work

here is the code for computer hooked to quarry sending the message


rednet.open("right")
net = peripheral.wrap("back")

net = net.callRemote("quarry_1","isActive")
while true do
rednet.send(13,net)
sleep(0.5)
end

and here is the code for the second computer receiving the message and writing it to the screen

rednet.open("left")
local monitor = peripheral.wrap("top")

while true do
id,message = rednet.receive()

monitor.write(message)
sleep(0.5)
end

if anyone can tell me what im doing wrong id be very appriciative thanks :D/>
Yevano #2
Posted 06 July 2013 - 08:31 PM
rednet.send expects a string for the message, and you're giving it a boolean. Instead, you could do something like this:

rednet.send(13, net and "1" or "0")

That will send "1" if net is true or "0" if net is false. On the other side, you just check for "1" or "0". You can of course use whatever strings you want.
infizl #3
Posted 06 July 2013 - 08:48 PM
i got it to work but then i realized you cant send a rednet message through different worlds and that ruined the whole thing enles there is a way and i dont know how
albrat #4
Posted 07 July 2013 - 10:28 AM
i think there is a 50 block range on renet as well…
Lord_Spelunky #5
Posted 07 July 2013 - 10:56 AM
i got it to work but then i realized you cant send a rednet message through different worlds and that ruined the whole thing enles there is a way and i dont know how
You could do it a few other ways, maybe an enderchest and get the turtle to get item stack, if it is one then make it emit a signal, if it isn't then stop it.
ZagKalidor #6
Posted 07 July 2013 - 12:22 PM
You could also do it, using a wired buildcraft structure pipe with a logical-gate, checking for "work scheduled - work done". But the traveling time for the signal gets long at long distances. Also put a gate at the receiver computer that emits a redstone signal when receiving a pipewire signal. Then you check via rs.getInput at the computer.