Check if TAB is activated?

Posted By: preacherX

Check if TAB is activated? - 10/27/17 10:39

Is there a way to check if TAB is activated?
Do you have an example?
Posted By: jockerob

Re: Check if TAB is activated? - 10/27/17 13:23

the online manual gives a engine function named "key_pressed" that may help.
the TAB sancode is 15.

key_pressed (var number);
Checks whether a certain the key or button with the scancode given by number (see key mapping ) is pressed.
Posted By: Kartoffel

Re: Check if TAB is activated? - 10/27/17 13:41

key_tab anyone confused
Posted By: DriftWood

Re: Check if TAB is activated? - 10/27/17 20:33

^--- Thank you, clear as day. However, if you want to wrap KEY_TAB + key_lastpressed(key released) you can use a function from keys.c.

Quote:
key_hit (var number)
Returns nonzero when the key with the given scan code (1..256, see key mapping) was pressed since the last key_hit call. It can be used in a while()..wait() loop to detect the moment when the key was pressed down.
key_hit (STRING* keystr)
Returns nonzero when the key belonging to given character string (f.i. "a", "f1", "esc" - see key mapping) was pressed since the last key_hit call. It can be used in a while()..wait() loop to detect the moment when the key was pressed down. A usage example can be found in the camera.c code.

http://www.conitec.net/beta/keys_c.htm
key_hit(-x-) followed by not !key_hit(-x-) in a while/if
Posted By: preacherX

Re: Check if TAB is activated? - 10/27/17 23:18

I don't want to check if the key was pressed.

I want to check if the TAB function of the keyboard is activated (this could also happened before the engine starts and so key_hit would not detect it).

When it is ON, you don't have to press Shift to write capital letters.

In my game the user have to write small letters but when TAB is activated this will not work. So I want to tell the player that he should deactivate it but I don't know how to check if it is ON.
Posted By: Superku

Re: Check if TAB is activated? - 10/28/17 06:31

Apparently you mean the Caps Lock key, not the Tab key.
Click here and subsequent links: https://stackoverflow.com/questions/13905342/winapi-how-to-get-the-caps-lock-state
Posted By: preacherX

Re: Check if TAB is activated? - 10/28/17 08:52

Ups, yes, you're right! My fault! crazy Thanks for the link!
© 2024 lite-C Forums