Keyboard Key Codes

local _key = {nil}
_key["ability_primary"] = "LEFT_MOUSE"
_key["ability_secondary"] = "RIGHT_MOUSE"
_key["ability_feet"] = "SHIFT"
_key["ability_extra_0"] = "0"
_key["ability_extra_1"] = "1"
_key["ability_extra_2"] = "2"
_key["ability_extra_3"] = "3"
_key["ability_extra_4"] = "4"
_key["ability_extra_5"] = "5"
_key["ability_extra_6"] = "6"
_key["ability_extra_7"] = "7"
_key["ability_extra_8"] = "8"
_key["ability_extra_9"] = "9"

_key["ability_1"] = "Q" -- being used twice
_key["ability_2"] = "E" -- being used twice
_key["ability_ult"] = "R" -- being used twice

_key["ability_extra_10"] = "CTRL L"
_key["ability_extra_11"] = "CTRL R"
_key["ability_extra_12"] = "SHIFT L"
_key["ability_extra_13"] = "SHIFT R"
_key["ability_extra_14"] = "ALT L"
_key["ability_extra_15"] = "ALT R"
_key["ability_extra_16"] = "ENTER"
_key["ability_extra_17"] = "SPACE"
_key["ability_extra_18"] = "CAPS LOCK"
_key["ability_extra_19"] = "TAB"

_key["ability_extra_20"] = "Q" -- being used twice
_key["ability_extra_21"] = "W"
_key["ability_extra_22"] = "E" -- being used twice
_key["ability_extra_23"] = "R" -- being used twice
_key["ability_extra_24"] = "T"

_key["ability_extra_25"] = "Y"
_key["ability_extra_26"] = "U"
_key["ability_extra_27"] = "I"
_key["ability_extra_28"] = "O"
_key["ability_extra_29"] = "P"
_key["ability_extra_30"] = "A"
_key["ability_extra_31"] = "S"
_key["ability_extra_32"] = "D"
_key["ability_extra_33"] = "F"
_key["ability_extra_34"] = "G"
_key["ability_extra_35"] = "H"
_key["ability_extra_36"] = "J"
_key["ability_extra_37"] = "K"
_key["ability_extra_38"] = "L"
_key["ability_extra_39"] = "Z"


_key["ability_extra_40"] = "X"
_key["ability_extra_41"] = "C"
_key["ability_extra_42"] = "V"
_key["ability_extra_43"] = "B" -- locked-up by Core emote menu popup
_key["ability_extra_44"] = "N"
_key["ability_extra_45"] = "M"


_key["ability_extra_46"] = "UP"
_key["ability_extra_47"] = "DOWN"
_key["ability_extra_48"] = "LEFT"
_key["ability_extra_49"] = "RIGHT"
_key["ability_extra_50"] = "F1"
_key["ability_extra_51"] = "F2"
_key["ability_extra_52"] = "F3"
_key["ability_extra_53"] = "F4"
_key["ability_extra_54"] = "F5"
_key["ability_extra_55"] = "F6"
_key["ability_extra_56"] = "F7"
_key["ability_extra_57"] = "F8"
_key["ability_extra_58"] = "F9"
_key["ability_extra_59"] = "F10"
_key["ability_extra_60"] = "F11"
_key["ability_extra_61"] = "F12"
_key["ability_extra_62"] = "INSERT"
_key["ability_extra_63"] = "HOME"
_key["ability_extra_64"] = "PAGE UP"
_key["ability_extra_65"] = "PAGE DN"
_key["ability_extra_66"] = "DELETE"
_key["ability_extra_67"] = "END"


function OnBindingPressed(player, binding)
    print( "Pressed: ",_key[binding] )
end

function OnPlayerJoined(player)
    -- hook up binding in player joined event here
    player.bindingPressedEvent:Connect(OnBindingPressed)
    player.bindingReleasedEvent:Connect(OnBindingReleased)
end

-- on player joined/left functions need to be defined before calling event:Connect()
Game.playerJoinedEvent:Connect(OnPlayerJoined)

Latest Posts