Does anyone want to help me make this function better. I would like to get the friendly string name of a DXScanCode. Below is the first thing I thought of. The higher aiKeyCode number gets the longer it takes to process though.
ScriptName GlobalScript Hiddenstring Function GetKeyName(int aiKeyCode) Global If(aiKeyCode == 1) return "Escape" ElseIf(aiKeyCode == 2) return "1" ElseIf(aiKeyCode == 3) return "2" ElseIf(aiKeyCode == 4) return "3" ElseIf(aiKeyCode == 5) return "4" ElseIf(aiKeyCode == 6) return "5" ElseIf(aiKeyCode == 7) return "6" ElseIf(aiKeyCode == 8) return "7" ElseIf(aiKeyCode == 9) return "8" ElseIf(aiKeyCode == 10) return "9" ElseIf(aiKeyCode == 11) return "0" ElseIf(aiKeyCode == 12) return "Minus" ElseIf(aiKeyCode == 13) return "Equals" ElseIf(aiKeyCode == 14) return "Backspace" ElseIf(aiKeyCode == 15) return "Tab" ElseIf(aiKeyCode == 16) return "Q" ElseIf(aiKeyCode == 17) return "W" ElseIf(aiKeyCode == 18) return "E" ElseIf(aiKeyCode == 19) return "R" ElseIf(aiKeyCode == 20) return "T" ElseIf(aiKeyCode == 21) return "Y" ElseIf(aiKeyCode == 22) return "U" ElseIf(aiKeyCode == 23) return "I" ElseIf(aiKeyCode == 24) return "O" ElseIf(aiKeyCode == 25) return "P" ElseIf(aiKeyCode == 26) return "Left Bracket" ElseIf(aiKeyCode == 27) return "Right Bracket" ElseIf(aiKeyCode == 28) return "Enter" ElseIf(aiKeyCode == 29) return "Left Control" ElseIf(aiKeyCode == 30) return "A" ElseIf(aiKeyCode == 31) return "S" ElseIf(aiKeyCode == 32) return "D" ElseIf(aiKeyCode == 33) return "F" ElseIf(aiKeyCode == 34) return "G" ElseIf(aiKeyCode == 35) return "H" ElseIf(aiKeyCode == 36) return "J" ElseIf(aiKeyCode == 37) return "K" ElseIf(aiKeyCode == 38) return "L" ElseIf(aiKeyCode == 39) return "Semicolon" ElseIf(aiKeyCode == 40) return "Apostrophe" ElseIf(aiKeyCode == 41) return "~ (Console)" ElseIf(aiKeyCode == 42) return "Left Shift" ElseIf(aiKeyCode == 43) return "Back Slash" ElseIf(aiKeyCode == 44) return "Z" ElseIf(aiKeyCode == 45) return "X" ElseIf(aiKeyCode == 46) return "C" ElseIf(aiKeyCode == 47) return "V" ElseIf(aiKeyCode == 48) return "B" ElseIf(aiKeyCode == 49) return "N" ElseIf(aiKeyCode == 50) return "M" ElseIf(aiKeyCode == 51) return "Comma" ElseIf(aiKeyCode == 52) return "Period" ElseIf(aiKeyCode == 53) return "Forward Slash " ElseIf(aiKeyCode == 54) return "Right Shift" ElseIf(aiKeyCode == 55) return "NUM*" ElseIf(aiKeyCode == 56) return "Left Alt" ElseIf(aiKeyCode == 57) return "Spacebar" ElseIf(aiKeyCode == 58) return "Caps Lock" ElseIf(aiKeyCode == 59) return "F1" ElseIf(aiKeyCode == 60) return "F2" ElseIf(aiKeyCode == 61) return "F3" ElseIf(aiKeyCode == 62) return "F4" ElseIf(aiKeyCode == 63) return "F5" ElseIf(aiKeyCode == 64) return "F6" ElseIf(aiKeyCode == 65) return "F7" ElseIf(aiKeyCode == 66) return "F8" ElseIf(aiKeyCode == 67) return "F9" ElseIf(aiKeyCode == 68) return "F10" ElseIf(aiKeyCode == 69) return "Num Lock" ElseIf(aiKeyCode == 70) return "Scroll Lock" ElseIf(aiKeyCode == 71) return "NUM7" ElseIf(aiKeyCode == 72) return "NUM8" ElseIf(aiKeyCode == 73) return "NUM9" ElseIf(aiKeyCode == 74) return "NUM Minus" ElseIf(aiKeyCode == 75) return "NUM4" ElseIf(aiKeyCode == 76) return "NUM5" ElseIf(aiKeyCode == 77) return "NUM6" ElseIf(aiKeyCode == 78) return "NUM Plus" ElseIf(aiKeyCode == 79) return "NUM1" ElseIf(aiKeyCode == 80) return "NUM2" ElseIf(aiKeyCode == 81) return "NUM3" ElseIf(aiKeyCode == 82) return "NUM0" ElseIf(aiKeyCode == 83) return "NUM Period" ; skipped ElseIf(aiKeyCode == 87) return "F11" ElseIf(aiKeyCode == 88) return "F12" ; skipped ElseIf(aiKeyCode == 156) return "NUM Enter" ElseIf(aiKeyCode == 157) return "Right Control" ; skipped ElseIf(aiKeyCode == 181) return "NUM Forward Slash" ; skipped ElseIf(aiKeyCode == 184) return "Right Alt" ; skipped ElseIf(aiKeyCode == 197) return "Pause" ; skipped ElseIf(aiKeyCode == 199) return "Home" ElseIf(aiKeyCode == 200) return "Up Arrow" ElseIf(aiKeyCode == 201) return "Page Up" ; skipped ElseIf(aiKeyCode == 203) return "Left Arrow" ElseIf(aiKeyCode == 205) return "Right Arrow" ; skipped ElseIf(aiKeyCode == 207) return "End" ElseIf(aiKeyCode == 208) return "Down Arrow" ElseIf(aiKeyCode == 209) return "Page Down" ElseIf(aiKeyCode == 210) return "Insert" ElseIf(aiKeyCode == 211) return "Delete" ; skipped ElseIf(aiKeyCode == 256) return "Left Mouse Button" ElseIf(aiKeyCode == 257) return "Right Mouse Button" ElseIf(aiKeyCode == 258) return "Middle/Wheel Mouse Button" ElseIf(aiKeyCode == 259) return "Mouse Button 3" ElseIf(aiKeyCode == 260) return "Mouse Button 4" ElseIf(aiKeyCode == 261) return "Mouse Button 5" ElseIf(aiKeyCode == 262) return "Mouse Button 6" ElseIf(aiKeyCode == 263) return "Mouse Button 7" ElseIf(aiKeyCode == 264) return "Mouse Wheel Up" ElseIf(aiKeyCode == 265) return "Mouse Wheel Down" ElseIf(aiKeyCode == 266) return "Pad Up" ElseIf(aiKeyCode == 267) return "Pad Down" ElseIf(aiKeyCode == 268) return "Pad Left" ElseIf(aiKeyCode == 269) return "Pad Right" ElseIf(aiKeyCode == 270) return "Start" ElseIf(aiKeyCode == 271) return "Back" ElseIf(aiKeyCode == 272) return "Left Thumb" ElseIf(aiKeyCode == 273) return "Right Thumb" ElseIf(aiKeyCode == 274) return "Left Shoulder" ElseIf(aiKeyCode == 275) return "Right Shoulder" ElseIf(aiKeyCode == 276) return "A" ElseIf(aiKeyCode == 277) return "B" ElseIf(aiKeyCode == 279) return "X" ElseIf(aiKeyCode == 279) return "Y" ElseIf(aiKeyCode == 280) return "Left Trigger" ElseIf(aiKeyCode == 281) return "Right Trigger" EndIf return ""EndFunction