Keycode discrepancy

Blitz3D Forums/Blitz3D Programming/Keycode discrepancy

Warren(Posted 2004) [#1]
The scancode chart/picker in Blitz3D claims that the backspace key is 14 ... however, in practice, my keyboard reports a value of 8. This worries me.

Is there some way to account for these differences?

Try this code on your machine...

While Not key
	key = GetKey()
Wend

Text 0,0,key
WaitKey


If I run this and hit backspace, it will report 8. Hold me.


Ruz(Posted 2004) [#2]
well none of them seem to work wiht that code. key 'm' should be 50 but it reports 109.


N(Posted 2004) [#3]
8 for me. In any case, the return value of GetKey is an ASCII code, not a scan code.

14 is indeed the Backspace key for my keyboard.

Try this code:
Time = MilliSecs()
While Not KeyHit(1)
	Time = Time + 8
	Repeat
	Until MilliSecs() > Time
	Text 2,2,"KeyDown(14) returned "+KeyDown(14)
	Flip
	Cls
Wend



Floyd(Posted 2004) [#4]
You will also encounter real differences in scancodes.
They are based on the physical layout of the keys.

The values listed in the Blitz docs are for US/UK keyboards.


Warren(Posted 2004) [#5]
In any case, the return value of GetKey is an ASCII code, not a scan code.

True. I'm a dumb ass.

Stop holding me now, it's getting weird.


jhocking(Posted 2004) [#6]
Peh. That's nothing. I once spent an hour wondering why a variable wasn't coming up as 5. The code was x=7-1. I swear to God.


slenkar(Posted 2004) [#7]
I once put

if t=s\target_handle
s\ship_handle=t
endif

and wondered why my ship behaved oddly.