About ASCII to ScanCode

Post your coding questions such as 'how to' here.
Post Reply
lanslotfrog
Newcomer
Posts: 11
Joined: Wed Mar 12, 2014 8:43 am

About ASCII to ScanCode

Post by lanslotfrog »

as title,how to convert ascii code to scan code? :cry:
koodaaja
Moderator
Moderator
Posts: 1583
Joined: Mon Aug 27, 2007 11:24 pm
Location: Otaniemi - Mikkeli -pendelöinti

Re: About ASCII to ScanCode

Post by koodaaja »

Unfortunately there is no built-in method to do this (which is actually pretty weird), if you need customizable keys just store the scan codes directly. If you want to query the keys from the player, you can do something like this:

Code: Select all

Repeat
    a = GetKey()
    For i = 0 To 255
        If KeyDown(i) Then
            scan = i
        EndIf
    Next i
    DrawScreen
Until a<>0

Print ""+a+" "+ Chr(a)+" " + Str(scan)
WaitKey
lanslotfrog
Newcomer
Posts: 11
Joined: Wed Mar 12, 2014 8:43 am

Re: About ASCII to ScanCode

Post by lanslotfrog »

koodaaja wrote:Unfortunately there is no built-in method to do this (which is actually pretty weird), if you need customizable keys just store the scan codes directly. If you want to query the keys from the player, you can do something like this:

Code: Select all

Repeat
    a = GetKey()
    For i = 0 To 255
        If KeyDown(i) Then
            scan = i
        EndIf
    Next i
    DrawScreen
Until a<>0

Print ""+a+" "+ Chr(a)+" " + Str(scan)
WaitKey
nice idea! :D
Post Reply