2 posts
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
212 posts
Location
Dallas, Tx
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
1111 posts
Location
Portland OR
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
8543 posts
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?
2 posts
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?
8543 posts
Posted 11 October 2012 - 06:03 AM
Capitalization matters, so rs.getinput and rs.getInput are two different things. The second one is correct.
5 posts
Location
Ukraine
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
5 posts
Location
Ukraine
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/>/>
1111 posts
Location
Portland OR
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