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
0
coding errors help?
Started by Xenilis, Oct 11 2012 04:21 AM
8 replies to this topic
#1
Posted 11 October 2012 - 04:21 AM
#2
Posted 11 October 2012 - 04: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
#3
Posted 11 October 2012 - 04:29 AM
The sides for rs are strings, wrap them in quotes
EDIT: Ninja'd />
rs.setOutput("right",true)
EDIT: Ninja'd />
Edited by luanub, 11 October 2012 - 04:30 AM.
#4
Posted 11 October 2012 - 04: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?
#5
Posted 11 October 2012 - 04: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?
rs.setOutput("right",true)
sleep(2)
end
modified it and giving me a attempt to call nill error help?
#6
Posted 11 October 2012 - 05:03 AM
Capitalization matters, so rs.getinput and rs.getInput are two different things. The second one is correct.
#7
Posted 11 October 2012 - 05:20 AM
Firstly, the party must be in " "
In this situation, use if ... then ... else ... end
Try this program />
In this situation, use if ... then ... else ... end
Try this program />
if rs.getInput("left", true) then rs.setOutput("right", true) sleep(2) else print("you dun fucked up!") end
#8
Posted 11 October 2012 - 05: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 />
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 />
#9
Posted 11 October 2012 - 05: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 by luanub, 11 October 2012 - 05:31 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users