This shows you the differences between two versions of the page.
el:key [2016/01/01 22:39] |
el:key [2020/02/28 10:46] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Key ===== | ||
+ | ==== Format ==== | ||
+ | key\\ | ||
+ | key() | ||
+ | ==== Description ==== | ||
+ | Immediately returns an integer value corresponding to the currently pressed keyboard key. If no key has been pressed since the last call to the **key** function then the number zero (0) will be returned. | ||
+ | |||
+ | ==== Note ==== | ||
+ | < | ||
+ | if key = 47 then print key | ||
+ | </ | ||
+ | will not display the desired results, because it's calling key twice in succession, and will return different values each time. This code will do what you want: | ||
+ | < | ||
+ | a = key | ||
+ | if a = 47 then print a | ||
+ | </ | ||
+ | ==== Partial List of Keys ==== | ||
+ | |||
+ | |ESC=16777216|Space=32||||||| | ||
+ | |0=48|1=49|2=50|3=51|4=52|5=53|6=54|7=55| | ||
+ | |8=56|9=57||||||| | ||
+ | |A=65|B=66|C=67|D=68|E=69|F=70|G=71|H=72| | ||
+ | |I=73|J=74|K=75|L=76|M=77|N=78|O=79|P=80| | ||
+ | |Q=81|R=82|S=83|T=84|U=85|V=86|W=87|X=88| | ||
+ | |Y=89|Z=90||||||| | ||
+ | |Down Arrow=16777237|Up Arrow=16777235|Left Arrow=16777234|Right Arrow=16777236|||| | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ==== Example==== | ||
+ | < | ||
+ | #press any keys | ||
+ | loop: | ||
+ | pause 1 | ||
+ | a = key | ||
+ | print a+" | ||
+ | goto loop | ||
+ | </ |