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

Trying to loop a program

Started by MarioBrosFTW, 04 September 2015 - 01:26 AM
MarioBrosFTW #1
Posted 04 September 2015 - 03:26 AM
Need some help trying to loop my coffee automation program to make milk coffee everytime it recieves a rednet signal

http://pastebin.com/8H3Mfef6
Bomb Bloke #2
Posted 04 September 2015 - 06:32 AM
You have a run() function that opens a rednet side, but you never call it. Your check for the "dark" message also seems randomly placed…

Try it like this:

rednet.open("back")

while true do
	local id,message = rednet.receive()
	
	if id == 34 and message == "milk" then
		redstone.setOutput("right", true)
		sleep(5)
		redstone.setOutput("right", false)
	elseif message == "dark" then
		rednet.broadcast("I'm milk coffee not dark")
	end
end