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()
Rednet:350: string expected (Need help)
Started by gheotic, Feb 03 2013 02:51 AM
3 replies to this topic
#1
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?
#2
Posted 03 February 2013 - 03:02 AM
use tostring on the message
rednet.broadcast(tostring(state))
#4
Posted 03 February 2013 - 06:01 AM
gheotic, on 03 February 2013 - 02:51 AM, said:
--snip--
state = closed --snip-- state = opened --snip--
you have not defined the variables closed or opened, so when you set state to this, you're setting it to nil
either define closed as "closed" and opened as "opened" or change closed to "closed" and opened to "opened"
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











