Page 1 of 1

About ASCII to ScanCode

Posted: Mon Apr 28, 2014 10:21 am
by lanslotfrog
as title,how to convert ascii code to scan code? :cry:

Re: About ASCII to ScanCode

Posted: Mon Apr 28, 2014 11:06 am
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

Re: About ASCII to ScanCode

Posted: Mon Apr 28, 2014 5:45 pm
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