This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
omegatopia's profile picture

help on simple thing

Started by omegatopia, 11 July 2012 - 07:26 PM
omegatopia #1
Posted 11 July 2012 - 09:26 PM
so I'm new to this and I'm trying to learn it so i wanted to make a simple program that just changes output depending on the input it receives and this is the code i made


if rs.getInput(right,true) then
rs.setOutput(left,true)
else
rs.setOutput(back,true)
end
so my problem is every time i run it i get an error and I've tried to fix it but i can't
MysticT #2
Posted 11 July 2012 - 09:39 PM
The side argument (left, right, etc.) must be a string, so you have to put quotes around them. Also, rs.getInput has just one parameter, the true does nothing there.
So the fixed code is:

if rs.getInput("right") then
  rs.setOutput("left", true)
else
  rs.setOutput("back", true)
end
omegatopia #3
Posted 11 July 2012 - 09:43 PM
well that was stupidly simple thank you for your help