Feed the Beast uses computercraft version 1.5. This means that you can not use a protocol when using rednet. Protocol was not implemented until computercraft version 1.6+.
os.pullEvent = os.pullEventRaw
while true do
(1) senderId, message = (rednet.receive(
(2)"westerndigital")) —- Protocol is not implemented in the version you are using so you can not use it
password =
(6)changeme if
(5)"message" =
(5)"password" then
(3)rednet.open("back") rs.setOutput("right", true)
sleep(5)
rs.setOutput("right", false)
(4)os.reboot() end
end
1. Rednet.receive() returns 2 values. The id of the computer that sent the message, and the message that is sent. The order that they are returned is senderid, message. In order for you to get the message you have to assign the first value (the senderid) to a variable. (NOTE: In computercraft 1.6+ rednet.receive() returns 3 things with the 3rd value being protocol)
2. Protocol for the rednet api is not implemented in the version of computercraft that feed the beast uses. Using a protocol is what caused the error.
3. You have to open rednet before you use it. Move the rednet.open("back") to somewhere before you use rednet.
4. It is also bad practice to use os.reboot() to restart a program. It would be better to put "message = nil" there and remove os.reboot(). That will make it to where the message varialble equals nothing, so it no longer equals password.
5. You need to remove the quotation marks "" around message and password. When you put quotation marks around something it is considered a string not a variable. Because of this it is litterally checking to see if the word message equals the word password.
6. You need quotation marks around this. As it is trying to set the password variable to a variable called changeme, which does not exist.
os.pullEvent = os.pullEventRaw
while true do
rednet.open("back")
senderId, message = (rednet.receive()) ---- Protocol is not implemented in the version you are using so you can not use it
password = "changeme"
if message = password then
rs.setOutput("right", true)
sleep(5)
rs.setOutput("right", false)
message = nil
end
end
The error msg you got
rednet:68: Expected number was caused by how you used rednet.receive(). The error occured on line 68 of the rednet api not your program. Since protocol was not added in the version you are using the only argument that you can pass to rednet.receive is a number, so when you inputed the protocol (a string) it errored.
edit: Sorry would have put the original code in a code block like the corrected code, but I could not color the errors then.
edit2: Sorry that a few of them are out of order. They were in order at first, but I found a couple more after i did the original post.