Jump to content




Rednet


  • You cannot reply to this topic
4 replies to this topic

#1 PedroBarbosa

  • Members
  • 27 posts

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

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

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


#3 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 21 January 2013 - 05:33 AM

View PostPedroBarbosa, on 21 January 2013 - 05:30 AM, said:

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:

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

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.

#5 PedroBarbosa

  • Members
  • 27 posts

Posted 21 January 2013 - 05:40 AM

Tkx guys





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users