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

Rednet repeater

Started by theeboris, 26 November 2012 - 05:31 AM
theeboris #1
Posted 26 November 2012 - 06:31 AM
This is my rednetrepeater.
Sorry for my bad english.
If you want to send a message to a specific id use this.
Spoiler
term.clear()
term.setCursorPos(1,1)
local function connect()
for _,s in ipairs(rs.getSides()) do
  if peripheral.isPresent(s) and peripheral.getType(s) == "modem" then
   rednet.open(s)
   return true
  end
end
term.clear()
print("ERROR")
print("No modem found")
print("Aborting")
sleep(3)
os.shutdown()
return false
end
connect()
i = 0
while true do
term.clear()
term.setCursorPos(1,1)
print (i.." messages passed")
senderId, message, distance = rednet.receive()
rednet.send(21,""..message)
i = i+1
end
edit line 25 to
rednet.send(your id,""..message)
If you want to broadcast a message use this
Spoiler
term.clear()
term.setCursorPos(1,1)
local function connect()
for _,s in ipairs(rs.getSides()) do
  if peripheral.isPresent(s) and peripheral.getType(s) == "modem" then
   rednet.open(s)
   return true
  end
end
term.clear()
print("ERROR")
print("No modem found")
print("Aborting")
sleep(3)
os.shutdown()
return false
end
connect()
i = 0
while true do
term.clear()
term.setCursorPos(1,1)
print (i.." messages passed")
senderId, message, distance = rednet.receive()
rednet.broadcast(""..message)
i = i+1
end
Dlcruz129 #2
Posted 26 November 2012 - 07:32 AM
Use code tags and proper formatting.

EDIT: Thanks. Pretty neat!
Tiin57 #3
Posted 26 November 2012 - 03:50 PM
Nope
Be quiet, small child.
On topic: Good first release, OP. Well done.
rhyleymaster #4
Posted 26 November 2012 - 05:47 PM
Nope
Be quiet, small child. On topic: Good first release, OP. Well done.

LOL

On Topic:
Good first program (Or Post)
My first was a very crappy PC lock i had made on Immibis' server. Your pretty good for starting.
ChunLing #5
Posted 26 November 2012 - 06:39 PM
hehe, mine was a super-simple bonemeal wheat farmer. I still use it when I want wheat from bonemeal. I think that someone eventually commented on that post about it needing a chest, but I couldn't see the point. I mean, I'm the only part of the setup that eats bread, and just how much bread am I going to need?
theeboris #6
Posted 27 November 2012 - 06:46 AM
This is not my first program. My first program is: http://www.computercraft.info/forums2/index.php?/topic/5544-rednet-monitor-license-system/page__hl__%2Brednet+%2Bmonitor__fromsearch__1
PixelToast #7
Posted 27 November 2012 - 06:53 AM
i dont even remember my first computer was used for :s
probably a stupid door lock
theeboris #8
Posted 27 November 2012 - 08:25 AM
My first computer is for roaming profile