while true do
if redstone.getInput("left") then
if redstone.getOutput("right") then
redstone.setOutput("right",false)
else
redstone.setOutput("right",true)
end
end
end
when i run it it works fine but when i press the button to the left of it while the program is on my world just closes and it says Server Closing or something like that.
World closes when i use a t-flip-flop program
Started by AndreWalia, Dec 05 2012 08:19 AM
5 replies to this topic
#1
Posted 05 December 2012 - 08:19 AM
Ok so the code is
#2
Posted 05 December 2012 - 08:27 AM
Your program wouldn't do that. There must be something wrong witht he installation of your mods. Do you have any other mods?
(quick note/improvement)
(quick note/improvement)
while true do
local event, p1 = os.pullEvent()
if event == "redstone" and rs.getInput("left") then
if rs.getOutput("right") then
rs.setOutput("right", false)
else
rs.setOutput("right", true)
end
end
end
#3
Posted 05 December 2012 - 08:36 AM
Never mind i fixed it. it was doing the loop again before the redstone signal stopped. here is what worked.
while true do
if redstone.getInput("left") then
if redstone.getOutput("right") then
redstone.setOutput("right",false)
else
redstone.setOutput("right",true)
end
sleep(4)
end
sleep(0.001)
end
so yeah
#4
Posted 05 December 2012 - 09:33 AM
-snip-
#5
Posted 05 December 2012 - 10:24 AM
Use an os.pullEvent("redstone") so that you only run this when there is actually a change in the redstone inputs. There is no reason to be running this so much faster than the world tick rate, and there is no reason to do anything if there isn't a change in the redstone inputs.
#6
Posted 05 December 2012 - 10:33 AM
ChunLing, on 05 December 2012 - 10:24 AM, said:
Use an os.pullEvent("redstone") so that you only run this when there is actually a change in the redstone inputs. There is no reason to be running this so much faster than the world tick rate, and there is no reason to do anything if there isn't a change in the redstone inputs.
3 user(s) are reading this topic
0 members, 3 guests, 0 anonymous users











