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

coding errors help?

Started by Xenilis, 11 October 2012 - 03:21 AM
Xenilis #1
Posted 11 October 2012 - 05:21 AM
this is my code and no matter how many times i tinker with it, it still returns errors help?
this is my code:


while rs.getinput(left, true) do
rs.setOutput(right, true)
sleep(2)
else
print("you dun fucked up!")
break
end
Cozzimoto #2
Posted 11 October 2012 - 05:29 AM
rs.getInput(left, true)
should be
rs.getInput("left")

always concat strings with quotation marks "this is a string" and rs.getInput only receives the input of redstone, it doesnt need a true variable at all so just put the side you need to get the input from
Luanub #3
Posted 11 October 2012 - 05:29 AM
The sides for rs are strings, wrap them in quotes

rs.setOutput("right",true)

EDIT: Ninja'd :P/>/>
Edited on 11 October 2012 - 03:30 AM
Lyqyd #4
Posted 11 October 2012 - 05:43 AM
Also, you don't have an if, so that else won't do anything but throw errors. What are you trying to accomplish with this code?
Xenilis #5
Posted 11 October 2012 - 05:59 AM
while rs.getinput("left", true) do
rs.setOutput("right",true)
sleep(2)
end
modified it and giving me a attempt to call nill error help?
Lyqyd #6
Posted 11 October 2012 - 06:03 AM
Capitalization matters, so rs.getinput and rs.getInput are two different things. The second one is correct.
Hacha #7
Posted 11 October 2012 - 06:20 AM
Firstly, the party must be in " "
In this situation, use if … then … else … end
Try this program :P/>/>



if rs.getInput("left", true)
   then
	   rs.setOutput("right", true)
	   sleep(2)
   else
	   print("you dun fucked up!")
end
Hacha #8
Posted 11 October 2012 - 06:23 AM
it very easy program, and you must use if,
cycles use in heavier programs
and rs.getInput("left", true), can be without true, if you want that the signal was always, true - on signal, false - off signal ;)/>/>
Good luck in further work with programs :P/>/>
Luanub #9
Posted 11 October 2012 - 06:30 AM
And to finish it up simply add a while loop and eventPull..

while true do
local e,p1 = os.pullEvent("redstone")
if rs.getInput("left") then
  rs.setOutput("right", true)
  sleep(2)
  rs.setOutput("right", false) -- assuming you will want this to turn it off??
else
  print("you dun fucked up!")
end
end
Edited on 11 October 2012 - 04:31 AM