findkeysforcommand questions
Posted: Tue Mar 06, 2018 4:47 pm
hey forum i have a question for you about findkeysforcommand. I don't understand how this works. in the defs of dp you can read:
I suppose string command refers to commands that the engine uses, such as "+attack","impulse 2" or any other command.
What I don't understand is what bindmap means.
I have a couple of questions, since I'm trying to program a "custom controls menu" in a menu.dat. For example, I would like to know which key corresponds to "+attack", whats the easiest way for code to know (in string form) which key I am using for that command?
i did try with findkeysforcommand function, with for example +forward command (and using a 0 for bindmap float), but instead a "understable" (for me) string, i did get a various numbers separated for spaces. something like '119' '-1' '-1' '-1'
What this mean? I did search in keycodes.qc (darkplaces) but i didnt find any key for "119", i guess the -1 means "empty" and each command can be seted with 4 keys. BU i am not sure.
if I'm right 119 is refered to "w" but, where i can find that information? its possible to convert that "119" float in the string "w", even using different keyboards ?
Aniway; Once I know what the "+attack" key is. I wish I could change that command, this would be done with a cmd under circumstances declared in m_keyup. I can write exceptions for each different button there.
for example:
"bind a +attack"
but in m_keyup i have
So i have a float, instead a string , so must i use "keynumtostring(key)"?
what means the ascii part?
Thanks for your help
Code: Select all
string(string command, float bindmap) findkeysforcommand = #610;
What I don't understand is what bindmap means.
I have a couple of questions, since I'm trying to program a "custom controls menu" in a menu.dat. For example, I would like to know which key corresponds to "+attack", whats the easiest way for code to know (in string form) which key I am using for that command?
i did try with findkeysforcommand function, with for example +forward command (and using a 0 for bindmap float), but instead a "understable" (for me) string, i did get a various numbers separated for spaces. something like '119' '-1' '-1' '-1'
What this mean? I did search in keycodes.qc (darkplaces) but i didnt find any key for "119", i guess the -1 means "empty" and each command can be seted with 4 keys. BU i am not sure.
if I'm right 119 is refered to "w" but, where i can find that information? its possible to convert that "119" float in the string "w", even using different keyboards ?
Aniway; Once I know what the "+attack" key is. I wish I could change that command, this would be done with a cmd under circumstances declared in m_keyup. I can write exceptions for each different button there.
for example:
"bind a +attack"
but in m_keyup i have
Code: Select all
void(float key, float ascii) m_keyup =
what means the ascii part?
Thanks for your help