Jump to content




Only Works Once


3 replies to this topic

#1 applesauce10189

  • Members
  • 162 posts

Posted 27 January 2015 - 10:40 AM

So, haven't played with Computercraft in a long time and decided to again, ran into a small problem,

term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.purple)
print("AppleOS v0")
rednet.open("top")
while true do
  local id, msg = rednet.receive()
  if msg == "rain" then
	rs.setOutput("back", true)
	sleep(1)
	rs.setOutput("back", false)
  end
end

That only works once every time the program is ran, I know a solution to this would be to just make the program then run itself, but that'd be a lazy workaround and I wanna know what I messed up on to avoid making this mistake in the future.

EDIT: Ignore this entire thing. Found my problem.

Edited by applesauce10189, 27 January 2015 - 12:17 PM.


#2 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 27 January 2015 - 03:43 PM

Why don't you post your solution, too? So when other people run into the same error they can see your solution ;)

I would guess that opening an already open modem raised an error, but to be sure please tell us your fix ;)

#3 applesauce10189

  • Members
  • 162 posts

Posted 27 January 2015 - 04:43 PM

2 things:

1. That's actually startup on the computer it's meant for, and the computer only turns on upon loading the world, and on loading, the modem well be closed :P

2. The problem wasn't so much my program, but my method of testing it, the program works if you're smart enough to know how to properly broadcast something on rednet xD

#4 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 27 January 2015 - 04:51 PM

:D ok





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users