rednet.open("right")
id, message = rednet.recieve()
while true do
if message = 1 then
rs.setOutput("down", true)
elseif message = 2 then
rs.setOutput("down", false)
end
end
Wireless Modem Fun
Started by applesauce10189, Jan 09 2014 12:20 PM
13 replies to this topic
#1
Posted 09 January 2014 - 12:20 PM
I'm new to coding and I felt like playing around with wireless modems and I think I messed up, I'm wondering what I'm doing wrong it says on line 4 there's a "then" expected but it's already there,
#2
Posted 09 January 2014 - 12:26 PM
Should be:
Same mistake: if you want to check if something matches something, use ==
rednet.open("right")
id, message = rednet.recieve()
while true do
if message == 1 then
rs.setOutput("bottom", true)
elseif message == 2 then
rs.setOutput("bottom", false)
end
end
Same mistake: if you want to check if something matches something, use ==
Edited by wieselkatze, 17 June 2014 - 10:29 PM.
#3
Posted 09 January 2014 - 12:26 PM
Thanks, guess I forgot,
edit, now it says on line 2 attempt to call nil.
another edit, I misspelled receive, fixed it.
edit, now it says on line 2 attempt to call nil.
another edit, I misspelled receive, fixed it.
Edited by applesauce10189, 09 January 2014 - 12:28 PM.
#4
Posted 09 January 2014 - 12:29 PM
This is covered under the Common Errors section of the sticky post titled Read This Post Before Asking Questions. You should try using the resources available to you rather than immediately running off to post a question. We have that sticky for exactly this sort of easy to solve, common error.
#5
Posted 09 January 2014 - 01:16 PM
Also, I'm not sure if "down" is a valid side. Use "bottom".
#7
Posted 09 January 2014 - 02:41 PM
Oh so there's another bug. Yeah, I see. receive will never be a number, since you can't send numbers over rednet, only strings.
#8
Posted 09 January 2014 - 03:20 PM
LBPHacker, on 09 January 2014 - 02:41 PM, said:
Oh so there's another bug. Yeah, I see. receive will never be a number, since you can't send numbers over rednet, only strings.
#9
Posted 09 January 2014 - 03:44 PM
elseif message == 2 then
change the 2 to "2"
change the 2 to "2"
#12
Posted 09 January 2014 - 08:14 PM
id, message = rednet.recieve()It should be
id, message = rednet.receive()
To print the valid sides do this
for _, side in ipairs( rs.getSides() ) do print( side ) end
Edited by Hellkid98, 09 January 2014 - 08:19 PM.
#14
Posted 10 January 2014 - 11:16 AM
True, though for unqualified statements of what one can or cannot do, the current version is the one to base things off of.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











