Author |
Message |
JSBN
![](http://genesis.thruhere.net/site/templates/fisubsilversh/images/news/avatarS.gif)
|
Posted: Fri Jun 20, 2003 3:11 pm Post subject: Input.KeyDown |
|
|
For Input.KeyDown, how do i detect an uppercase letter (ie. A)
i know to detect shift it is (KEY_SHIFT) and for a it is ('a').
Itried puting the 2 togeather, that d'dn't work, and i tried ('A'), but that didn't work either.
:/ |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Fri Jun 20, 2003 9:35 pm Post subject: (No subject) |
|
|
you check for both at same time.
if chars(Key_SHIFT) and chars('a') then
... |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
JSBN
![](http://genesis.thruhere.net/site/templates/fisubsilversh/images/news/avatarS.gif)
|
Posted: Sat Jun 21, 2003 12:05 am Post subject: (No subject) |
|
|
i already tried that :/ |
|
|
|
|
![](images/spacer.gif) |
Blade
|
Posted: Sat Jun 21, 2003 9:16 am Post subject: (No subject) |
|
|
tony is right.... if you go to the help file, then...
Quote: The array returned is a list of all the characters. A key is currently pressed if the array element with the corresponding character is true. For example, the a key is pressed is chars ('a') is true. Note that each key is individually represented, so if the user has pressed Shift+a to get a 'A', then Input.KeyDown would register Shift and 'a' as pressed, but not 'A'.
and this works for me
code: | var chars : array char of boolean
loop
Input.KeyDown (chars)
if chars ('a') & chars (KEY_SHIFT) then
put "hi"
else
put "bye"
end if
locate (1, 1)
end loop |
|
|
|
|
|
![](images/spacer.gif) |
JSBN
![](http://genesis.thruhere.net/site/templates/fisubsilversh/images/news/avatarS.gif)
|
Posted: Sun Jun 22, 2003 12:43 pm Post subject: (No subject) |
|
|
ok, i figured out my problem, i had it set up wrong.
i had:
code: | if chars ('a') then
...
elsif chars ('a') and chars (KEY_SHIFT) then
... |
what u need is :
code: | if chars ('a') and chars (KEY_SHIFT) then
...
elsif chars ('a') then
... |
THe upper case letter MUST go b4 the lowercase letter
THx for your help, and esspecially to blade for makingme relize this. |
|
|
|
|
![](images/spacer.gif) |
JSBN
![](http://genesis.thruhere.net/site/templates/fisubsilversh/images/news/avatarS.gif)
|
Posted: Mon Jun 23, 2003 6:23 pm Post subject: (No subject) |
|
|
another question, I was wondering what Caps lock was. |
|
|
|
|
![](images/spacer.gif) |
Homer_simpson
![](http://compsci.ca/v3/uploads/user_avatars/18138546704b4d2a3b2e50e.gif)
|
Posted: Mon Jun 23, 2003 6:28 pm Post subject: (No subject) |
|
|
i dont think that input keydown supports capslock =/ |
|
|
|
|
![](images/spacer.gif) |
Asok
![](http://www.battle.net/war3/images/neutral/units/animations/pandarenbrewmaster.gif)
|
Posted: Mon Jun 23, 2003 6:40 pm Post subject: (No subject) |
|
|
if ANYONE knows how to detect caps lock via Input.Keydown they'll get 25 bits. (must provide source code) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Homer_simpson
![](http://compsci.ca/v3/uploads/user_avatars/18138546704b4d2a3b2e50e.gif)
|
Posted: Mon Jun 23, 2003 8:08 pm Post subject: (No subject) |
|
|
lol if anyone finds out how to do that using turing... he'll get 100 bits...(knowing that it's impossible...) |
|
|
|
|
![](images/spacer.gif) |
Andy
|
Posted: Mon Jun 23, 2003 8:23 pm Post subject: (No subject) |
|
|
ya it is impossible... can you even detect if shift is pressed? |
|
|
|
|
![](images/spacer.gif) |
Catalyst
![](http://catalyze.mine.nu/jack_of_spades+100.jpg)
|
Posted: Mon Jun 23, 2003 8:26 pm Post subject: (No subject) |
|
|
u people...
code: | var chars : array char of boolean
var key : string (1) := "!"
fcn capTest (k : string (1)) : boolean
if ord (k) >= 65 and ord (k) <= 90 then
result true
else
result false
end if
end capTest
loop
getch (key)
Input.KeyDown (chars)
if chars (KEY_SHIFT) = false and capTest (key) then
put "Caps Lock is on"
elsif chars (KEY_SHIFT) = true and capTest (key)=false then
put "Caps Lock is on"
else
put "Caps Lock is off"
end if
end loop |
|
|
|
|
|
![](images/spacer.gif) |
Andy
|
Posted: Mon Jun 23, 2003 8:30 pm Post subject: (No subject) |
|
|
catalyst that only checks for letters and we want to know if caplocks is pressed without inputing data. |
|
|
|
|
![](images/spacer.gif) |
JSBN
![](http://genesis.thruhere.net/site/templates/fisubsilversh/images/news/avatarS.gif)
|
Posted: Mon Jun 23, 2003 8:32 pm Post subject: (No subject) |
|
|
can u get so that there is no getch? |
|
|
|
|
![](images/spacer.gif) |
Catalyst
![](http://catalyze.mine.nu/jack_of_spades+100.jpg)
|
Posted: Mon Jun 23, 2003 8:34 pm Post subject: (No subject) |
|
|
i dont think i can do i withour getch since the only reason it works is that getch() picks up on the caps lock |
|
|
|
|
![](images/spacer.gif) |
Asok
![](http://www.battle.net/war3/images/neutral/units/animations/pandarenbrewmaster.gif)
|
Posted: Mon Jun 23, 2003 11:49 pm Post subject: (No subject) |
|
|
JSBN, that should work with what we're doing anyways because var key wont be drawn it just holds the status of caps lock. |
|
|
|
|
![](images/spacer.gif) |
|