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.