new commands findkey & findkeycode
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7154 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -183,6 +183,18 @@ docargument [S] [the string to execute] [] [0];
|
||||
docexample [execute (concat echo (addpunct fov 3))] [Example output: 90.0];
|
||||
docident [findcn] [find client number (cn)];
|
||||
docargument [N] [NAME] [] [0];
|
||||
docident [findkey] [Returns the name of a key via a specified code.];
|
||||
docargument [I] [integer] [] [0];
|
||||
docremark [Returns -255 if the key does not exist.];
|
||||
docremark [See /config/keymap.cfg for a full list of valid key codes.];
|
||||
docexample [echo (findkey 8)] [Output: BACKSPACE];
|
||||
docexample [echo (findkey 280)] [Output: PAGEUP];
|
||||
docident [findkeycode] [Returns the integer code of a key.];
|
||||
docargument [K] [the name of the key] [] [0];
|
||||
docremark [Returns -255 if the key does not exist.];
|
||||
docremark [See /config/keymap.cfg for a full list of valid key names.];
|
||||
docexample [echo (findkeycode BACKSPACE)] [Output: 8];
|
||||
docexample [echo (findkeycode PAGEUP)] [Output: 280];
|
||||
docident [findlist] [Searches a list for a specified value.];
|
||||
docargument [L] [the list] [] [0];
|
||||
docargument [I] [the item to find] [] [0];
|
||||
@@ -208,6 +220,8 @@ docexample [const hello ""; echo (isconst hello)] [Output: 1];
|
||||
docexample [hello = value; echo (isconst hello)] [Output: 0];
|
||||
docident [isIdent] [returns whether or not there is an identifier by that name];
|
||||
docargument [N] [identifier name] [] [0];
|
||||
docident [keybind] [Returns the contents of a keybind.];
|
||||
docargument [K] [name of key] [] [0];
|
||||
docident [l0] [leading zeros for the number V to make it W chars wide. It may look like 10 - which might be considered a mnemonic - but it's lowercase-L and 0!];
|
||||
docargument [W] [WIDTH] [] [0];
|
||||
docargument [V] [VALUE] [] [0];
|
||||
|
||||
@@ -206,6 +206,39 @@ keym *findbindc(int code)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void findkey(int *code)
|
||||
{
|
||||
for (int i = 0; i < keyms.length(); i++)
|
||||
{
|
||||
if(keyms[i].code==*code)
|
||||
{
|
||||
defformatstring(out)("%s", keyms[i].name);
|
||||
result(out);
|
||||
return;
|
||||
}
|
||||
}
|
||||
result("-255");
|
||||
return;
|
||||
}
|
||||
|
||||
void findkeycode(const char* s)
|
||||
{
|
||||
for (int i = 0; i < keyms.length(); i++)
|
||||
{
|
||||
if(strcmp(s, keyms[i].name) == 0)
|
||||
{
|
||||
defformatstring(out)("%i", keyms[i].code);
|
||||
result(out);
|
||||
return;
|
||||
}
|
||||
}
|
||||
result("-255");
|
||||
return;
|
||||
}
|
||||
|
||||
COMMAND(findkey, "i");
|
||||
COMMAND(findkeycode, "s");
|
||||
|
||||
keym *keypressed = NULL;
|
||||
char *keyaction = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user