'is any key pressed' is a trigger and so it makes sense that you can't invert that
however, you would be able to invert 'is any key down'...
..if it existed.
Not sure why it doesn't.
anyway, just to expand on EncryptedCows method
if the variable is local and non static
+var = 0
+on any key pressed > set var = 1
then you don't need to keep adding or subtracting cos the var gets reset to 0 every tick anyway