January 19, 2021, 04:43:02 AM

### Author Topic: [bb] ScanCode to ASCII by MusicianKool [ 1+ years ago ]  (Read 448 times)

#### BlitzBot

• Jr. Member
• Posts: 1
##### [bb] ScanCode to ASCII by MusicianKool [ 1+ years ago ]
« on: June 29, 2017, 12:28:41 AM »
Title : ScanCode to ASCII
Author : MusicianKool
Posted : 1+ years ago

Description : Basically the keydown() version of getkey().

Code :
Code: BlitzBasic
1. Dim ScanCode_Array(237,2)
2. Restore ScanCodesToAscii_Data
3. While Indx <> 999
5.         If indx <> 999 Then
8.                 ScanCode_Array(scn,Indx)=ascii
9.         EndIf
10. Wend
11.
12. While Not KeyHit(1)
13.         a = ScanCode_To_Ascii()
14.         If a <> 0 Then Print a + "    " + Chr(a)
15. Wend
16.
17.
18. Function ScanCode_To_Ascii()
19.         For ScanCodeCycle = 1 To 237
20.                 If KeyDown(ScanCodeCycle)=True  Then
21.                         If ScancodeCycle <> 42 And scancodecycle <> 54 Then scancode = ScanCodeCycle
22.                 EndIf
23.         Next
24.         If KeyDown(42) = True Or KeyDown(54) = True Then
25.                 ShiftDown = 2
26.         Else
27.                 ShiftDown = 1
28.         EndIf
29.         If shiftdown = 2 Then
30.                 If scancode =  42  Or scancode = 54 Then Return
31.         EndIf
32.         Return ScanCode_Array(scancode,ShiftDown)
33. End Function
34.
35. .ScanCodesToAscii_Data
36. Data 1,27,1
37. Data 1,96,41
38. Data 1,49,2
39. Data 1,50,3
40. Data 1,51,4
41. Data 1,52,5
42. Data 1,53,6
43. Data 1,54,7
44. Data 1,55,8
45. Data 1,56,9
46. Data 1,57,10
47. Data 1,48,11
48. Data 1,45,12
49. Data 1,61,13
50. Data 1,8,14
51. Data 1,3,210
52. Data 1,1,199
53. Data 1,5,201
54. Data 1,6,209
55. Data 1,2,207
56. Data 1,4,211
57. Data 1,9,15
58. Data 1,113,16
59. Data 1,119,17
60. Data 1,101,18
61. Data 1,114,19
62. Data 1,116,20
63. Data 1,121,21
64. Data 1,117,22
65. Data 1,105,23
66. Data 1,111,24
67. Data 1,112,25
68. Data 1,91,26
69. Data 1,93,27
70. Data 1,92,43
71. Data 1,97,30
72. Data 1,115,31
73. Data 1,100,32
74. Data 1,102,33
75. Data 1,103,34
76. Data 1,104,35
77. Data 1,106,36
78. Data 1,107,37
79. Data 1,108,38
80. Data 1,59,39
81. Data 1,39,40
82. Data 1,13,28
83. Data 1,122,44
84. Data 1,120,45
85. Data 1,99,46
86. Data 1,118,47
87. Data 1,98,48
88. Data 1,110,49
89. Data 1,109,50
90. Data 1,44,51
91. Data 1,46,52
92. Data 1,47,53
93. Data 1,32,57
94. Data 1,31,203
95. Data 1,29,208
96. Data 1,30,205
97. Data 1,28,200
98. Data 2,126,41
99. Data 2,33,2
100. Data 2,64,3
101. Data 2,35,4
102. Data 2,36,5
103. Data 2,37,6
104. Data 2,94,7
105. Data 2,38,8
106. Data 2,42,9
107. Data 2,40,10
108. Data 2,41,11
109. Data 2,95,12
110. Data 2,43,13
111. Data 2,81,16
112. Data 2,87,17
113. Data 2,69,18
114. Data 2,82,19
115. Data 2,84,20
116. Data 2,89,21
117. Data 2,85,22
118. Data 2,73,23
119. Data 2,79,24
120. Data 2,80,25
121. Data 2,123,26
122. Data 2,125,27
123. Data 2,124,43
124. Data 2,9,15
125. Data 2,65,30
126. Data 2,83,31
127. Data 2,68,32
128. Data 2,70,33
129. Data 2,71,34
130. Data 2,72,35
131. Data 2,74,36
132. Data 2,75,37
133. Data 2,76,38
134. Data 2,58,39
135. Data 2,34,40
136. Data 2,90,44
137. Data 2,88,45
138. Data 2,67,46
139. Data 2,86,47
140. Data 2,66,48
141. Data 2,78,49
142. Data 2,77,50
143. Data 2,60,51
144. Data 2,62,52
145. Data 2,63,53
146. Data 999