From: Bill Kelly Date: 2004-09-07T03:30:02+09:00 Subject: Re: Problem Having Ruby Wait for a User Input Hi, From: "Phanixis" > > The thing is, I am quite happy with the code I have already devised for > registering keyboard inputs. It works, at least to a degree, registering > single key strokes without a problem. I'm not trying to be a pain - but .... If your current code stops working mysteriously when used inside a loop, it sounds like at least one giant reason not to be entirely quite happy with it. :) In any case, > def key_input #Get arbitrary keyboard input > input = 0 > n = 0 > for i in 1..18 > if Input.trigger?(i) > n = i > end > end > if n > 0 > input = n > end > return input > end The above just sets "input" equal to a number between 1 and 18, right? If you need to make that loop last longer, you could try adding a sleep() . . . I'm only suggesting this because I have no idea what you're trying to do, really. But for example: for i in 1..18 if Input.trigger?(i) n = i break # added end sleep(0.1) # sleep 1/10 sec end How is Input.trigger? itself implemented ? Regards, Bill