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

Base Update Program

Started by SigmaSum, 04 July 2015 - 12:58 AM
SigmaSum #1
Posted 04 July 2015 - 02:58 AM
So I'm tying to get a bunch of Computers in my base to send messages to a master computer in my control room updating me about things in my base like my quarry turning off or crafting job done or Reactor turning on well the receiver (master control computer) code is not working well could use help.


mon = peripheral.wrap("right")
rednet.open("left")
mon.clear()
data = {{3,"Reactor"},{4,"Quarry"}}
while true do
    id, message = rednet.receive("SigmaSum", 10)
    if message == true then
	  message = "ON"
    else
	  message = "OFF"
    end
    mon.write(data[find()][2] .." " ..message)
    newLine()	   
end
function find()
  for i=1,#data do
    if data[i][1] == id then
	  return i
    end
  end
  return 0
end
function newLine()
  local _,cY = mon.getCursorPos()
  mon.setCursorPos(1,cY+1)
end

So my function won't call if I just is like error attempt to call. So yeah FYI the minion computers just broadcast a message with the protocol SigmaSum and true or false if they are receiving redstone.
Bomb Bloke #2
Posted 04 July 2015 - 03:39 AM
Remember that scripts run from top to bottom - you can't call your function before you define it!
SigmaSum #3
Posted 04 July 2015 - 05:49 PM
RAGE! Thanks for the help