Get out Keyboard.LastKeyCode the letter

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello,

    i�m trying to make a small textbox (No I cant use the given one) so I need to get the Users last pressed Letter. Its no problem to get the Keycode. Any Ideas how I could get out of the KeyCode the letter ?

    To explain it a bit better and because of my english sucks:

    I dont want the LasKeyCode("65") I want the letter "A".

  • Other than using a plugin, you could simply build a list in an array

    on start of layout
       local text letters = "abcdefghijklmnopqresuvwxyz"
       set codeToChar size to (256,1,1)
       repeat 26 times:
          //letters
          set codeToChar.At(65+loopindex) = tokenat(upperCase,loopindex,"")
       repeat 10 times:
          //numbers
          set codeToChar.At(48+loopindex) = loopindex
          //numpad
          set codeToChar.At(96+loopindex) = "numpad "&loopindex

          //F1 to F12

       repeat 12 times:

          set codeToChar.At(112+loopindex) = "F"&(loopindex+1)

    so you can do

    codeToChar.At(keyboard.LastKeyCode)

    to get the key

    You'll have to fill the other possible key more... manually though (:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So much work :D

    I already tought about something like that, but really big thanks it will save me much time.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)