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

Rednet

Started by PedroBarbosa, 21 January 2013 - 04:30 AM
PedroBarbosa #1
Posted 21 January 2013 - 05:30 AM
Hi guys,
I need help for a simple code,
I want to a computer, when he broadcast "ABRIR" the turtle's break a block on front and place it again
Lyqyd #2
Posted 21 January 2013 - 05:32 AM
Like this?


while true do
  id, msg = rednet.receive()
  if msg == "ABRIR" then
    turtle.dig()
    turtle.place()
  end
end
Dlcruz129 #3
Posted 21 January 2013 - 05:33 AM
Hi guys,
I need help for a simple code,
I want to a computer, when he broadcast "ABRIR" the turtle's break a block on front and place it again

For the computer:


rednet.open(side) --Change side to the side your modem is on, in quotation marks
rednet.broadcast("ABRIR")

For the turtle:


rednet.open(side) --Same as before
while true do
  id, msg = rednet.receive()
  if msg == "ABRIR" then
    turtle.dig()
    turtle.place()
  end
end

EDIT: Ninja'd by Lyqyd :angry:/>
Lyqyd #4
Posted 21 January 2013 - 05:36 AM
Though, I was operating on the assumption that he'd know to open rednet on the appropriate side, but it is kind of funny that our code was otherwise identical.
PedroBarbosa #5
Posted 21 January 2013 - 05:40 AM
Tkx guys