I'm trying the same, but for some reason InputEventKey.keycode always return 0
Code:
var action_events = InputMap.action_get_events("Interact")[0]
var KeyCode = action_events.keycode
var KeyString = OS.get_keycode_string(KeyCode)
print(str(action_events))
print("Keycode: " + str(KeyCode))
print("String: " + KeyString)
Output:
InputEventKey: keycode=70 (F), mods=none, physical=true, pressed=false, echo=false
Keycode: 0
String:
Edit: for those who had the same problem, you had to use a equivalent, if key or physical key
in my case i'ts physical, so I had to use InputEventKey.physical_keycode, InputEventKey.keycode in this case will return 0