Posted 03 February 2013 - 02:51 AM
Im trying to make a program thats emits redstone if it get a signal from rednet but im also trying to make a function so if it get the signal (getState) then it send back the state but when i try that i just get this error rednet:350: string expected on the computer why?
local state = nil
local modem = "top"
local side = "left"
function Clear()
term.clear()
term.setCursorPos(1,1)
end
function RCslave()
while true do
local scrap, message = rednet.receive(5)
if message == "closeGate" then
redstone.setOutput(side,true)
Clear()
print("Close Gate")
state = closed
elseif message == "openGate" then
Clear()
redstone.setOutput(side,false)
print("Open Gate")
state = opened
elseif message == "getState" then
rednet.broadcast(state)
print("Broadcast state")
end
end
end
Clear()
rednet.open(modem)
textutils.slowPrint("Waiting for signal")
RCslave()