About ASCII to ScanCode

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

About ASCII to ScanCode

Post by lanslotfrog » Mon Apr 28, 2014 10:21 am

as title,how to convert ascii code to scan code? :cry:

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

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 9:43 am

Re: About ASCII to ScanCode

Post by lanslotfrog » Mon Apr 28, 2014 5:45 pm

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

Who is online

Users browsing this forum: No registered users and 1 guest