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

Rednet (crazee) stuff

Started by mahlazor, 01 December 2012 - 05:58 AM
mahlazor #1
Posted 01 December 2012 - 06:58 AM
Alright. I will try to make myself clear.

I basically want to make a two computer-network, where computer 1 detects a redstone signal and sends it via rednet to computer 2 which adds 1 to a counter which is constantly printed to a monitor.

I have made the basic code for computer 2, but not that crazeeshit (rednet stuff), except for rednet.open("back").
I made a simple code for computer 1, which is:

rednet.open("right")
if rs.getInput("back") == 1 then
rednet.send(1,"true!")
print("detected")
end
billysback #2
Posted 01 December 2012 - 06:59 AM
What do you want us to help you with?
NOTE: "help you with" not "do for you"

You just posted some half finished code?
mahlazor #3
Posted 01 December 2012 - 07:06 AM
How I make a counter go up if a rednet message is received
billysback #4
Posted 01 December 2012 - 07:10 AM

local n = 0
while true do
  local event, p1, p2, p3 = os.pullEvent()
  if event == "rednet_recieve" then
    n = n + 1
    term.clear()
    term.setCursorPos(3,3)
    term.write("Pulses: "..n)
  end
end
mahlazor #5
Posted 01 December 2012 - 07:13 AM
Thanks man. Especially for being so fast!
mahlazor #6
Posted 01 December 2012 - 07:51 AM
Just checked if it works (after a bowl of LOVELY soup IRL) and I get this error:
EDIT!
Fix'd it: made a capital p in pull