Q: get key stroke in the console
[1/5] from: tomc:darkwing:uoregon at: 30-Jan-2003 12:49
hi All, I would like to detect key presses in the console I poked around system/console and system/ports/input but did not find a way to tell which key "is being presses" or which key "was just released" can this be done? or what is as close as I can get?
[2/5] from: greggirwin:mindspring at: 30-Jan-2003 15:12
Hi Tom, TC> I would like to detect key presses in the console Have you tried something like this? c: open/no-wait [scheme: 'console] forever [ wait [c] print copy c ] or is that not what you're after. -- Gregg
[3/5] from: tomc::darkwing::uoregon::edu at: 30-Jan-2003 23:24
Hi Greg it is a good step in the right direction but I will still need to figure out how to make the key press not block untill a return is entered I want the script to carry on after each key as it it had been followed with a return this snip is sort of what I am trying for bit there should not be the lowercase letters con: open/no-wait [scheme: 'console] alpha: "abcdef" forever [ d: first random alpha while [ c <> d][ c: pick copy con 1 if c [ prin #"^H" if c = d [ print [tab uppercase to-string c] ] insert con "^/" ; this is not working as hoped ] wait .25 ] ] and thanks for pointing out the console as a port I had no clue On Thu, 30 Jan 2003, Gregg Irwin wrote:
[4/5] from: gscottjones:mchsi at: 30-Jan-2003 5:31
From: "Tom Conlin"
> Hi Greg > it is a good step in the right direction
<<quoted lines omitted: 3>>> I want the script to carry on after each key as it it > had been followed with a return
Hi, Tom, Variation on the theme: c: open/binary/no-wait [scheme: 'console] ;set following to whatever you wish ;intentionally slow at 2 secs so you can "see" the effect wait-duration: :0:2 d: 0 forever [ if not none? wait/all [c wait-duration] [ print to-char to-integer copy c ] d: d + 1 ;let's do other stuff print d ] You can later change the duration to much faster, like :0:0.1 or smaller. HTH. --Scott Jones
[5/5] from: tomc:darkwing:uoregon at: 31-Jan-2003 9:55
that did it thanks Scott On Thu, 30 Jan 2003, G. Scott Jones wrote:
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted