5 posts
Posted 15 January 2013 - 06:36 AM
while true do
local senderId, message, distance = rednet.message()
if y == "b1o" then
redstone.setBundledOutput("bottom", colors.orange)
os.reboot()
end
elseif message == "b2o" then
redstone.setBundledOutput("bottom", colors.blue)
os.reboot()
end
elseif message == "b3o" then
redstone.setBundledOutput("bottom", colors.white)
os.reboot()
end
elseif message == "b4o" then
redstone.setBundledOutput("bottom", colors.magenta)
os.reboot()
end
elseif message == "bo" then
redstone.setBundledOutput("bottom", colors.orange+colors.blue+colors.white+colors.magenta)
os.reboot()
end
elseif message == "bc" then
redstone.setBundledOutput("bottom", 0)
os.reboot()
end
end
What is my mistake?
PS: Sorry for the few informations, my english is very bad …
8543 posts
Posted 15 January 2013 - 06:41 AM
Remove all of the os.reboot calls. When the computer reboots, all redstone outputs are turned off.
2005 posts
Posted 15 January 2013 - 06:42 AM
rednet.message() is not a valid function. In the future you should post the actual error produced.
5 posts
Posted 15 January 2013 - 07:06 AM
I´am very sorry this is the error:
bios:338: [string "tueren"]:6: ´end´ expected (to close ´while´ at line 1)
8543 posts
Posted 15 January 2013 - 07:09 AM
Your ifs are incorrect. You have if end elseif end elseif end. You need to remove most of those ends, so you have if elseif elseif end. One end for the entire if, not one for each part of it.
2005 posts
Posted 15 January 2013 - 07:14 AM
That's because you've inserted end's before your elseif's. You don't need them, the structure is "if conditional then codeblock elseif conditional then codeblock else codeblock end".
If you've changed your code, you need to post the most recent version.
5 posts
Posted 15 January 2013 - 07:34 AM
while true do
if rednet.message() == "b1o" then
redstone.setBundledOutput("bottom", colors.orange)
elseif rednet.message() == "b2o" then
redstone.setBundledOutput("bottom", colors.blue)
elseif rednet.message() == "b3o" then
redstone.setBundledOutput("bottom", colors.white)
elseif rednet.message() == "b4o" then
redstone.setBundledOutput("bottom", colors.magenta)
elseif rednet.message() == "bo" then
redstone.setBundledOutput("bottom", colors.orange+colors.blue+colors.white+colors.magenta)
elseif rednet.message() == "bc" then
redstone.setBundledOutput("bottom", 0)
end
Thats the code …
bios:338: [string "tueren"]:14: ´end´ expected (to close ´while´ at line 1)
Thats the error …
2088 posts
Location
South Africa
Posted 15 January 2013 - 07:38 AM
rednet.message()
does not exists, you're looking for
id, msg = rednet.receive()
then in each comparison do:
if msg == "b1o" then
elseif msg == "b2o" then
--etc
end
Also open your modem,
rednet.open("side") -- ie "left"
8543 posts
Posted 15 January 2013 - 07:41 AM
Also, your if is now correct, but you do need a second end at the very end to close the while loop.
5 posts
Posted 15 January 2013 - 08:34 AM
Thank you all!
/close
PostScriptum: Thats the code
while true do
id, msg = rednet.receive()
if msg == "b1o" then
redstone.setBundledOutput("bottom", colors.orange)
elseif msg == "b2o" then
redstone.setBundledOutput("bottom", colors.blue)
elseif msg == "b3o" then
redstone.setBundledOutput("bottom", colors.white)
elseif msg == "b4o" then
redstone.setBundledOutput("bottom", colors.magenta)
elseif msg == "bo" then
redstone.setBundledOutput("bottom", colors.orange+colors.blue+colors.white+colors.magenta)
elseif msg == "bc" then
redstone.setBundledOutput("bottom", 0)
end
end