Custom Controls Extension

Bombini

  • *
  • Posts: 1097
Very cool thanks!
For all who want to see how it looks:

Bombini

  • *
  • Posts: 1097
One last question in the puzzle:

How do i draw the Name of the currently associated Key of a control (without pressing a key)?
I know how to display the name when a key was pressed/changed but i need to get also the name when creating a scene or in the always block. Something like (get name of control).
Example:
  • I define default controls (works)
  • Player changes controls using the method from former posts and the key name change is displayed (works)
  • Game is reloaded and the changed key name  displays  without pressing a key (how=?)
I tried this but this is just giving out the general name of the key. Not the associated control:


captaincomic

  • *
  • Posts: 6109
You can use
Code: [Select]
Input.getControlMap().get("control-name")
to get the list of key codes of the keys assigned to the control.

Or
Code: [Select]
Input.getControlMap().get("control-name")[0]
to just get the key code of the first key assigned to it.

I'm sorry, but I cannot think of an easy way to get the name of the key from the key code, off the top of my head, besides writing a map off all key codes and key names ...

Bombini

  • *
  • Posts: 1097
Thanks a lot!
This is how i did it saving the words into a list):



methodandred

  • Posts: 3
Does this still work in 3.4?

Bombini

  • *
  • Posts: 1097